Skip to content

Commit 5b6163d

Browse files
revert fixture removal
1 parent 57c2a6e commit 5b6163d

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

tests/integrations/openai_agents/test_openai_agents.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,24 @@ def inner(instructions):
313313
return inner
314314

315315

316+
@pytest.fixture
317+
def test_agent_custom_model():
318+
"""Create a real Agent instance for testing."""
319+
return Agent(
320+
name="test_agent_custom_model",
321+
instructions="You are a helpful test assistant.",
322+
# the model could be agents.OpenAIChatCompletionsModel()
323+
model="my-custom-model",
324+
model_settings=ModelSettings(
325+
max_tokens=100,
326+
temperature=0.7,
327+
top_p=1.0,
328+
presence_penalty=0.0,
329+
frequency_penalty=0.0,
330+
),
331+
)
332+
333+
316334
@pytest.fixture
317335
def get_model_response():
318336
def inner(response_content):
@@ -638,6 +656,7 @@ async def test_agent_invocation_span(
638656
async def test_client_span_custom_model(
639657
sentry_init,
640658
capture_events,
659+
test_agent_custom_model,
641660
mock_model_response,
642661
get_model_response,
643662
):
@@ -647,20 +666,7 @@ async def test_client_span_custom_model(
647666

648667
client = AsyncOpenAI(api_key="test-key")
649668
model = OpenAIResponsesModel(model="my-custom-model", openai_client=client)
650-
651-
agent = Agent(
652-
name="test_agent_custom_model",
653-
instructions="You are a helpful test assistant.",
654-
# the model could be agents.OpenAIChatCompletionsModel()
655-
model=model,
656-
model_settings=ModelSettings(
657-
max_tokens=100,
658-
temperature=0.7,
659-
top_p=1.0,
660-
presence_penalty=0.0,
661-
frequency_penalty=0.0,
662-
),
663-
)
669+
agent = test_agent_custom_model.clone(model=model)
664670

665671
response = get_model_response(mock_model_response)
666672

0 commit comments

Comments
 (0)