mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-24 09:04:19 +01:00
🧪3️⃣ test: level 3 refinement
This commit is contained in:
@@ -11,7 +11,7 @@ from langchain.chat_models import ChatOpenAI
|
||||
from openai.error import RateLimitError
|
||||
from langchain.schema import HumanMessage, SystemMessage, BaseMessage, AIMessage
|
||||
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
||||
from requests.exceptions import ConnectionError
|
||||
from requests.exceptions import ConnectionError, ChunkedEncodingError
|
||||
from urllib3.exceptions import InvalidChunkLength
|
||||
|
||||
from src.constants import PRICING_GPT4_PROMPT, PRICING_GPT4_GENERATION, PRICING_GPT3_5_TURBO_PROMPT, \
|
||||
@@ -132,7 +132,7 @@ class _GPTConversation:
|
||||
try:
|
||||
response = self._chat(self.messages)
|
||||
break
|
||||
except (ConnectionError, InvalidChunkLength) as e:
|
||||
except (ConnectionError, InvalidChunkLength, ChunkedEncodingError) as e:
|
||||
print('There was a connection error. Retrying...')
|
||||
if i == 9:
|
||||
raise e
|
||||
|
||||
@@ -48,15 +48,16 @@ Your response must exactly match the following block code format (double asteris
|
||||
```
|
||||
|
||||
b)
|
||||
Otherwise you respond with the summarized description.
|
||||
The summarized description must contain all the information mentioned by the client.
|
||||
Otherwise you respond with the detailed description.
|
||||
The detailed description must contain all the information mentioned by 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):
|
||||
|
||||
**final.json**
|
||||
```json
|
||||
{{
|
||||
"description": "<microservice description here>",
|
||||
"implementation_details": "<additional implementation details here>",
|
||||
"code_samples": "<code samples from the client here>",
|
||||
"documentation_info": "<documentation info here>",
|
||||
"credentials: "<credentials here>"
|
||||
}}
|
||||
```
|
||||
@@ -87,7 +88,8 @@ database access: n/a
|
||||
```json
|
||||
{{
|
||||
"description": "The user inserts a png and gets an svg as response.",
|
||||
"implementation_details": "n/a",
|
||||
"code_samples": "n/a",
|
||||
"documentation_info": "n/a",
|
||||
"credentials: "n/a"
|
||||
}}
|
||||
```
|
||||
|
||||
@@ -383,12 +383,14 @@ Either ask for clarification like this:
|
||||
}}
|
||||
```
|
||||
|
||||
Or write the summarized microservice description and additional implementation details like this:
|
||||
Or write the detailed microservice description all mentioned code samples, documentation info and credentials like this:
|
||||
**final.json**
|
||||
```json
|
||||
{{
|
||||
"description": "<microservice description here>",
|
||||
"implementation_details": "<additional implementation details here>",
|
||||
"example_input_file": "<example input file here if mentioned before otherwise n/a>",
|
||||
"code_samples": "<code samples from the client here>",
|
||||
"documentation_info": "<documentation info here>",
|
||||
"credentials: "<credentials here>"
|
||||
}}
|
||||
```
|
||||
|
||||
@@ -85,8 +85,9 @@ def test_generation_level_3(tmpdir):
|
||||
"""
|
||||
os.environ['VERBOSE'] = 'true'
|
||||
generator = Generator(
|
||||
f'''Given an audio file (1min) of speech like https://www.signalogic.com/melp/EngSamples/Orig/ENG_M.wav,
|
||||
get convert it to text using the following api:
|
||||
f'''Given an audio file (1min wav) of speech,
|
||||
1. convert it to text using the Whisper API.
|
||||
Here is the documentation on how to use the API:
|
||||
import requests
|
||||
url = "https://transcribe.whisperapi.com"
|
||||
headers = {{
|
||||
@@ -97,8 +98,9 @@ data = {{
|
||||
}}
|
||||
response = requests.post(url, headers=headers, files=file, data=data)
|
||||
print(response.text)
|
||||
Summarize the text (50 words).
|
||||
Create an audio file of the summarized text.
|
||||
2. Summarize the text (~50 words) while still maintaining the key facts.
|
||||
3. Create an audio file of the summarized text using a tts library.
|
||||
Example input file: https://www.signalogic.com/melp/EngSamples/Orig/ENG_M.wav
|
||||
''',
|
||||
str(tmpdir) + 'microservice',
|
||||
'gpt-3.5-turbo'
|
||||
|
||||
Reference in New Issue
Block a user