Skip to content

Commit

Permalink
fix: types in parallel type test
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnl committed Apr 27, 2024
1 parent 1e819f0 commit 9fc44f5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/llm/test_openai/test_parallel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Iterable, Literal
from typing import Iterable, Literal, Union
from pydantic import BaseModel

import pytest
Expand Down Expand Up @@ -34,7 +34,7 @@ def test_sync_parallel_tools__error(client):


def test_sync_parallel_tools_or(client):
client = instructor.patch(client, mode=instructor.Mode.PARALLEL_TOOLS)
client = instructor.from_openai(client, mode=instructor.Mode.PARALLEL_TOOLS)
resp = client.chat.completions.create(
model="gpt-4-turbo-preview",
messages=[
Expand All @@ -44,14 +44,14 @@ def test_sync_parallel_tools_or(client):
"content": "What is the weather in toronto and dallas and who won the super bowl?",
},
],
response_model=Iterable[Weather | GoogleSearch],
response_model=Iterable[Union[Weather, GoogleSearch]],
)
assert len(list(resp)) == 3


@pytest.mark.asyncio
async def test_async_parallel_tools_or(aclient):
client = instructor.patch(aclient, mode=instructor.Mode.PARALLEL_TOOLS)
client = instructor.from_openai(aclient, mode=instructor.Mode.PARALLEL_TOOLS)
resp = await client.chat.completions.create(
model="gpt-4-turbo-preview",
messages=[
Expand All @@ -61,7 +61,7 @@ async def test_async_parallel_tools_or(aclient):
"content": "What is the weather in toronto and dallas and who won the super bowl?",
},
],
response_model=Iterable[Weather | GoogleSearch],
response_model=Iterable[Union[Weather, GoogleSearch]],
)
assert len(list(resp)) == 3

Expand Down

0 comments on commit 9fc44f5

Please sign in to comment.