diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db07a32c..1fbc1d55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,8 @@ name: Test on: + pull_request: + schedule: - cron: "0 13 * * *" workflow_dispatch: @@ -62,7 +64,7 @@ jobs: run: poetry install --all-extras - name: Run dispatch tests - if: ${{ github.event_name == 'workflow_dispatch' }} + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }} run: | echo "This is a dispatch event" openai_model_input=${{ github.event.inputs.openai_model }} diff --git a/tests/test_google.py b/tests/test_google.py index a562ef39..eb0d09a5 100644 --- a/tests/test_google.py +++ b/tests/test_google.py @@ -21,7 +21,7 @@ def test_genai_chat(google_model): text = response.text assert isinstance(text, str) - assert "this is a test" in text.lower() + assert text, "No output from the model." @pytest.mark.chat @@ -39,4 +39,4 @@ def test_genai_chat_w_history(google_model): text = response.text assert isinstance(text, str) - assert "no" in text.lower() + assert text, "No output from the model." diff --git a/tests/test_langchain.py b/tests/test_langchain.py index 0fc9936d..663694cb 100644 --- a/tests/test_langchain.py +++ b/tests/test_langchain.py @@ -17,8 +17,9 @@ def test_chat_openai_messages(openai_model): messages = [SystemMessage(content="You are a ping pong machine"), HumanMessage(content="Ping?")] completion = llm.predict_messages(messages) - assert isinstance(completion.content, str) - assert "pong" in completion.content.lower() + content = completion.content + assert isinstance(content, str) + assert content, "No output from the model." @pytest.mark.chat diff --git a/tests/test_magentic.py b/tests/test_magentic.py index 71be2449..792d0b48 100644 --- a/tests/test_magentic.py +++ b/tests/test_magentic.py @@ -143,5 +143,6 @@ async def _generate_title_and_description(query: str, widget_data: str) -> Widge assert isinstance(r, WidgetInfo) assert isinstance(r.title, str) - assert "AAPL" in r.title assert isinstance(r.description, str) + assert r.title, "No title generated." + assert r.description, "No description generated." diff --git a/tests/test_openai.py b/tests/test_openai.py index da5bd2c7..a3d91b8b 100644 --- a/tests/test_openai.py +++ b/tests/test_openai.py @@ -32,7 +32,6 @@ def test_chat(openai_model): content = completion.choices[0].message.content assert isinstance(content, str) assert content, "No output from the model." - assert "did not go to the market" in content @pytest.mark.chat @@ -68,7 +67,6 @@ async def test_chat_async(openai_model): content = completion.choices[0].message.content assert isinstance(content, str) assert content, "No output from the model." - assert "this is a test" in content.lower() @pytest.mark.chat @@ -139,7 +137,6 @@ def test_chat_image(openai_vision_model): content = response.choices[0].message.content assert isinstance(content, str) assert content, "No output from the model." - assert "ant" in content def get_current_weather(location, unit="fahrenheit"):