mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-25 01:14:24 +01:00
🧪 test: level 2
This commit is contained in:
@@ -46,7 +46,7 @@ class Generator:
|
||||
|
||||
def extract_content_from_result(self, plain_text, file_name, match_single_block=False, can_contain_code_block=True):
|
||||
optional_line_break = '\n' if can_contain_code_block else '' # the \n at the end makes sure that ``` within the generated code is not matched because it is not right before a line break
|
||||
pattern = fr"^\*?\*?{file_name}\*?\*?\n```(?:\w+\n)?([\s\S]*?){optional_line_break}```"
|
||||
pattern = fr"\*?\*?{file_name}\*?\*?\n```(?:\w+\n)?([\s\S]*?){optional_line_break}```"
|
||||
match = re.search(pattern, plain_text, re.MULTILINE)
|
||||
if match:
|
||||
return match.group(1).strip()
|
||||
@@ -431,12 +431,11 @@ gptdeploy deploy --path {self.microservice_root_path}
|
||||
if not original_task:
|
||||
self.microservice_specification.task = self.get_user_input(pm, 'What should your microservice do?')
|
||||
|
||||
messages = [
|
||||
SystemMessage(content=system_task_introduction + system_task_iteration),
|
||||
]
|
||||
self.refine_requirements(
|
||||
pm,
|
||||
messages,
|
||||
[
|
||||
SystemMessage(content=system_task_introduction + system_task_iteration),
|
||||
],
|
||||
'task',
|
||||
'',
|
||||
template_pm_task_iteration,
|
||||
@@ -445,20 +444,31 @@ gptdeploy deploy --path {self.microservice_root_path}
|
||||
''',
|
||||
)
|
||||
|
||||
messages = [
|
||||
SystemMessage(content=system_task_introduction + system_test_iteration),
|
||||
]
|
||||
# while True:
|
||||
# example_input = get_example_input()
|
||||
# if example_input:
|
||||
# break
|
||||
# else:
|
||||
# user_input = ask_client_for_example()
|
||||
#
|
||||
# is example input already provided
|
||||
self.refine_requirements(
|
||||
pm,
|
||||
messages,
|
||||
[
|
||||
SystemMessage(content=system_task_introduction + system_test_iteration),
|
||||
],
|
||||
'test',
|
||||
'''Note that the test scenario must not contain information that was already mentioned in the microservice description.
|
||||
Note that you must not ask for information that were already mentioned before.''',
|
||||
template_pm_test_iteration,
|
||||
micro_service_initial_description=f'''Microservice original description:
|
||||
```
|
||||
{original_task}
|
||||
```
|
||||
Microservice refined description:
|
||||
```
|
||||
{self.microservice_specification.task}
|
||||
```
|
||||
''',
|
||||
)
|
||||
break
|
||||
|
||||
@@ -101,6 +101,9 @@ You must not accept files that are not URLs.
|
||||
You must not ask for an example input in case the input can be determined from the conversation with the client.
|
||||
Your response must exactly match the following block code format (double asterisks for the file name and triple backticks for the file block):
|
||||
|
||||
1.
|
||||
contains example: no
|
||||
2.
|
||||
**prompt.txt**
|
||||
```text
|
||||
<prompt to the client here>
|
||||
@@ -110,37 +113,53 @@ If you did a, you must not do b.
|
||||
b) If the input can be determined from the previous messages:
|
||||
In this case you must describe the unit test verbally.
|
||||
Your response must exactly match the following block code format (double asterisks for the file name and triple backticks for the file block):
|
||||
|
||||
1.
|
||||
contains example: yes (<insert example here>)
|
||||
2.
|
||||
**final.txt**
|
||||
```text
|
||||
input: "<input here>"
|
||||
weak assertion of output: "<weak assertion of output here>"
|
||||
assertion: "<weak assertion of output here>"
|
||||
```
|
||||
|
||||
If you did b, you must not do a.
|
||||
|
||||
Example for: "given a city, get the weather report for the next 5 days using OpenWeatherMap with the api key b6907d289e10d714a6e88b30761fae22":
|
||||
Example for: "given a city like "Berlin", get the weather report for the next 5 days using OpenWeatherMap with the api key b6907d289e10d714a6e88b30761fae22":
|
||||
1.
|
||||
contains example: yes (Berlin)
|
||||
2.
|
||||
**final.txt**
|
||||
```text
|
||||
input: "Berlin"
|
||||
weak assertion of output: "contains weather report for the next 5 days"
|
||||
assertion: "contains weather report for the next 5 days"
|
||||
```
|
||||
|
||||
Example for "The user inserts a png and gets an svg as response.":
|
||||
1.
|
||||
contains example: no
|
||||
2.
|
||||
**prompt.txt**
|
||||
```text
|
||||
Please provide a png example input file as url.
|
||||
```
|
||||
|
||||
Example for "The user inserts a png like https://aquasecurity.github.io/kube-bench/v0.6.5/images/kube-bench-logo-only.png and gets an svg as response.":
|
||||
1.
|
||||
contains example: yes (https://aquasecurity.github.io/kube-bench/v0.6.5/images/kube-bench-logo-only.png)
|
||||
2.
|
||||
**final.txt**
|
||||
```text
|
||||
input: "https://aquasecurity.github.io/kube-bench/v0.6.5/images/kube-bench-logo-only.png"
|
||||
weak assertion of output: "is an svg"
|
||||
assertion: "is an svg"
|
||||
```
|
||||
|
||||
Example for "The microservice takes nothing as input and returns the current time.":
|
||||
1.
|
||||
contains example: n/a
|
||||
**final.txt**
|
||||
```text
|
||||
input: "nothing"
|
||||
weak assertion of output: "is a string"
|
||||
assertion: "is a string"
|
||||
```
|
||||
'''
|
||||
|
||||
@@ -383,10 +383,10 @@ 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. Look at the original description and the refined description.
|
||||
2. find out if the original description and the refined description contain an example input for the microservice.
|
||||
1. write down if the original description and the refined description contain an example input for the microservice.
|
||||
2. write down either prompt.txt or final.txt.
|
||||
If the example input for the microservice is mentioned in the refined description or the original description, then output final.txt.
|
||||
Otherwise, output prompt.txt where you ask for the example input file as URL.
|
||||
Otherwise, output prompt.txt 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.
|
||||
|
||||
Example for the case where an example input file is required and was not mentioned before:
|
||||
@@ -400,8 +400,9 @@ Example for the case where the example input string is required and was not ment
|
||||
```text
|
||||
Can you please provide an example input string?
|
||||
```
|
||||
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.
|
||||
|
||||
Example for the case where the example input string or the example input file URL was already mentioned:
|
||||
Example for the case where the example is already mentioned in the refined description or the original description:
|
||||
**final.txt**
|
||||
```text
|
||||
input: "<input here>"
|
||||
@@ -411,8 +412,7 @@ Note that your response must be either prompt.txt or final.txt. You must not wri
|
||||
Note that you must obey the double asterisk and tripple backtick syntax from above.
|
||||
Note that the last sequence of characters in your response must be ``` (triple backtick).
|
||||
Note that your response must start with the character sequence ** (double asterisk).
|
||||
Note that prompt.txt must not only contain one question.
|
||||
Note that if urls, secrets, database names, etc. are mentioned, they must be part of the summary.
|
||||
Note that prompt.txt must only contain one question.
|
||||
{custom_suffix}
|
||||
'''
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user