Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit 4dbe9a8

Browse files
committed
cassettes
1 parent 7c1b042 commit 4dbe9a8

5 files changed

Lines changed: 642 additions & 1 deletion

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,13 @@ def _before_record_request(request: Any) -> Any:
241241

242242
@pytest.fixture(scope="module")
243243
def vcr_config():
244+
record_mode = os.getenv("RECORD_MODE", "none")
244245
return {
245246
"filter_headers": ["authorization", "x-token"],
246247
"allowed_hosts": ["testserver", "127.0.0.1"],
247248
"before_record_response": _redact_xtoken_response,
248249
"before_record_request": _before_record_request,
249250
"ignore_localhost": True,
250-
"record_mode": "none",
251+
"record_mode": record_mode,
251252
"decode_compressed_response": True,
252253
}
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "How much is 3 + 5?"}], "llm_providers":
4+
[{"provider": "anthropic", "model": "claude-opus-4-1", "is_custom": false, "context_length":
5+
null, "input_price": null, "output_price": null, "latency": null}], "metric":
6+
"accuracy", "max_model_depth": 1, "hash_content": true, "tools": [{"type": "function",
7+
"function": {"name": "add_fct", "description": "Add two numbers", "parameters":
8+
{"type": "object", "properties": {"a": {"type": "integer", "description": "The
9+
first number"}, "b": {"type": "integer", "description": "The second number"}},
10+
"required": ["a", "b"]}}}]}'
11+
headers:
12+
Accept:
13+
- '*/*'
14+
Accept-Encoding:
15+
- gzip, deflate, zstd
16+
Connection:
17+
- keep-alive
18+
Content-Length:
19+
- '606'
20+
User-Agent:
21+
- Python-SDK/0.4.4
22+
content-type:
23+
- application/json
24+
method: POST
25+
uri: https://api.notdiamond.ai/v2/modelRouter/modelSelect
26+
response:
27+
body:
28+
string: '{"detail":"Could not find valid API key"}'
29+
headers:
30+
CF-RAY:
31+
- 96fc5de6cf7ce00f-MIA
32+
Connection:
33+
- keep-alive
34+
Content-Type:
35+
- application/json
36+
Date:
37+
- Fri, 15 Aug 2025 23:10:41 GMT
38+
Server:
39+
- cloudflare
40+
Transfer-Encoding:
41+
- chunked
42+
alt-svc:
43+
- h3=":443"; ma=86400
44+
cf-cache-status:
45+
- DYNAMIC
46+
rndr-id:
47+
- dff267e2-2fc0-48c5
48+
vary:
49+
- Accept-Encoding
50+
x-render-origin-server:
51+
- uvicorn
52+
x-request-id:
53+
- dff267e2-2fc0-48c5
54+
status:
55+
code: 401
56+
message: Unauthorized
57+
- request:
58+
body: '{"max_tokens":200,"messages":[{"role":"user","content":"How much is 3 +
59+
5?"}],"model":"claude-opus-4-1","tools":[{"name":"add_fct","description":"Add
60+
two numbers","input_schema":{"type":"object","properties":{"a":{"type":"integer","description":"The
61+
first number"},"b":{"type":"integer","description":"The second number"}},"required":["a","b"]}}]}'
62+
headers:
63+
accept:
64+
- application/json
65+
accept-encoding:
66+
- gzip, deflate, zstd
67+
anthropic-version:
68+
- '2023-06-01'
69+
connection:
70+
- keep-alive
71+
content-length:
72+
- '347'
73+
content-type:
74+
- application/json
75+
host:
76+
- api.anthropic.com
77+
user-agent:
78+
- Anthropic/Python 0.49.0
79+
x-api-key:
80+
- REDACTED
81+
x-stainless-arch:
82+
- arm64
83+
x-stainless-async:
84+
- 'false'
85+
x-stainless-lang:
86+
- python
87+
x-stainless-os:
88+
- MacOS
89+
x-stainless-package-version:
90+
- 0.49.0
91+
x-stainless-read-timeout:
92+
- '120.0'
93+
x-stainless-retry-count:
94+
- '0'
95+
x-stainless-runtime:
96+
- CPython
97+
x-stainless-runtime-version:
98+
- 3.12.6
99+
x-stainless-timeout:
100+
- NOT_GIVEN
101+
method: POST
102+
uri: https://api.anthropic.com/v1/messages
103+
response:
104+
body:
105+
string: '{"id":"msg_01MLNm6MvsAe345rsrZLmQ6R","type":"message","role":"assistant","model":"claude-opus-4-1-20250805","content":[{"type":"text","text":"I''ll
106+
help you add those two numbers together."},{"type":"tool_use","id":"toolu_01FnzqgbR95M2QVVRcGmxnCz","name":"add_fct","input":{"a":3,"b":5}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":411,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":82,"service_tier":"standard"}}'
107+
headers:
108+
CF-RAY:
109+
- 96fc5de81b7aed33-MIA
110+
Connection:
111+
- keep-alive
112+
Content-Type:
113+
- application/json
114+
Date:
115+
- Fri, 15 Aug 2025 23:10:44 GMT
116+
Server:
117+
- cloudflare
118+
Transfer-Encoding:
119+
- chunked
120+
X-Robots-Tag:
121+
- none
122+
anthropic-organization-id:
123+
- a2610b2c-742e-455d-9552-6abe105b2a44
124+
anthropic-ratelimit-input-tokens-limit:
125+
- '2000000'
126+
anthropic-ratelimit-input-tokens-remaining:
127+
- '2000000'
128+
anthropic-ratelimit-input-tokens-reset:
129+
- '2025-08-15T23:10:42Z'
130+
anthropic-ratelimit-output-tokens-limit:
131+
- '400000'
132+
anthropic-ratelimit-output-tokens-remaining:
133+
- '400000'
134+
anthropic-ratelimit-output-tokens-reset:
135+
- '2025-08-15T23:10:44Z'
136+
anthropic-ratelimit-requests-limit:
137+
- '4000'
138+
anthropic-ratelimit-requests-remaining:
139+
- '3999'
140+
anthropic-ratelimit-requests-reset:
141+
- '2025-08-15T23:10:42Z'
142+
anthropic-ratelimit-tokens-limit:
143+
- '2400000'
144+
anthropic-ratelimit-tokens-remaining:
145+
- '2400000'
146+
anthropic-ratelimit-tokens-reset:
147+
- '2025-08-15T23:10:42Z'
148+
cf-cache-status:
149+
- DYNAMIC
150+
content-length:
151+
- '547'
152+
request-id:
153+
- req_011CSALfjb98PLc3UXmaXYxf
154+
strict-transport-security:
155+
- max-age=31536000; includeSubDomains; preload
156+
via:
157+
- 1.1 google
158+
status:
159+
code: 200
160+
message: OK
161+
version: 1
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "How much is 3 + 5?"}], "llm_providers":
4+
[{"provider": "anthropic", "model": "claude-opus-4-1", "is_custom": false, "context_length":
5+
null, "input_price": null, "output_price": null, "latency": null}], "metric":
6+
"accuracy", "max_model_depth": 1, "hash_content": true, "tools": [{"type": "function",
7+
"function": {"name": "add_fct", "description": "Adds a and b.", "parameters":
8+
{"properties": {"a": {"type": "integer"}, "b": {"type": "integer"}}, "required":
9+
["a", "b"], "type": "object"}}}]}'
10+
headers:
11+
Accept:
12+
- '*/*'
13+
Accept-Encoding:
14+
- gzip, deflate, zstd
15+
Connection:
16+
- keep-alive
17+
Content-Length:
18+
- '533'
19+
User-Agent:
20+
- Python-SDK/0.4.4
21+
content-type:
22+
- application/json
23+
method: POST
24+
uri: https://api.notdiamond.ai/v2/modelRouter/modelSelect
25+
response:
26+
body:
27+
string: '{"detail":"Could not find valid API key"}'
28+
headers:
29+
CF-RAY:
30+
- 96fc5dd1d9ad60cd-MIA
31+
Connection:
32+
- keep-alive
33+
Content-Type:
34+
- application/json
35+
Date:
36+
- Fri, 15 Aug 2025 23:10:38 GMT
37+
Server:
38+
- cloudflare
39+
Transfer-Encoding:
40+
- chunked
41+
alt-svc:
42+
- h3=":443"; ma=86400
43+
cf-cache-status:
44+
- DYNAMIC
45+
rndr-id:
46+
- 265e0147-c3b8-41fd
47+
vary:
48+
- Accept-Encoding
49+
x-render-origin-server:
50+
- uvicorn
51+
x-request-id:
52+
- 265e0147-c3b8-41fd
53+
status:
54+
code: 401
55+
message: Unauthorized
56+
- request:
57+
body: '{"max_tokens":200,"messages":[{"role":"user","content":"How much is 3 +
58+
5?"}],"model":"claude-opus-4-1","tools":[{"name":"add_fct","description":"Adds
59+
a and b.","input_schema":{"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"],"type":"object"}}]}'
60+
headers:
61+
accept:
62+
- application/json
63+
accept-encoding:
64+
- gzip, deflate, zstd
65+
anthropic-version:
66+
- '2023-06-01'
67+
connection:
68+
- keep-alive
69+
content-length:
70+
- '278'
71+
content-type:
72+
- application/json
73+
host:
74+
- api.anthropic.com
75+
user-agent:
76+
- Anthropic/Python 0.49.0
77+
x-api-key:
78+
- REDACTED
79+
x-stainless-arch:
80+
- arm64
81+
x-stainless-async:
82+
- 'false'
83+
x-stainless-lang:
84+
- python
85+
x-stainless-os:
86+
- MacOS
87+
x-stainless-package-version:
88+
- 0.49.0
89+
x-stainless-read-timeout:
90+
- '120.0'
91+
x-stainless-retry-count:
92+
- '0'
93+
x-stainless-runtime:
94+
- CPython
95+
x-stainless-runtime-version:
96+
- 3.12.6
97+
x-stainless-timeout:
98+
- NOT_GIVEN
99+
method: POST
100+
uri: https://api.anthropic.com/v1/messages
101+
response:
102+
body:
103+
string: '{"id":"msg_0133SDbGjFCZcZKzV5zCzFRq","type":"message","role":"assistant","model":"claude-opus-4-1-20250805","content":[{"type":"text","text":"I''ll
104+
help you calculate 3 + 5."},{"type":"tool_use","id":"toolu_015mZkB9inqV2zD948zr8j3M","name":"add_fct","input":{"a":3,"b":5}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":397,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":84,"service_tier":"standard"}}'
105+
headers:
106+
CF-RAY:
107+
- 96fc5dd329d3fb94-MIA
108+
Connection:
109+
- keep-alive
110+
Content-Type:
111+
- application/json
112+
Date:
113+
- Fri, 15 Aug 2025 23:10:41 GMT
114+
Server:
115+
- cloudflare
116+
Transfer-Encoding:
117+
- chunked
118+
X-Robots-Tag:
119+
- none
120+
anthropic-organization-id:
121+
- a2610b2c-742e-455d-9552-6abe105b2a44
122+
anthropic-ratelimit-input-tokens-limit:
123+
- '2000000'
124+
anthropic-ratelimit-input-tokens-remaining:
125+
- '2000000'
126+
anthropic-ratelimit-input-tokens-reset:
127+
- '2025-08-15T23:10:40Z'
128+
anthropic-ratelimit-output-tokens-limit:
129+
- '400000'
130+
anthropic-ratelimit-output-tokens-remaining:
131+
- '400000'
132+
anthropic-ratelimit-output-tokens-reset:
133+
- '2025-08-15T23:10:41Z'
134+
anthropic-ratelimit-requests-limit:
135+
- '4000'
136+
anthropic-ratelimit-requests-remaining:
137+
- '3999'
138+
anthropic-ratelimit-requests-reset:
139+
- '2025-08-15T23:10:38Z'
140+
anthropic-ratelimit-tokens-limit:
141+
- '2400000'
142+
anthropic-ratelimit-tokens-remaining:
143+
- '2400000'
144+
anthropic-ratelimit-tokens-reset:
145+
- '2025-08-15T23:10:40Z'
146+
cf-cache-status:
147+
- DYNAMIC
148+
content-length:
149+
- '532'
150+
request-id:
151+
- req_011CSALfVEwKFmA1imtoyW95
152+
strict-transport-security:
153+
- max-age=31536000; includeSubDomains; preload
154+
via:
155+
- 1.1 google
156+
status:
157+
code: 200
158+
message: OK
159+
version: 1

0 commit comments

Comments
 (0)