mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-20 07:04:20 +01:00
➕ refactor: summarize error message without line number
This commit is contained in:
@@ -19,26 +19,21 @@ def answer_yes_no_question(text, question):
|
||||
question=question,
|
||||
text=text,
|
||||
)
|
||||
# count words "yes" and "no" in pros and cons
|
||||
yes_count = pros_and_cons.lower().count('yes')
|
||||
no_count = pros_and_cons.lower().count('no')
|
||||
return yes_count > no_count
|
||||
|
||||
# return ask_gpt(
|
||||
# question_prompt,
|
||||
# boolean_parser,
|
||||
# text=text,
|
||||
# question=question,
|
||||
# pros_and_cons=pros_and_cons,
|
||||
# )
|
||||
return ask_gpt(
|
||||
question_prompt,
|
||||
boolean_parser,
|
||||
text=text,
|
||||
question=question,
|
||||
pros_and_cons=pros_and_cons,
|
||||
)
|
||||
|
||||
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 yes or no. \
|
||||
Each bullet point ends with either "- yes" or "- no".'''
|
||||
Note: You must not answer the question. Instead, give between 1 and 5 bullet points (5 words each) arguing why the question should be answered with yes or no.'''
|
||||
|
||||
question_prompt = '''\
|
||||
# Context
|
||||
|
||||
@@ -66,7 +66,7 @@ Description of the microservice:
|
||||
'Microservice description': microservice_description,
|
||||
},
|
||||
condition_question='''\
|
||||
Does the microservice send requests to an API beside the google_custom_search and gpt_3_5_turbo?''',
|
||||
Besides interacting with the Google Custom Search and GPT-3.5 Turbo APIs, does the microservice make requests to any other APIs?''',
|
||||
question_gen='Generate a question that asks for the endpoint of the external API and an example of a request and response when interacting with the external API.',
|
||||
extension_name='Example of API usage',
|
||||
post_transformation_fn=translation(from_format='api instruction', to_format='python code snippet raw without formatting')
|
||||
|
||||
@@ -17,5 +17,46 @@ The summary is returned as a string. \
|
||||
The microservice uses the Yahoo Finance API to fetch the stock data and Python libraries to calculate the average closing price and generate the summary. \
|
||||
The request parameter is "stock_symbol" and the response parameter is "summary".
|
||||
```
|
||||
''', 'Does the microservice send requests to an API beside the google_custom_search and gpt_3_5_turbo?'
|
||||
) == True
|
||||
''', 'Besides interacting with the Google Custom Search and GPT-3.5 Turbo APIs, does the microservice make requests to any other APIs?'
|
||||
)
|
||||
|
||||
def test_answer_yes_no_question_2(tmpdir):
|
||||
os.environ['VERBOSE'] = 'true'
|
||||
GPTSession(os.path.join(str(tmpdir), 'log.json'), model='gpt-3.5-turbo')
|
||||
assert not answer_yes_no_question(
|
||||
'''\
|
||||
Microservice description:
|
||||
```
|
||||
This microservice takes a list of email addresses as input and returns a grid pattern PNG image of company logos corresponding to the unique domain names extracted from the email addresses. The logos are obtained by searching for them using the Google Custom Search API and then resizing them to a square shape. The microservice returns the PNG image as a base64 encoded string. The input JSON must contain an array of email addresses under the key "emails". The output JSON contains a base64 encoded string of the logo grid image under the key "logo_grid".
|
||||
```
|
||||
|
||||
Request schema:
|
||||
```
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"emails": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"format": "email"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["emails"]
|
||||
}
|
||||
```
|
||||
|
||||
Response schema:
|
||||
```
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"logo_grid": {
|
||||
"type": "string",
|
||||
"format": "base64"
|
||||
}
|
||||
},
|
||||
"required": ["logo_grid"]
|
||||
}
|
||||
```''', 'Does the request schema provided include a property that represents a file?')
|
||||
Reference in New Issue
Block a user