diff --git a/src/constants.py b/src/constants.py index 1715861..d03b047 100644 --- a/src/constants.py +++ b/src/constants.py @@ -14,7 +14,6 @@ DOCKER_FILE_TAG = 'dockerfile' CLIENT_FILE_TAG = 'python' STREAMLIT_FILE_TAG = 'python' - FILE_AND_TAG_PAIRS = [ (EXECUTOR_FILE_NAME, EXECUTOR_FILE_TAG), (IMPLEMENTATION_FILE_NAME, IMPLEMENTATION_FILE_TAG), @@ -41,7 +40,12 @@ DEMO_TOKEN = '45372338e04f5a41af949024db929d46' BLACKLISTED_PACKAGES = [ # 'Pyrender', 'Trimesh', - 'moderngl', 'pyopengl', 'pyglet', 'pythreejs', 'panda3d', # because they need a screen, - 'fastapi', 'uvicorn', 'starlette', # because we use jina executors + 'moderngl', 'pyopengl', 'pyglet', 'pythreejs', 'panda3d', # because they need a screen, + 'fastapi', 'uvicorn', 'starlette', # because we use jina executors ] +LANGUAGE_PACKAGES = [ + 'allennlp', 'bertopic', 'fasttext', 'flair', 'gensim', 'nltk', + 'pattern', 'polyglot', 'pytorch-transformers', 'rasa', 'sentence-transformers', + 'spacy', 'stanza', 'summarizer', 'sumy', 'textblob', 'textstat', 'transformers' +] diff --git a/src/options/generate/generator.py b/src/options/generate/generator.py index 021dc34..f476fd6 100644 --- a/src/options/generate/generator.py +++ b/src/options/generate/generator.py @@ -18,7 +18,7 @@ from src.apis.pypi import is_package_on_pypi from src.constants import FILE_AND_TAG_PAIRS, NUM_IMPLEMENTATION_STRATEGIES, MAX_DEBUGGING_ITERATIONS, \ BLACKLISTED_PACKAGES, EXECUTOR_FILE_NAME, TEST_EXECUTOR_FILE_NAME, TEST_EXECUTOR_FILE_TAG, \ REQUIREMENTS_FILE_NAME, REQUIREMENTS_FILE_TAG, DOCKER_FILE_NAME, IMPLEMENTATION_FILE_NAME, \ - IMPLEMENTATION_FILE_TAG + IMPLEMENTATION_FILE_TAG, LANGUAGE_PACKAGES from src.options.generate.templates_system import system_task_iteration, system_task_introduction, system_test_iteration from src.options.generate.templates_user import template_generate_microservice_name, \ template_generate_possible_packages, \ @@ -538,10 +538,7 @@ Test scenario: @staticmethod def replace_with_gpt_3_5_turbo_if_possible(pkg): - if pkg in ['allennlp', 'bertopic', 'fasttext', 'flair', 'gensim', 'nltk', - 'pattern', 'polyglot', 'pytorch-transformers', 'rasa', 'sentence-transformers', - 'spacy', 'stanza', 'summarizer', 'sumy', 'textblob', 'textstat', 'transformers']: - + if pkg in LANGUAGE_PACKAGES: return 'gpt_3_5_turbo_api' return pkg diff --git a/src/options/generate/templates_user.py b/src/options/generate/templates_user.py index ff4d71a..6b64638 100644 --- a/src/options/generate/templates_user.py +++ b/src/options/generate/templates_user.py @@ -413,7 +413,7 @@ Or write the detailed microservice description all mentioned code samples, docum ```json {{ "description": "", - "example_input_file": "", + "example_input": "", "code_samples": "", "documentation_info": "", "credentials: "" @@ -430,8 +430,9 @@ Note that if urls, secrets, database names, etc. are mentioned, they must be par template_pm_test_iteration = PromptTemplate.from_template( '''{micro_service_initial_description} -1. write down if the original description and the refined description contain an example input for the microservice. -2. write down either prompt.json or final.json. +1. write down if the microservice requires input. +2. if it requires input, then write down if the original description or the refined description contain an example input for the microservice. +3. write down either prompt.json or final.json. If the example input for the microservice is mentioned in the refined description or the original description, then output final.json. Otherwise, output prompt.json where you ask for the example input file as URL or the example string. Except for urls, you should come up with your own example input that makes sense for the microservice description. @@ -452,6 +453,7 @@ Example for the case where the example input string is required and was not ment }} ``` Note that you must not ask for an example input in case the example input is already mentioned in the refined description or the original description. +Note that you must not ask for an example input in case the microservice does not require input. Example for the case where the example is already mentioned in the refined description or the original description: **final.json**