Skip to content
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
id: test
run: |
pytest -vs test/integration/test_generator.py::test_generation_level_${{ matrix.group }}
timeout-minutes: 17
timeout-minutes: 20
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SCENEX_API_KEY: ${{ secrets.SCENEX_API_KEY }}
Expand All @@ -55,7 +55,7 @@ jobs:
id: test
run: |
pytest -vs test/unit
timeout-minutes: 15
timeout-minutes: 20
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SCENEX_API_KEY: ${{ secrets.SCENEX_API_KEY }}
Expand Down
9 changes: 6 additions & 3 deletions dev_gpt/options/generate/chains/question_answering.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ def answer_yes_no_question(text, question):
pros_and_cons_prompt = '''\
# Context
{text}
# Question
{question}
Note: You must not answer the question. Instead, give up to 5 bullet points (10 words) arguing why the question should be answered with true or false.'''

Give up to 5 bullet points (10 words) arguing why the question should be answered with yes or no.
{question}'''

question_prompt = '''\
# Context
{text}

# Question
{question}

# Pros and Cons
{pros_and_cons}

Note: You must answer "yes" or "no".
'''
21 changes: 12 additions & 9 deletions dev_gpt/options/generate/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
REQUIREMENTS_FILE_NAME, REQUIREMENTS_FILE_TAG, DOCKER_FILE_NAME, IMPLEMENTATION_FILE_NAME, \
IMPLEMENTATION_FILE_TAG, LANGUAGE_PACKAGES, UNNECESSARY_PACKAGES, DOCKER_BASE_IMAGE_VERSION, SEARCH_PACKAGES, \
INDICATOR_TO_IMPORT_STATEMENT
from dev_gpt.options.generate.chains.question_answering import answer_yes_no_question
from dev_gpt.options.generate.pm.pm import PM
from dev_gpt.options.generate.templates_user import template_generate_microservice_name, \
template_generate_possible_packages, \
Expand Down Expand Up @@ -500,16 +501,18 @@ def is_dependency_issue(self, summarized_error, dock_req_string: str, package_ma
[em in summarized_error for em in ['ModuleNotFoundError', 'ImportError']]):
return True

print_colored('', f'Is it a {package_manager} dependency issue?', 'blue')
conversation = self.gpt_session.get_conversation()
answer_raw = conversation.chat(
template_is_dependency_issue.format(summarized_error=summarized_error,
all_files_string=dock_req_string).replace('PACKAGE_MANAGER',
package_manager)
question = f'Is it a {package_manager} dependency issue?'
print_colored('', question, 'blue')

return answer_yes_no_question(
f'''\
Files:
{dock_req_string}

Summarized error message:
{summarized_error}''',
question
)
answer_json_string = self.extract_content_from_result(answer_raw, 'response.json', match_single_block=True, )
answer = json.loads(answer_json_string)['dependency_installation_failure']
return 'yes' in answer.lower()

def generate_microservice_name(self, description):
return ask_gpt(template_generate_microservice_name, description=description)
Expand Down