MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / _assert_tool_runner_calls

Function _assert_tool_runner_calls

tests/lib/test_vertex.py:54–69  ·  view source on GitHub ↗
(calls: List[MockRequestCall])

Source from the content-addressed store, hash-verified

52
53
54def _assert_tool_runner_calls(calls: List[MockRequestCall]) -> None:
55 assert len(calls) == 2
56 for call in calls:
57 assert call.request.url == TOOL_RUNNER_URL
58 assert call.request.headers["Authorization"] == "Bearer my-access-token"
59 body = json.loads(call.request.content)
60 assert "model" not in body and "stream" not in body and "output_format" not in body
61 assert body["anthropic_version"] == "vertex-2023-10-16"
62 second = json.loads(calls[1].request.content)
63 assert [m["role"] for m in second["messages"]] == ["user", "assistant", "user"]
64 assert second["messages"][1]["content"][0]["type"] == "tool_use"
65 assert second["messages"][2]["content"][0] == {
66 "type": "tool_result",
67 "tool_use_id": "toolu_01",
68 "content": "sunny in Paris",
69 }
70
71
72class TestAnthropicVertex:

Calls

no outgoing calls

Tested by

no test coverage detected