(calls: t.List[MockRequestCall])
| 763 | |
| 764 | |
| 765 | def _assert_tool_runner_calls(calls: t.List[MockRequestCall]) -> None: |
| 766 | assert len(calls) == 2 |
| 767 | for call in calls: |
| 768 | assert call.request.url.path == "/model/anthropic.claude-haiku-4-5-20251001-v1:0/invoke" |
| 769 | assert call.request.headers["Authorization"].startswith("AWS4-HMAC-SHA256 ") |
| 770 | assert "x-amz-date" in call.request.headers |
| 771 | assert "anthropic-version" not in call.request.headers |
| 772 | body = json.loads(call.request.content) |
| 773 | assert "model" not in body and "stream" not in body and "output_format" not in body |
| 774 | assert body["anthropic_version"] == ANTHROPIC_API_VERSION |
| 775 | second = json.loads(calls[1].request.content) |
| 776 | assert [m["role"] for m in second["messages"]] == ["user", "assistant", "user"] |
| 777 | assert second["messages"][1]["content"][0]["type"] == "tool_use" |
| 778 | assert second["messages"][2]["content"][0] == { |
| 779 | "type": "tool_result", |
| 780 | "tool_use_id": "toolu_01", |
| 781 | "content": "sunny in Paris", |
| 782 | } |
| 783 | |
| 784 | |
| 785 | @pytest.mark.skipif(PYDANTIC_V1, reason="tool functions are only supported with pydantic v2") |
no outgoing calls
no test coverage detected