diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63a0452..97be0f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: id: test run: | pytest -vs test/test_generator.py::test_generation_level_${{ matrix.group }} - timeout-minutes: 10 + timeout-minutes: 15 env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} SCENEX_API_KEY: ${{ secrets.SCENEX_API_KEY }} diff --git a/src/options/generate/templates_user.py b/src/options/generate/templates_user.py index d5c374b..7e01ca0 100644 --- a/src/options/generate/templates_user.py +++ b/src/options/generate/templates_user.py @@ -118,6 +118,10 @@ The function must full-fill: '{microservice_description}'. It will be tested with the following scenario: '{test_description}'. For the implementation use the following package(s): '{packages}'. +The code must start with the following import: +``` +from .apis import GPT_3_5_Turbo_API +``` Obey the following rules: ''' + not_allowed_function_string + ''' @@ -138,11 +142,10 @@ template_generate_test = PromptTemplate.from_template( Write a single pytest case that tests the following scenario: '{test_description}'. In case the test scenario is not precise enough, test a general case without any assumptions. Start the test with an extensive comment about the test case. If gpt_3_5_turbo_api is used in the executor, then the test must not check the exact output of the executor as it is not deterministic. -You must use the following import to import the function: +The test must start with the following import: ``` from .implementation import func ``` - ''' + not_allowed_function_string + ''' The test must not open local files. The test must not mock a function of the executor. diff --git a/test/test_generator.py b/test/test_generator.py index fd9a19d..419c1d0 100644 --- a/test/test_generator.py +++ b/test/test_generator.py @@ -68,13 +68,43 @@ def test_generation_level_2(tmpdir): ) assert generator.generate() == 0 - def test_generation_level_3(tmpdir): """ Requirements: coding challenge: ❌ - pip packages: ✅ (text to speech) + pip packages: ✅ (csv parser) environment: ❌ + GPT-3.5-turbo: ✅ (for processing the text) + APIs: ✅ (financial data API) + Databases: ❌ + """ + os.environ['VERBOSE'] = 'true' + generator = Generator( + f'''The input is a stock symbol (e.g., AAPL for Apple Inc.). +1. Fetch stock data (open, high, low, close, volume) for the past 30 days using a financial data API (e.g., Alpha Vantage, Yahoo Finance, or any other API). +2. Calculate the average closing price over the 30 days. +3. Read a CSV file containing a list of stock symbols and their company names. +4. Find the input stock symbol in the CSV file and get the corresponding company name. +5. Generate a brief summary of the company's stock performance over the past 30 days, including the average closing price and the company name. +6. Return the summary as a string. +Example input: 'AAPL' +Example CSV file format: +symbol,company_name +AAPL,Apple Inc. +GOOGL,Alphabet Inc. +AMZN,Amazon.com, Inc. +''', + str(tmpdir) + 'microservice', + 'gpt-3.5-turbo' + ) + assert generator.generate() == 0 + +def test_generation_level_4(tmpdir): + """ + Requirements: + coding challenge: ❌ + pip packages: ✅ (text to speech) + environment: ✅ (tts library) GPT-3.5-turbo: ✅ (summarizing the text) APIs: ✅ (whisper for speech to text) Databases: ❌ @@ -101,17 +131,17 @@ print('This is the text from the audio file:', response.json()['text']) Example input file: https://www.signalogic.com/melp/EngSamples/Orig/ENG_M.wav ''', str(tmpdir) + 'microservice', - 'gpt-3.5-turbo' + 'gpt-4' ) assert generator.generate() == 0 -def test_generation_level_4(tmpdir): +def test_generation_level_5(tmpdir): """ Requirements: coding challenge: ✅ (putting text on the image) pip packages: ✅ (Pillow for image processing) - environment: ❌ + environment: ✅ (image library) GPT-3.5-turbo: ✅ (for writing the joke) APIs: ✅ (scenex for image description) Databases: ❌