Skip to content

Commit 27b370c

Browse files
authored
chore(llmobs): more openai cassettes (#222)
* tool cass * responses p cache * streaming * rel note
1 parent 307d87f commit 27b370c

7 files changed

+1267
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
other:
3+
- |
4+
Add OpenAI vcr cassettes for responses api prompt caching, responses api streaming prompt caching, and chat completions with tool calls.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "\n David Nguyen is a sophomore
4+
majoring in computer science at Stanford University and has a GPA of 3.8.\n David
5+
is an active member of the university''s Chess Club and the South Asian Student
6+
Association.\n He hopes to pursue a career in software engineering after
7+
graduating.\n "}], "model": "gpt-3.5-turbo", "tools": [{"type": "function",
8+
"function": {"name": "extract_student_info", "description": "Get the student
9+
information from the body of the input text", "parameters": {"type": "object",
10+
"properties": {"name": {"type": "string", "description": "Name of the person"},
11+
"major": {"type": "string", "description": "Major subject."}, "school": {"type":
12+
"string", "description": "The university name."}, "grades": {"type": "integer",
13+
"description": "GPA of the student."}, "clubs": {"type": "array", "description":
14+
"School clubs for extracurricular activities. ", "items": {"type": "string",
15+
"description": "Name of School Club"}}}}}}], "user": "ddtrace-test"}'
16+
headers:
17+
? !!python/object/new:multidict._multidict.istr
18+
- Accept
19+
: - application/json
20+
? !!python/object/new:multidict._multidict.istr
21+
- Accept-Encoding
22+
: - gzip, deflate
23+
? !!python/object/new:multidict._multidict.istr
24+
- Connection
25+
: - keep-alive
26+
Content-Length:
27+
- '1019'
28+
? !!python/object/new:multidict._multidict.istr
29+
- Content-Type
30+
: - application/json
31+
? !!python/object/new:multidict._multidict.istr
32+
- User-Agent
33+
: - OpenAI/Python 1.30.1
34+
X-Stainless-Arch:
35+
- arm64
36+
X-Stainless-Async:
37+
- 'false'
38+
X-Stainless-Lang:
39+
- python
40+
X-Stainless-OS:
41+
- MacOS
42+
X-Stainless-Package-Version:
43+
- 1.30.1
44+
X-Stainless-Runtime:
45+
- CPython
46+
X-Stainless-Runtime-Version:
47+
- 3.10.13
48+
method: POST
49+
uri: https://api.openai.com/v1/chat/completions
50+
response:
51+
body:
52+
string: "{\n \"id\": \"chatcmpl-BoxWCjmDlewUb2qBJa9OZuE7LzBAr\",\n \"object\":
53+
\"chat.completion\",\n \"created\": 1751484888,\n \"model\": \"gpt-3.5-turbo-0125\",\n
54+
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
55+
\"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n
56+
\ \"id\": \"call_AX6wGDrtP0zqy2121BVX6bcy\",\n \"type\":
57+
\"function\",\n \"function\": {\n \"name\": \"extract_student_info\",\n
58+
\ \"arguments\": \"{\\\"name\\\":\\\"David Nguyen\\\",\\\"major\\\":\\\"Computer
59+
Science\\\",\\\"school\\\":\\\"Stanford University\\\",\\\"grades\\\":3.8,\\\"clubs\\\":[\\\"Chess
60+
Club\\\",\\\"South Asian Student Association\\\"]}\"\n }\n }\n
61+
\ ],\n \"refusal\": null,\n \"annotations\": []\n },\n
62+
\ \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n
63+
\ ],\n \"usage\": {\n \"prompt_tokens\": 166,\n \"completion_tokens\":
64+
43,\n \"total_tokens\": 209,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
65+
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
66+
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
67+
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
68+
\"default\",\n \"system_fingerprint\": null\n}\n"
69+
headers:
70+
CF-RAY:
71+
- 959095254900ddb6-EWR
72+
Connection:
73+
- keep-alive
74+
Content-Encoding:
75+
- gzip
76+
Content-Type:
77+
- application/json
78+
Date:
79+
- Wed, 02 Jul 2025 19:34:49 GMT
80+
Server:
81+
- cloudflare
82+
Set-Cookie:
83+
- __cf_bm=kGWIveGgZM9P_vDdNSqWJ5z38dtLy8ODIcgnfNitcjA-1751484889-1.0.1.1-I_8mYv9YvKimJio4OJe9tZxFIa75uuZckI5URNB0orGrf8ni5EnwOTOCnHs_KXc9Hn4q9mLW9GKlHDTajBSM4RgZHsY_m20CwA1jHDShN6c;
84+
path=/; expires=Wed, 02-Jul-25 20:04:49 GMT; domain=.api.openai.com; HttpOnly;
85+
Secure; SameSite=None
86+
- _cfuvid=hWEbYpUUTKwG6DnSAFyZOeq1jvddTjufJcE.uOuYHh4-1751484889167-0.0.1.1-604800000;
87+
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
88+
Transfer-Encoding:
89+
- chunked
90+
X-Content-Type-Options:
91+
- nosniff
92+
access-control-expose-headers:
93+
- X-Request-ID
94+
alt-svc:
95+
- h3=":443"; ma=86400
96+
cf-cache-status:
97+
- DYNAMIC
98+
openai-organization:
99+
- datadog-staging
100+
openai-processing-ms:
101+
- '1026'
102+
openai-version:
103+
- '2020-10-01'
104+
strict-transport-security:
105+
- max-age=31536000; includeSubDomains; preload
106+
x-envoy-upstream-service-time:
107+
- '1031'
108+
x-ratelimit-limit-requests:
109+
- '10000'
110+
x-ratelimit-limit-tokens:
111+
- '50000000'
112+
x-ratelimit-remaining-requests:
113+
- '9999'
114+
x-ratelimit-remaining-tokens:
115+
- '49999925'
116+
x-ratelimit-reset-requests:
117+
- 6ms
118+
x-ratelimit-reset-tokens:
119+
- 0s
120+
x-request-id:
121+
- req_28132c14abf430b2a760d62b7d93d08f
122+
status:
123+
code: 200
124+
message: OK
125+
version: 1
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "\n David Nguyen is a sophomore
4+
majoring in computer science at Stanford University and has a GPA of 3.8.\n David
5+
is an active member of the university''s Chess Club and the South Asian Student
6+
Association.\n He hopes to pursue a career in software engineering after
7+
graduating.\n "}, {"content": null, "role": "assistant", "tool_calls": [{"id":
8+
"call_AX6wGDrtP0zqy2121BVX6bcy", "function": {"arguments": "{\"name\":\"David
9+
Nguyen\",\"major\":\"Computer Science\",\"school\":\"Stanford University\",\"grades\":3.8,\"clubs\":[\"Chess
10+
Club\",\"South Asian Student Association\"]}", "name": "extract_student_info"},
11+
"type": "function"}], "refusal": null, "annotations": []}, {"role": "tool",
12+
"tool_call_id": "call_AX6wGDrtP0zqy2121BVX6bcy", "content": "{\"status\": \"success\",
13+
\"gpa_verified\": true}"}, {"role": "user", "content": "Can you summarize the
14+
student''s academic performance?"}], "model": "gpt-3.5-turbo", "user": "ddtrace-test"}'
15+
headers:
16+
? !!python/object/new:multidict._multidict.istr
17+
- Accept
18+
: - application/json
19+
? !!python/object/new:multidict._multidict.istr
20+
- Accept-Encoding
21+
: - gzip, deflate
22+
? !!python/object/new:multidict._multidict.istr
23+
- Connection
24+
: - keep-alive
25+
Content-Length:
26+
- '992'
27+
? !!python/object/new:multidict._multidict.istr
28+
- Content-Type
29+
: - application/json
30+
? !!python/object/new:multidict._multidict.istr
31+
- User-Agent
32+
: - OpenAI/Python 1.30.1
33+
X-Stainless-Arch:
34+
- arm64
35+
X-Stainless-Async:
36+
- 'false'
37+
X-Stainless-Lang:
38+
- python
39+
X-Stainless-OS:
40+
- MacOS
41+
X-Stainless-Package-Version:
42+
- 1.30.1
43+
X-Stainless-Runtime:
44+
- CPython
45+
X-Stainless-Runtime-Version:
46+
- 3.10.13
47+
method: POST
48+
uri: https://api.openai.com/v1/chat/completions
49+
response:
50+
body:
51+
string: "{\n \"id\": \"chatcmpl-BoxWD0ajewy6femdEtwz9k3rCpmbE\",\n \"object\":
52+
\"chat.completion\",\n \"created\": 1751484889,\n \"model\": \"gpt-3.5-turbo-0125\",\n
53+
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
54+
\"assistant\",\n \"content\": \"David Nguyen is a sophomore majoring
55+
in computer science at Stanford University with a GPA of 3.8. His academic
56+
performance is strong, as evidenced by his high GPA.\",\n \"refusal\":
57+
null,\n \"annotations\": []\n },\n \"logprobs\": null,\n
58+
\ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\":
59+
143,\n \"completion_tokens\": 35,\n \"total_tokens\": 178,\n \"prompt_tokens_details\":
60+
{\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
61+
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
62+
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
63+
\"default\",\n \"system_fingerprint\": null\n}\n"
64+
headers:
65+
CF-RAY:
66+
- 9590952ddd76c334-EWR
67+
Connection:
68+
- keep-alive
69+
Content-Encoding:
70+
- gzip
71+
Content-Type:
72+
- application/json
73+
Date:
74+
- Wed, 02 Jul 2025 19:34:50 GMT
75+
Server:
76+
- cloudflare
77+
Set-Cookie:
78+
- __cf_bm=ytzEsH70J0tSvkp4stk_fG2NWZT7wt56JAhIXQxtG5g-1751484890-1.0.1.1-hb54NfpffKwBQDIUgJOc2Vs24m5YmNAS58EM2Pqb9vQLBlcZV1g15MHZ7O9bjIsZ.j86GORgRfpw_7wCZ5EHSNzcRFQ_4FUEz.3U.flHZeU;
79+
path=/; expires=Wed, 02-Jul-25 20:04:50 GMT; domain=.api.openai.com; HttpOnly;
80+
Secure; SameSite=None
81+
- _cfuvid=7OpYHk1nJHX06MABamUF41kHoRjv_SS2K6Dejjb5UhA-1751484890499-0.0.1.1-604800000;
82+
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
83+
Transfer-Encoding:
84+
- chunked
85+
X-Content-Type-Options:
86+
- nosniff
87+
access-control-expose-headers:
88+
- X-Request-ID
89+
alt-svc:
90+
- h3=":443"; ma=86400
91+
cf-cache-status:
92+
- DYNAMIC
93+
openai-organization:
94+
- datadog-staging
95+
openai-processing-ms:
96+
- '1101'
97+
openai-version:
98+
- '2020-10-01'
99+
strict-transport-security:
100+
- max-age=31536000; includeSubDomains; preload
101+
x-envoy-upstream-service-time:
102+
- '1109'
103+
x-ratelimit-limit-requests:
104+
- '10000'
105+
x-ratelimit-limit-tokens:
106+
- '50000000'
107+
x-ratelimit-remaining-requests:
108+
- '9999'
109+
x-ratelimit-remaining-tokens:
110+
- '49999898'
111+
x-ratelimit-reset-requests:
112+
- 6ms
113+
x-ratelimit-reset-tokens:
114+
- 0s
115+
x-request-id:
116+
- req_7fb2f30536f49fe22d3cb88562f91a37
117+
status:
118+
code: 200
119+
message: OK
120+
version: 1

0 commit comments

Comments
 (0)