Skip to content

Commit fc36be6

Browse files
committed
fix
1 parent 42166de commit fc36be6

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/agents/models/openai_responses.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from dataclasses import dataclass
77
from typing import TYPE_CHECKING, Any, Literal, Union, cast, overload
88

9-
from openai import APIStatusError, AsyncOpenAI, AsyncStream, NotGiven, Omit, NOT_GIVEN, omit
9+
from openai import APIStatusError, AsyncOpenAI, AsyncStream, Omit, omit
1010
from openai.types import ChatModel
1111
from openai.types.responses import (
1212
Response,
@@ -266,12 +266,10 @@ async def _fetch_response(
266266
converted_tools_payload = _to_dump_compatible(converted_tools.tools)
267267
response_format = Converter.get_response_format(output_schema)
268268
should_omit_model = prompt is not None and not self._model_is_explicit
269-
model_param: str | ChatModel | NotGiven = (
270-
self.model if not should_omit_model else NOT_GIVEN
271-
)
269+
model_param: str | ChatModel | Omit = self.model if not should_omit_model else omit
272270
should_omit_tools = prompt is not None and len(converted_tools_payload) == 0
273-
tools_param: list[ToolParam] | NotGiven = (
274-
converted_tools_payload if not should_omit_tools else NOT_GIVEN
271+
tools_param: list[ToolParam] | Omit = (
272+
converted_tools_payload if not should_omit_tools else omit
275273
)
276274

277275
include_set: set[str] = set(converted_tools.includes)

tests/test_agent_prompt.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
from __future__ import annotations
2+
13
import pytest
2-
from openai import NOT_GIVEN
4+
from openai import omit
35

46
from agents import Agent, Prompt, RunConfig, RunContextWrapper, Runner
57
from agents.models.interface import Model, ModelProvider
68
from agents.models.openai_responses import OpenAIResponsesModel
79

8-
from .fake_model import FakeModel
9-
from .fake_model import get_response_obj
10+
from .fake_model import FakeModel, get_response_obj
1011
from .test_responses import get_text_message
1112

1213

@@ -139,5 +140,5 @@ def __init__(self):
139140

140141
expected_prompt = {"id": "pmpt_agent", "version": None, "variables": None}
141142
assert called_kwargs["prompt"] == expected_prompt
142-
assert called_kwargs["model"] is NOT_GIVEN
143-
assert called_kwargs["tools"] is NOT_GIVEN
143+
assert called_kwargs["model"] is omit
144+
assert called_kwargs["tools"] is omit

tests/test_openai_responses.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Any
44

55
import pytest
6-
from openai import NOT_GIVEN
6+
from openai import omit
77
from openai.types.responses import ResponseCompletedEvent
88

99
from agents import ModelSettings, ModelTracing, __version__
@@ -99,7 +99,7 @@ def __init__(self):
9999
)
100100

101101
assert called_kwargs["prompt"] == {"id": "pmpt_123"}
102-
assert called_kwargs["model"] is NOT_GIVEN
102+
assert called_kwargs["model"] is omit
103103

104104

105105
@pytest.mark.allow_call_model_methods
@@ -134,4 +134,4 @@ def __init__(self):
134134
prompt={"id": "pmpt_123"},
135135
)
136136

137-
assert called_kwargs["tools"] is NOT_GIVEN
137+
assert called_kwargs["tools"] is omit

0 commit comments

Comments
 (0)