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

Commit a2bb206

Browse files
committed
feat: Add new test cassettes for OpenAI model interactions
- Introduced multiple test cassettes for the gpt-4o-2024-11-20 model, covering various scenarios including streaming, tool calling, and response validation. - Enhanced test coverage for asynchronous streaming and tool integration with detailed request and response structures. - Ensured consistency in API interactions across different test cases.
1 parent 0388ab0 commit a2bb206

6 files changed

Lines changed: 2787 additions & 0 deletions

tests/test_llm_calls/cassettes/test_openai/Test_OpenAI.test_async_streaming[provider21].yaml

Lines changed: 1022 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "Tell me a joke"}], "llm_providers":
4+
[{"provider": "openai", "model": "gpt-4o-2024-11-20", "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}'
7+
headers:
8+
Accept:
9+
- '*/*'
10+
Accept-Encoding:
11+
- gzip, deflate, zstd
12+
Connection:
13+
- keep-alive
14+
Content-Length:
15+
- '304'
16+
User-Agent:
17+
- Python-SDK/0.4.5
18+
content-type:
19+
- application/json
20+
method: POST
21+
uri: https://staging-api.notdiamond.ai/v2/modelRouter/modelSelect
22+
response:
23+
body:
24+
string: '{"providers":[{"provider":"openai","model":"gpt-4o-2024-11-20"}],"session_id":"b71e9207-67a1-4004-bc22-88e1fcf60397"}'
25+
headers:
26+
CF-RAY:
27+
- 981a666b894eeee5-OTP
28+
Connection:
29+
- keep-alive
30+
Content-Type:
31+
- application/json
32+
Date:
33+
- Fri, 19 Sep 2025 16:18:39 GMT
34+
Server:
35+
- cloudflare
36+
Transfer-Encoding:
37+
- chunked
38+
alt-svc:
39+
- h3=":443"; ma=86400
40+
cf-cache-status:
41+
- DYNAMIC
42+
content-length:
43+
- '117'
44+
rndr-id:
45+
- bd78ff32-4a04-48be
46+
vary:
47+
- Accept-Encoding
48+
x-render-origin-server:
49+
- uvicorn
50+
x-request-id:
51+
- bd78ff32-4a04-48be
52+
status:
53+
code: 200
54+
message: OK
55+
- request:
56+
body: '{"messages":[{"content":"The output should be formatted as a JSON instance
57+
that conforms to the JSON schema below.\n\nAs an example, for the schema {\"properties\":
58+
{\"foo\": {\"title\": \"Foo\", \"description\": \"a list of strings\", \"type\":
59+
\"array\", \"items\": {\"type\": \"string\"}}}, \"required\": [\"foo\"]}\nthe
60+
object {\"foo\": [\"bar\", \"baz\"]} is a well-formatted instance of the schema.
61+
The object {\"properties\": {\"foo\": [\"bar\", \"baz\"]}} is not well-formatted.\n\nHere
62+
is the output schema:\n```\n{\"properties\": {\"setup\": {\"description\": \"question
63+
to set up a joke\", \"title\": \"Setup\", \"type\": \"string\"}, \"punchline\":
64+
{\"description\": \"answer to resolve the joke\", \"title\": \"Punchline\",
65+
\"type\": \"string\"}}, \"required\": [\"setup\", \"punchline\"]}\n```\nTell
66+
me a joke","role":"user"}],"model":"gpt-4o-2024-11-20","max_completion_tokens":200,"stream":false}'
67+
headers:
68+
accept:
69+
- application/json
70+
accept-encoding:
71+
- gzip, deflate, zstd
72+
connection:
73+
- keep-alive
74+
content-length:
75+
- '912'
76+
content-type:
77+
- application/json
78+
host:
79+
- api.openai.com
80+
user-agent:
81+
- OpenAI/Python 1.99.9
82+
x-stainless-arch:
83+
- arm64
84+
x-stainless-async:
85+
- 'false'
86+
x-stainless-lang:
87+
- python
88+
x-stainless-os:
89+
- MacOS
90+
x-stainless-package-version:
91+
- 1.99.9
92+
x-stainless-read-timeout:
93+
- '120.0'
94+
x-stainless-retry-count:
95+
- '0'
96+
x-stainless-runtime:
97+
- CPython
98+
x-stainless-runtime-version:
99+
- 3.11.12
100+
method: POST
101+
uri: https://api.openai.com/v1/chat/completions
102+
response:
103+
body:
104+
string: "{\n \"id\": \"chatcmpl-CHY6hWOi2w6AHzBTxm4UGGyzMVf3p\",\n \"object\":
105+
\"chat.completion\",\n \"created\": 1758298719,\n \"model\": \"gpt-4o-2024-11-20\",\n
106+
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
107+
\"assistant\",\n \"content\": \"```json\\n{\\n \\\"setup\\\": \\\"Why
108+
don't skeletons fight each other?\\\",\\n \\\"punchline\\\": \\\"Because
109+
they don't have the guts!\\\"\\n}\\n```\",\n \"refusal\": null,\n \"annotations\":
110+
[]\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n
111+
\ }\n ],\n \"usage\": {\n \"prompt_tokens\": 200,\n \"completion_tokens\":
112+
33,\n \"total_tokens\": 233,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
113+
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
114+
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
115+
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
116+
\"default\",\n \"system_fingerprint\": \"fp_561b2577db\"\n}\n"
117+
headers:
118+
CF-RAY:
119+
- 981a66745b9b6af8-OTP
120+
Connection:
121+
- keep-alive
122+
Content-Type:
123+
- application/json
124+
Date:
125+
- Fri, 19 Sep 2025 16:18:40 GMT
126+
Server:
127+
- cloudflare
128+
Set-Cookie:
129+
- __cf_bm=uYfxgdqoC180lMNZXNjLPS_3gi.EHo.a2JasETW3bAM-1758298720-1.0.1.1-QRlP.iA1ApN65HevWF7_VcZz9vuhpjozkxXcPmfUoxc53PoTnXFxSxLbBoQwMhT3QQh5O9TzHWsXwFNKbQ5UzmuawYcZVYDl1yRuHAtAGBY;
130+
path=/; expires=Fri, 19-Sep-25 16:48:40 GMT; domain=.api.openai.com; HttpOnly;
131+
Secure; SameSite=None
132+
- _cfuvid=SsSyRRrlMGl7SKR2IHxeWJF0H.tVYnSLMH173nmDCFY-1758298720035-0.0.1.1-604800000;
133+
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
134+
Strict-Transport-Security:
135+
- max-age=31536000; includeSubDomains; preload
136+
Transfer-Encoding:
137+
- chunked
138+
X-Content-Type-Options:
139+
- nosniff
140+
access-control-expose-headers:
141+
- X-Request-ID
142+
alt-svc:
143+
- h3=":443"; ma=86400
144+
cf-cache-status:
145+
- DYNAMIC
146+
content-length:
147+
- '935'
148+
openai-organization:
149+
- not-diamond-bdz8cg
150+
openai-processing-ms:
151+
- '457'
152+
openai-project:
153+
- proj_EvMLZJqcggqzjvd3BFXe4tfP
154+
openai-version:
155+
- '2020-10-01'
156+
x-envoy-upstream-service-time:
157+
- '470'
158+
x-openai-proxy-wasm:
159+
- v0.1
160+
x-ratelimit-limit-requests:
161+
- '10000'
162+
x-ratelimit-limit-tokens:
163+
- '30000000'
164+
x-ratelimit-remaining-requests:
165+
- '9999'
166+
x-ratelimit-remaining-tokens:
167+
- '29999818'
168+
x-ratelimit-reset-requests:
169+
- 6ms
170+
x-ratelimit-reset-tokens:
171+
- 0s
172+
x-request-id:
173+
- req_b13629042809448e98ded097d4702e5d
174+
status:
175+
code: 200
176+
message: OK
177+
version: 1

0 commit comments

Comments
 (0)