Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ jobs:
strategy:
fail-fast: false
matrix:
group: [0, 1, 2, 3, 4, 5_company_logos]
group: [
0_test,
1_positive_tweet,
2_pdf_summarization,
3_fin_api,
4_audio_summarization,
4_svg,
5_company_logos
]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
Expand Down
46 changes: 32 additions & 14 deletions test/integration/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# The cognitive difficulty level is determined by the number of requirements the microservice has.

@pytest.mark.parametrize('mock_input_sequence', [['y']], indirect=True)
def test_generation_level_0(microservice_dir, mock_input_sequence):
def test_generation_level_0_test(microservice_dir, mock_input_sequence):
"""
Requirements:
coding challenge: ❌
Expand All @@ -29,19 +29,19 @@ def test_generation_level_0(microservice_dir, mock_input_sequence):


@pytest.mark.parametrize('mock_input_sequence', [['y']], indirect=True)
def test_generation_level_1(microservice_dir, mock_input_sequence):
def test_generation_level_1_positive_tweet(microservice_dir, mock_input_sequence):
"""
Requirements:
coding challenge: ❌
pip packages: ❌
environment: ❌
GPT-3.5-turbo: ✅ (for summarizing the text)
GPT-3.5-turbo: ✅ (for modifying the text)
APIs: ❌
Databases: ❌
"""
os.environ['VERBOSE'] = 'true'
generator = Generator(
'''Input is a tweet that might contain passive aggressive language. The output is the positive version of that tweet.
'''Input is a tweet that might contain passive-aggressive language. The output is the positive version of that tweet.
Example tweet:
\'When your coworker microwaves fish in the break room... AGAIN. 🐟🤢
But hey, at least SOMEONE's enjoying their lunch. #officelife\'''',
Expand All @@ -52,9 +52,8 @@ def test_generation_level_1(microservice_dir, mock_input_sequence):
assert generator.generate() == 0


@pytest.mark.parametrize('mock_input_sequence', [['y', 'https://www.africau.edu/images/default/sample.pdf']],
indirect=True)
def test_generation_level_2(microservice_dir, mock_input_sequence):
@pytest.mark.parametrize('mock_input_sequence', [['y', 'https://www.africau.edu/images/default/sample.pdf']], indirect=True)
def test_generation_level_2_pdf_summarization(microservice_dir, mock_input_sequence):
"""
Requirements:
coding challenge: ❌
Expand Down Expand Up @@ -97,7 +96,7 @@ def test_generation_level_2_svg(microservice_dir, mock_input_sequence):


@pytest.mark.parametrize('mock_input_sequence', [['y', 'yfinance.Ticker("MSFT").info']], indirect=True)
def test_generation_level_3(microservice_dir, mock_input_sequence):
def test_generation_level_3_fin_api(microservice_dir, mock_input_sequence):
"""
Requirements:
coding challenge: ✅ (calculate the average closing price)
Expand Down Expand Up @@ -144,7 +143,7 @@ def test_generation_level_3(microservice_dir, mock_input_sequence):
],
indirect=True
)
def test_generation_level_4(microservice_dir, mock_input_sequence):
def test_generation_level_4_audio_summarization(microservice_dir, mock_input_sequence):
"""
Requirements:
coding challenge: ❌
Expand All @@ -160,10 +159,10 @@ def test_generation_level_4(microservice_dir, mock_input_sequence):
1. convert it to text using the Whisper API.
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.
4. Return the the audio file as base64 encoded binary.
4. Return the audio file as base64 encoded binary.
''',
str(microservice_dir),
'gpt-4',
'gpt-3.5-turbo',
# self_healing=False,
)
assert generator.generate() == 0
Expand All @@ -185,10 +184,29 @@ def test_generation_level_5_company_logos(microservice_dir, mock_input_sequence)
)
assert generator.generate() == 0

@pytest.mark.parametrize('mock_input_sequence', [['y', 'https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png']], indirect=True)
def test_generation_level_4_svg(microservice_dir, mock_input_sequence):
"""
Requirements:
coding challenge: ✅✅ (involves three steps - segmentation, shape creation)
pip packages: ✅ (svg package)
environment: ✅ (svg dependencies)
GPT-3.5-turbo: ❌
APIs: ❌
Databases: ❌
"""
os.environ['VERBOSE'] = 'true'
generator = Generator(
f'''Given a png image, convert it into an svg image in a sophisticated way.''',
str(microservice_dir),
'gpt-3.5-turbo',
# self_healing=False,

)
assert generator.generate() == 0


@pytest.mark.parametrize('mock_input_sequence', [['y',
'https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/560px-PNG_transparency_demonstration_1.png']],
indirect=True)
@pytest.mark.parametrize('mock_input_sequence', [['y', 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/560px-PNG_transparency_demonstration_1.png']], indirect=True)
def test_generation_level_5(microservice_dir, mock_input_sequence):
"""
Requirements:
Expand Down