Skip to content

Commit d4b4b67

Browse files
authored
chore(vcr): add cassettes for vercel-ai node.js tests (#219)
* vercel ai cassettes * add more cassettes * rel note
1 parent 6ab73f7 commit d4b4b67

11 files changed

+2293
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
Support a vcr cassette for OpenAI from Vercel AI SDK requests.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
interactions:
2+
- request:
3+
body: '{"model":"gpt-3.5-turbo","temperature":0,"messages":[{"role":"system","content":"You
4+
are a helpful assistant"},{"role":"user","content":"What is the weather in Tokyo?"},{"role":"assistant","content":"","tool_calls":[{"id":"call_Y4wWHJPgTLFLGgIbilc3EqH4","type":"function","function":{"name":"0","arguments":"{\"location\":\"Tokyo\"}"}}]},{"role":"tool","tool_call_id":"call_Y4wWHJPgTLFLGgIbilc3EqH4","content":"\"It
5+
is nice and sunny in Tokyo.\""}],"tools":[{"type":"function","function":{"name":"0","description":"Get
6+
the weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}],"tool_choice":"auto","stream":true}'
7+
headers:
8+
? !!python/object/apply:multidict._multidict.istr
9+
- Accept
10+
: - '*/*'
11+
? !!python/object/apply:multidict._multidict.istr
12+
- Accept-Encoding
13+
: - gzip, deflate
14+
? !!python/object/apply:multidict._multidict.istr
15+
- Accept-Language
16+
: - '*'
17+
? !!python/object/apply:multidict._multidict.istr
18+
- Connection
19+
: - keep-alive
20+
Content-Length:
21+
- '770'
22+
? !!python/object/apply:multidict._multidict.istr
23+
- Content-Type
24+
: - application/json
25+
? !!python/object/apply:multidict._multidict.istr
26+
- User-Agent
27+
: - node
28+
? !!python/object/apply:multidict._multidict.istr
29+
- sec-fetch-mode
30+
: - cors
31+
method: POST
32+
uri: https://api.openai.com/v1/chat/completions
33+
response:
34+
body:
35+
string: 'data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]}
36+
37+
38+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"The"},"logprobs":null,"finish_reason":null}]}
39+
40+
41+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
42+
weather"},"logprobs":null,"finish_reason":null}]}
43+
44+
45+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
46+
in"},"logprobs":null,"finish_reason":null}]}
47+
48+
49+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
50+
Tokyo"},"logprobs":null,"finish_reason":null}]}
51+
52+
53+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
54+
is"},"logprobs":null,"finish_reason":null}]}
55+
56+
57+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
58+
nice"},"logprobs":null,"finish_reason":null}]}
59+
60+
61+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
62+
and"},"logprobs":null,"finish_reason":null}]}
63+
64+
65+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
66+
sunny"},"logprobs":null,"finish_reason":null}]}
67+
68+
69+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
70+
71+
72+
data: {"id":"chatcmpl-Bo9sGILXyfGpa8VDADlC9eDdx4eYG","object":"chat.completion.chunk","created":1751294056,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]}
73+
74+
75+
data: [DONE]
76+
77+
78+
'
79+
headers:
80+
CF-RAY:
81+
- 957e622c5d523919-IAD
82+
Connection:
83+
- keep-alive
84+
Content-Type:
85+
- text/event-stream; charset=utf-8
86+
Date:
87+
- Mon, 30 Jun 2025 14:34:16 GMT
88+
Server:
89+
- cloudflare
90+
Set-Cookie:
91+
- __cf_bm=Cc2.h6DVXsW1s.vDtCUhH6pEtQr.NrmMAkU7Ixr.D.Q-1751294056-1.0.1.1-rDKkRgDp6_X2iOBhjjpdMssiirMZvVT_rarqyOJn_yojv4ksfEvMdF0NRMhSdk6XIh.1Qw3UpzkJyo5AsjV08Mlm.KcnnJ6V6iTEqZ2_c.E;
92+
path=/; expires=Mon, 30-Jun-25 15:04:16 GMT; domain=.api.openai.com; HttpOnly;
93+
Secure; SameSite=None
94+
- _cfuvid=O2NIyIUhDlC9Viv1_qHf_j.A46SR.suveTGKwRGVa_s-1751294056674-0.0.1.1-604800000;
95+
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
96+
Transfer-Encoding:
97+
- chunked
98+
X-Content-Type-Options:
99+
- nosniff
100+
access-control-expose-headers:
101+
- X-Request-ID
102+
alt-svc:
103+
- h3=":443"; ma=86400
104+
cf-cache-status:
105+
- DYNAMIC
106+
openai-organization:
107+
- datadog-staging
108+
openai-processing-ms:
109+
- '224'
110+
openai-version:
111+
- '2020-10-01'
112+
strict-transport-security:
113+
- max-age=31536000; includeSubDomains; preload
114+
x-envoy-upstream-service-time:
115+
- '233'
116+
x-ratelimit-limit-requests:
117+
- '10000'
118+
x-ratelimit-limit-tokens:
119+
- '50000000'
120+
x-ratelimit-remaining-requests:
121+
- '9999'
122+
x-ratelimit-remaining-tokens:
123+
- '49999972'
124+
x-ratelimit-reset-requests:
125+
- 6ms
126+
x-ratelimit-reset-tokens:
127+
- 0s
128+
x-request-id:
129+
- req_d280cae15f50d6cc65280a737660d0c5
130+
status:
131+
code: 200
132+
message: OK
133+
version: 1
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
interactions:
2+
- request:
3+
body: '{"model":"gpt-3.5-turbo","max_tokens":100,"temperature":0.5,"messages":[{"role":"system","content":"You
4+
are a helpful assistant"},{"role":"user","content":"Hello, OpenAI!"}]}'
5+
headers:
6+
? !!python/object/apply:multidict._multidict.istr
7+
- Accept
8+
: - '*/*'
9+
? !!python/object/apply:multidict._multidict.istr
10+
- Accept-Encoding
11+
: - gzip, deflate
12+
? !!python/object/apply:multidict._multidict.istr
13+
- Accept-Language
14+
: - '*'
15+
? !!python/object/apply:multidict._multidict.istr
16+
- Connection
17+
: - keep-alive
18+
Content-Length:
19+
- '174'
20+
? !!python/object/apply:multidict._multidict.istr
21+
- Content-Type
22+
: - application/json
23+
? !!python/object/apply:multidict._multidict.istr
24+
- User-Agent
25+
: - node
26+
? !!python/object/apply:multidict._multidict.istr
27+
- sec-fetch-mode
28+
: - cors
29+
method: POST
30+
uri: https://api.openai.com/v1/chat/completions
31+
response:
32+
body:
33+
string: "{\n \"id\": \"chatcmpl-BmQAy5YZmY2VqBd67WEjAf7PL8pMR\",\n \"object\":
34+
\"chat.completion\",\n \"created\": 1750880064,\n \"model\": \"gpt-3.5-turbo-0125\",\n
35+
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
36+
\"assistant\",\n \"content\": \"Hello! How can I assist you today?\",\n
37+
\ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\":
38+
null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\":
39+
21,\n \"completion_tokens\": 9,\n \"total_tokens\": 30,\n \"prompt_tokens_details\":
40+
{\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
41+
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
42+
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
43+
\"default\",\n \"system_fingerprint\": null\n}\n"
44+
headers:
45+
CF-RAY:
46+
- 9556e6f3febe13fa-IAD
47+
Connection:
48+
- keep-alive
49+
Content-Encoding:
50+
- gzip
51+
Content-Type:
52+
- application/json
53+
Date:
54+
- Wed, 25 Jun 2025 19:34:25 GMT
55+
Server:
56+
- cloudflare
57+
Set-Cookie:
58+
- __cf_bm=PoMWCL_iwiPZatxbVmgOIHz_yEW8xd5hjuNvRD5rfWA-1750880065-1.0.1.1-itEymv55j7cHFlHe_6ERngKYZtdalXjWdESFrQddtIZlYxDyV0j87rJuuLz10AeGqlquF4cGNxEi_HwwSsyZPsk8khlDU1UTGA30xD.9Nf4;
59+
path=/; expires=Wed, 25-Jun-25 20:04:25 GMT; domain=.api.openai.com; HttpOnly;
60+
Secure; SameSite=None
61+
- _cfuvid=KBEZcQ1NQPGarw46tNOzt.KftcQpOXra9vHtamVWxXE-1750880065108-0.0.1.1-604800000;
62+
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
63+
Transfer-Encoding:
64+
- chunked
65+
X-Content-Type-Options:
66+
- nosniff
67+
access-control-expose-headers:
68+
- X-Request-ID
69+
alt-svc:
70+
- h3=":443"; ma=86400
71+
cf-cache-status:
72+
- DYNAMIC
73+
openai-organization:
74+
- datadog-staging
75+
openai-processing-ms:
76+
- '250'
77+
openai-version:
78+
- '2020-10-01'
79+
strict-transport-security:
80+
- max-age=31536000; includeSubDomains; preload
81+
x-envoy-upstream-service-time:
82+
- '259'
83+
x-ratelimit-limit-requests:
84+
- '10000'
85+
x-ratelimit-limit-tokens:
86+
- '50000000'
87+
x-ratelimit-remaining-requests:
88+
- '9999'
89+
x-ratelimit-remaining-tokens:
90+
- '49999985'
91+
x-ratelimit-reset-requests:
92+
- 6ms
93+
x-ratelimit-reset-tokens:
94+
- 0s
95+
x-request-id:
96+
- req_b5d28a41a22c127bf77ef18ffae70449
97+
status:
98+
code: 200
99+
message: OK
100+
version: 1
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
interactions:
2+
- request:
3+
body: '{"model":"gpt-3.5-turbo","temperature":0,"messages":[{"role":"system","content":"You
4+
are a helpful assistant"},{"role":"user","content":"What is the weather in Tokyo?"}],"tools":[{"type":"function","function":{"name":"0","description":"Get
5+
the weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}],"tool_choice":"auto","stream":true}'
6+
headers:
7+
? !!python/object/apply:multidict._multidict.istr
8+
- Accept
9+
: - '*/*'
10+
? !!python/object/apply:multidict._multidict.istr
11+
- Accept-Encoding
12+
: - gzip, deflate
13+
? !!python/object/apply:multidict._multidict.istr
14+
- Accept-Language
15+
: - '*'
16+
? !!python/object/apply:multidict._multidict.istr
17+
- Connection
18+
: - keep-alive
19+
Content-Length:
20+
- '491'
21+
? !!python/object/apply:multidict._multidict.istr
22+
- Content-Type
23+
: - application/json
24+
? !!python/object/apply:multidict._multidict.istr
25+
- User-Agent
26+
: - node
27+
? !!python/object/apply:multidict._multidict.istr
28+
- sec-fetch-mode
29+
: - cors
30+
method: POST
31+
uri: https://api.openai.com/v1/chat/completions
32+
response:
33+
body:
34+
string: 'data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_Y4wWHJPgTLFLGgIbilc3EqH4","type":"function","function":{"name":"0","arguments":""}}],"refusal":null},"logprobs":null,"finish_reason":null}]}
35+
36+
37+
data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"logprobs":null,"finish_reason":null}]}
38+
39+
40+
data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"location"}}]},"logprobs":null,"finish_reason":null}]}
41+
42+
43+
data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"logprobs":null,"finish_reason":null}]}
44+
45+
46+
data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Tok"}}]},"logprobs":null,"finish_reason":null}]}
47+
48+
49+
data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"yo"}}]},"logprobs":null,"finish_reason":null}]}
50+
51+
52+
data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"logprobs":null,"finish_reason":null}]}
53+
54+
55+
data: {"id":"chatcmpl-Bo9sFiJna3oDEDAIPhSEJg7AbxE6p","object":"chat.completion.chunk","created":1751294055,"model":"gpt-3.5-turbo-0125","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]}
56+
57+
58+
data: [DONE]
59+
60+
61+
'
62+
headers:
63+
CF-RAY:
64+
- 957e62253fa0207b-IAD
65+
Connection:
66+
- keep-alive
67+
Content-Type:
68+
- text/event-stream; charset=utf-8
69+
Date:
70+
- Mon, 30 Jun 2025 14:34:16 GMT
71+
Server:
72+
- cloudflare
73+
Set-Cookie:
74+
- __cf_bm=gAYC7f7cLo._O2PZpvDAic3MWlOMgTxjbtUwWnm4d24-1751294056-1.0.1.1-xqFfrbkKKgqeIWJli6lxW2709_HaOSGn95e5XutRvbY7mcImaTo36IMsbMe_n3KT3xCL_ow3IIcKlfoxaMXxFJg.X.2Gc3jc1ZfA.21qUQw;
75+
path=/; expires=Mon, 30-Jun-25 15:04:16 GMT; domain=.api.openai.com; HttpOnly;
76+
Secure; SameSite=None
77+
- _cfuvid=fpMnWqrQB0oLTYR3mn4i_p8evYB5EoFk2WAJZSiJPb0-1751294056196-0.0.1.1-604800000;
78+
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
79+
Transfer-Encoding:
80+
- chunked
81+
X-Content-Type-Options:
82+
- nosniff
83+
access-control-expose-headers:
84+
- X-Request-ID
85+
alt-svc:
86+
- h3=":443"; ma=86400
87+
cf-cache-status:
88+
- DYNAMIC
89+
openai-organization:
90+
- datadog-staging
91+
openai-processing-ms:
92+
- '285'
93+
openai-version:
94+
- '2020-10-01'
95+
strict-transport-security:
96+
- max-age=31536000; includeSubDomains; preload
97+
x-envoy-upstream-service-time:
98+
- '288'
99+
x-ratelimit-limit-requests:
100+
- '10000'
101+
x-ratelimit-limit-tokens:
102+
- '50000000'
103+
x-ratelimit-remaining-requests:
104+
- '9999'
105+
x-ratelimit-remaining-tokens:
106+
- '49999982'
107+
x-ratelimit-reset-requests:
108+
- 6ms
109+
x-ratelimit-reset-tokens:
110+
- 0s
111+
x-request-id:
112+
- req_8590c41106e2cd1e4a33549762ac7afc
113+
status:
114+
code: 200
115+
message: OK
116+
version: 1

0 commit comments

Comments
 (0)