Skip to content

Commit 40b3365

Browse files
committed
tests
1 parent 5ef2c9f commit 40b3365

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/models/mock_openai.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
from .mock_async_stream import MockAsyncStream
1010

1111
with try_import() as imports_successful:
12-
from openai import NOT_GIVEN, AsyncOpenAI
12+
from openai import AsyncOpenAI
1313
from openai.types import chat, responses
1414
from openai.types.chat.chat_completion import Choice, ChoiceLogprobs
1515
from openai.types.chat.chat_completion_message import ChatCompletionMessage
1616
from openai.types.completion_usage import CompletionUsage
1717
from openai.types.responses.response import ResponseUsage
1818
from openai.types.responses.response_output_item import ResponseOutputItem
1919

20+
from pydantic_ai.models.openai import NOT_GIVEN, OMIT
21+
2022
MockChatCompletion = chat.ChatCompletion | Exception
2123
MockChatCompletionChunk = chat.ChatCompletionChunk | Exception
2224
MockResponse = responses.Response | Exception
@@ -50,7 +52,7 @@ def create_mock_stream(
5052
async def chat_completions_create( # pragma: lax no cover
5153
self, *_args: Any, stream: bool = False, **kwargs: Any
5254
) -> chat.ChatCompletion | MockAsyncStream[MockChatCompletionChunk]:
53-
self.chat_completion_kwargs.append({k: v for k, v in kwargs.items() if v is not NOT_GIVEN})
55+
self.chat_completion_kwargs.append({k: v for k, v in kwargs.items() if v not in (NOT_GIVEN, OMIT)})
5456

5557
if stream:
5658
assert self.stream is not None, 'you can only used `stream=True` if `stream` is provided'

0 commit comments

Comments
 (0)