2026-03-11 09:56:18 +08:00
|
|
|
from types import SimpleNamespace
|
|
|
|
|
|
|
|
|
|
from nanobot.providers.base import ToolCallRequest
|
|
|
|
|
|
|
|
|
|
|
2026-03-11 15:01:18 +08:00
|
|
|
def test_tool_call_request_serializes_provider_fields() -> None:
|
2026-03-11 09:56:18 +08:00
|
|
|
tool_call = ToolCallRequest(
|
|
|
|
|
id="abc123xyz",
|
|
|
|
|
name="read_file",
|
|
|
|
|
arguments={"path": "todo.md"},
|
|
|
|
|
provider_specific_fields={"thought_signature": "signed-token"},
|
|
|
|
|
function_provider_specific_fields={"inner": "value"},
|
|
|
|
|
)
|
|
|
|
|
|
2026-03-11 15:01:18 +08:00
|
|
|
message = tool_call.to_openai_tool_call()
|
2026-03-11 09:56:18 +08:00
|
|
|
|
2026-03-25 09:40:21 +09:00
|
|
|
assert message["extra_content"] == {"google": {"thought_signature": "signed-token"}}
|
2026-03-11 09:56:18 +08:00
|
|
|
assert message["function"]["provider_specific_fields"] == {"inner": "value"}
|
|
|
|
|
assert message["function"]["arguments"] == '{"path": "todo.md"}'
|