Skip to content

Commit 2f3412c

Browse files
committed
Fix test
1 parent 9422982 commit 2f3412c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

test/components/generators/chat/test_openai_responses.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ def __call__(self, chunk: StreamingChunk) -> None:
760760
def test_live_run_with_tools_streaming(self, tools):
761761
chat_messages = [ChatMessage.from_user("What's the weather like in Paris and Berlin?")]
762762

763-
component = OpenAIResponsesChatGenerator(tools=tools, streaming_callback=print_streaming_chunk)
763+
component = OpenAIResponsesChatGenerator(model="gpt-5", tools=tools, streaming_callback=print_streaming_chunk)
764764
results = component.run(chat_messages)
765765
assert len(results["replies"]) == 1
766766
message = results["replies"][0]
@@ -769,12 +769,18 @@ def test_live_run_with_tools_streaming(self, tools):
769769
assert not message.text
770770
assert message.tool_calls
771771
tool_calls = message.tool_calls
772-
assert len(tool_calls) > 0
772+
assert len(tool_calls) == 2
773773

774774
for tool_call in tool_calls:
775775
assert isinstance(tool_call, ToolCall)
776776
assert tool_call.tool_name == "weather"
777777

778+
arguments = [tool_call.arguments for tool_call in tool_calls]
779+
# Extract city names (handle cases like "Berlin, Germany" -> "Berlin")
780+
city_values = [arg["city"].split(",")[0].strip().lower() for arg in arguments]
781+
assert "berlin" in city_values and "paris" in city_values
782+
assert len(city_values) == 2
783+
778784
@pytest.mark.skipif(
779785
not os.environ.get("OPENAI_API_KEY", None),
780786
reason="Export an env var called OPENAI_API_KEY containing the OpenAI API key to run this test.",

0 commit comments

Comments
 (0)