[ROCm][CI] Fix flaky test_function_calling_with_stream and reduce schema test examples (#32063)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
@@ -129,7 +129,7 @@ def before_generate_case(context: schemathesis.hooks.HookContext, strategy):
|
|||||||
|
|
||||||
@schema.parametrize()
|
@schema.parametrize()
|
||||||
@schema.override(headers={"Content-Type": "application/json"})
|
@schema.override(headers={"Content-Type": "application/json"})
|
||||||
@settings(deadline=LONG_TIMEOUT_SECONDS * 1000)
|
@settings(deadline=LONG_TIMEOUT_SECONDS * 1000, max_examples=50)
|
||||||
def test_openapi_stateless(case: schemathesis.Case):
|
def test_openapi_stateless(case: schemathesis.Case):
|
||||||
key = (
|
key = (
|
||||||
case.operation.method.upper(),
|
case.operation.method.upper(),
|
||||||
|
|||||||
@@ -821,16 +821,20 @@ async def test_function_calling_with_stream(client: OpenAI, model_name: str):
|
|||||||
final_tool_calls_named[tool_call.name] = tool_call
|
final_tool_calls_named[tool_call.name] = tool_call
|
||||||
elif event.type == "response.function_call_arguments.done":
|
elif event.type == "response.function_call_arguments.done":
|
||||||
assert event.arguments == final_tool_calls_named[event.name].arguments
|
assert event.arguments == final_tool_calls_named[event.name].arguments
|
||||||
for tool_call in final_tool_calls.values():
|
result = None
|
||||||
if (
|
tool_call = None
|
||||||
tool_call
|
for tc in final_tool_calls.values():
|
||||||
and tool_call.type == "function_call"
|
if tc and tc.type == "function_call" and tc.name == "get_weather":
|
||||||
and tool_call.name == "get_weather"
|
args = json.loads(tc.arguments)
|
||||||
):
|
result = call_function(tc.name, args)
|
||||||
args = json.loads(tool_call.arguments)
|
tool_call = tc
|
||||||
result = call_function(tool_call.name, args)
|
input_list += [tc]
|
||||||
input_list += [tool_call]
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
assert tool_call is not None, (
|
||||||
|
"Expected model to call 'get_weather' function, "
|
||||||
|
f"but got: {list(final_tool_calls_named.keys())}"
|
||||||
|
)
|
||||||
assert result is not None
|
assert result is not None
|
||||||
response = await client.responses.create(
|
response = await client.responses.create(
|
||||||
model=model_name,
|
model=model_name,
|
||||||
|
|||||||
Reference in New Issue
Block a user