👩‍💼 feat: pm role more robust

This commit is contained in:
Florian Hönicke
2023-04-27 15:36:25 +02:00
parent dbacfd6511
commit 4bbbb938f1
3 changed files with 33 additions and 12 deletions

View File

@@ -24,7 +24,7 @@ from src.options.generate.templates_user import template_generate_microservice_n
template_generate_apt_get_install, template_solve_apt_get_dependency_issue, \
template_is_dependency_issue, template_generate_playground, \
template_generate_executor, template_generate_test, template_generate_requirements, \
template_chain_of_thought, template_summarize_error
template_chain_of_thought, template_summarize_error, template_task_refinement
from src.options.generate.ui import get_random_employee
from src.utils.io import persist_file, get_all_microservice_files_with_content, get_microservice_path
from src.utils.string_tools import print_colored
@@ -417,9 +417,9 @@ Test scenario:
''')
def refine_task(self, pm):
task_description = self.microservice_specification.task
if not task_description:
task_description = self.get_user_input(pm, 'What should your microservice do?')
user_input = self.microservice_specification.task
if not user_input:
user_input = self.get_user_input(pm, 'What should your microservice do?')
messages = [
SystemMessage(content=system_task_introduction + system_task_iteration),
]
@@ -427,7 +427,7 @@ Test scenario:
while True:
conversation = self.gpt_session.get_conversation(messages, print_stream=os.environ['VERBOSE'].lower() == 'true', print_costs=False)
print('thinking...')
agent_response_raw = conversation.chat(task_description, role='user')
agent_response_raw = conversation.chat(template_task_refinement.format(user_input=user_input), role='user')
question = self.extract_content_from_result(agent_response_raw, 'prompt.txt', can_contain_code_block=False)
task_final = self.extract_content_from_result(agent_response_raw, 'task-final.txt', can_contain_code_block=False)
@@ -435,10 +435,10 @@ Test scenario:
self.microservice_specification.task = task_final
break
if question:
task_description = self.get_user_input(pm, question)
messages.extend([HumanMessage(content=task_description)])
user_input = self.get_user_input(pm, question)
messages.extend([HumanMessage(content=user_input)])
else:
task_description = self.get_user_input(pm, agent_response_raw + '\n: ')
user_input = self.get_user_input(pm, agent_response_raw + '\n: ')
def refine_test(self, pm):
messages = [

View File

@@ -129,7 +129,7 @@ database access: <insert one of ✅, ❌ or n/a here>
You must do either a or b.
a)
If the description is not sufficiently specified, then ask for the missing information.
Your response must exactly match the following block code format:
Your response must exactly match the following block code format (double asterisks for the file name and triple backticks for the file block):
**prompt.txt**
```text
@@ -139,7 +139,7 @@ Your response must exactly match the following block code format:
b)
Otherwise you respond with the summarized description.
The summarized description must contain all the information mentioned by the client.
Your response must exactly match the following block code format:
Your response must exactly match the following block code format (double asterisks for the file name and triple backticks for the file block):
**task-final.txt**
```text
@@ -190,7 +190,7 @@ Your task is to describe verbally a unit test for that microservice.
There are two cases:
a) The unit test requires an example file as input.
In this case you must ask the client to provide the example file as URL.
Your response must exactly match the following block code format:
Your response must exactly match the following block code format (double asterisks for the file name and triple backticks for the file block):
**prompt.txt**
```text
@@ -200,7 +200,7 @@ Your response must exactly match the following block code format:
If you did a, you must not do b.
b) Any strings, ints, or bools can be used as input for the unit test.
In this case you must describe the unit test verbally.
Your response must exactly match the following block code format:
Your response must exactly match the following block code format (double asterisks for the file name and triple backticks for the file block):
**test-final.txt**
```text

View File

@@ -356,3 +356,24 @@ The playground (app.py) must always use the host on http://localhost:8080 and mu
The playground (app.py) must not import the executor.
'''
)
template_task_refinement = PromptTemplate.from_template(
'''
**client response**
```text
{user_input}
```
Either ask for clarification like this:
**prompt.txt**
```text
<prompt to the client here>
```
Or write the summarized description like this:
**task-final.txt**
```text
<task here>
```
'''
)