Skip to content

Commit 61061eb

Browse files
committed
test(genai): force google_search use in structured-output test
1 parent cf8f49c commit 61061eb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

libs/genai/tests/integration_tests/test_chat_models.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,12 +1715,15 @@ class MatchResult(BaseModel):
17151715
response_schema=MatchResult.model_json_schema(),
17161716
)
17171717

1718+
prompt = (
1719+
"Use the google_search tool to find all details for the latest Euro "
1720+
"championship final match. Always call google_search before responding."
1721+
)
1722+
17181723
if use_streaming:
17191724
# Test streaming
17201725
chunks: list[BaseMessageChunk] = []
1721-
for chunk in llm_with_search.stream(
1722-
"Search for all details for the latest Euro championship final match."
1723-
):
1726+
for chunk in llm_with_search.stream(prompt):
17241727
assert isinstance(chunk, AIMessageChunk)
17251728
chunks.append(chunk)
17261729

@@ -1735,9 +1738,7 @@ class MatchResult(BaseModel):
17351738
assert isinstance(response, AIMessageChunk)
17361739
else:
17371740
# Test invoke
1738-
response = llm_with_search.invoke( # type: ignore[assignment]
1739-
"Search for all details for the latest Euro championship final match."
1740-
)
1741+
response = llm_with_search.invoke(prompt) # type: ignore[assignment]
17411742
assert isinstance(response, AIMessage)
17421743

17431744
# Extract JSON from response content

0 commit comments

Comments
 (0)