FIX:simple fix on tool calling test for anthropic (#6181)

Just simple change.

```python
messages: List[LLMMessage] = [UserMessage(content="Call the pass tool with input 'task'", source="user")]
```
to
```python
messages: List[LLMMessage] = [UserMessage(content="Call the pass tool with input 'task' and talk result", source="user")]
```

And, now.
Anthropic model could pass that test case
`test_model_client_with_function_calling`.
-> Yup. Before, claude could not pass that test case.

With this change, Claude (Anthropic) models are now able to pass the
test case successfully.

Before this fix, Claude failed to interpret the intent correctly. Now,
it can infer both tool usage and follow-up generation.

This change is backward-compatible with other models (e.g., GPT-4) and
improves cross-model consistency for function-calling tests.
This commit is contained in:
EeS 2025-04-03 08:10:11 +09:00 committed by GitHub
parent 27da37efc0
commit d7f2b56846
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -1644,7 +1644,9 @@ async def test_model_client_with_function_calling(model: str, openai_client: Ope
# Test tool calling
pass_tool = FunctionTool(_pass_function, name="pass_tool", description="pass session.")
fail_tool = FunctionTool(_fail_function, name="fail_tool", description="fail session.")
messages: List[LLMMessage] = [UserMessage(content="Call the pass tool with input 'task'", source="user")]
messages: List[LLMMessage] = [
UserMessage(content="Call the pass tool with input 'task' and talk result", source="user")
]
create_result = await openai_client.create(messages=messages, tools=[pass_tool, fail_tool])
assert isinstance(create_result.content, list)
assert len(create_result.content) == 1
@ -1675,7 +1677,8 @@ async def test_model_client_with_function_calling(model: str, openai_client: Ope
# Test parallel tool calling
messages = [
UserMessage(
content="Call both the pass tool with input 'task' and the fail tool also with input 'task'", source="user"
content="Call both the pass tool with input 'task' and the fail tool also with input 'task' and talk result",
source="user",
)
]
create_result = await openai_client.create(messages=messages, tools=[pass_tool, fail_tool])