mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2026-01-10 09:04:26 +01:00
🧪 test: level 4
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
{
|
||||
"test/test_generator.py::test_generator": 246.233993379
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
import os
|
||||
|
||||
from src.options.generate.generator import Generator
|
||||
|
||||
# The cognitive difficulty level is determined by the number of Requirements the microservice has.
|
||||
|
||||
# The cognitive difficulty level is determined by the number of requirements the microservice has.
|
||||
|
||||
def test_generation_level_0(tmpdir):
|
||||
"""
|
||||
Requirements:
|
||||
coding: ❌
|
||||
pip packages: ❌
|
||||
environment: ❌
|
||||
GPT-3.5-turbo: ❌
|
||||
@@ -13,18 +16,66 @@ def test_generation_level_0(tmpdir):
|
||||
Databases: ❌
|
||||
"""
|
||||
os.environ['VERBOSE'] = 'true'
|
||||
generator = Generator("The microservice is very simple, it does not take anything as input and only outputs the word 'test'", str(tmpdir) + 'microservice', 'gpt-3.5-turbo')
|
||||
generator = Generator(
|
||||
"The microservice is very simple, it does not take anything as input and only outputs the word 'test'",
|
||||
str(tmpdir) + 'microservice',
|
||||
'gpt-3.5-turbo'
|
||||
)
|
||||
generator.generate()
|
||||
|
||||
|
||||
def test_generation_level_1(tmpdir):
|
||||
"""
|
||||
Requirements:
|
||||
pip packages: ✅
|
||||
coding: ❌
|
||||
pip packages: ✅ (pdf parser)
|
||||
environment: ❌
|
||||
GPT-3.5-turbo: ❌
|
||||
APIs: ❌
|
||||
Databases: ❌
|
||||
"""
|
||||
os.environ['VERBOSE'] = 'true'
|
||||
generator = Generator("The input is a PDF like https://www.africau.edu/images/default/sample.pdf and the output the parsed text", str(tmpdir) + 'microservice', 'gpt-3.5-turbo')
|
||||
generator.generate()
|
||||
generator = Generator(
|
||||
"The input is a PDF like https://www.africau.edu/images/default/sample.pdf and the output the parsed text",
|
||||
str(tmpdir) + 'microservice',
|
||||
'gpt-3.5-turbo'
|
||||
)
|
||||
generator.generate()
|
||||
|
||||
|
||||
def test_generation_level_4(tmpdir):
|
||||
"""
|
||||
Requirements:
|
||||
coding: ✅ (putting text on the image)
|
||||
pip packages: ✅ (Pillow for image processing)
|
||||
environment: ❌
|
||||
GPT-3.5-turbo: ✅ (for writing the joke)
|
||||
APIs: ✅ (scenex for image description)
|
||||
Databases: ❌
|
||||
"""
|
||||
os.environ['VERBOSE'] = 'true'
|
||||
generator = Generator(f'''
|
||||
The input is an image like this: https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/560px-PNG_transparency_demonstration_1.png.
|
||||
Use the following api to get the description of the image:
|
||||
Request:
|
||||
curl "https://us-central1-causal-diffusion.cloudfunctions.net/describe" \
|
||||
-H "x-api-key: token {os.environ['SCENEX_API_KEY']}" \
|
||||
-H "content-type: application/json" \
|
||||
--data '{{"data":[
|
||||
{{"image": "<image url here>", "features": []}}
|
||||
]}}'
|
||||
Result format:
|
||||
{
|
||||
"result": [
|
||||
{
|
||||
"text": "<image description>"
|
||||
}
|
||||
]
|
||||
}
|
||||
The description is then used to generate a joke.
|
||||
The joke is the put on the image.
|
||||
The output is the image with the joke on it.''',
|
||||
str(tmpdir) + 'microservice',
|
||||
'gpt-3.5-turbo'
|
||||
)
|
||||
generator.generate()
|
||||
|
||||
Reference in New Issue
Block a user