Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add run tests in pull request #164

Merged
merged 5 commits into from
May 29, 2024
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Test

on:
pull_request:

schedule:
- cron: "0 13 * * *"
workflow_dispatch:
Expand Down Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
5 changes: 3 additions & 2 deletions tests/test_langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/test_magentic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
3 changes: 0 additions & 3 deletions tests/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"):
Expand Down
Loading