Skip to content

Commit

Permalink
chore(py): cache openai call in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Mar 3, 2025
1 parent 6ba8136 commit a7fc8bf
Show file tree
Hide file tree
Showing 20 changed files with 3,686 additions and 229 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
interactions:
- request:
body: '{"messages": [{"role": "user", "content": "Say ''foo''"}], "model": "gpt-3.5-turbo",
"seed": 42, "stream": false, "temperature": 0}'
headers:
accept:
- application/json
accept-encoding:
- gzip, deflate, zstd
connection:
- keep-alive
content-length:
- '129'
content-type:
- application/json
host:
- api.openai.com
user-agent:
- AsyncOpenAI/Python 1.63.2
x-stainless-arch:
- arm64
x-stainless-async:
- async:asyncio
x-stainless-lang:
- python
x-stainless-os:
- MacOS
x-stainless-package-version:
- 1.63.2
x-stainless-read-timeout:
- '600'
x-stainless-retry-count:
- '0'
x-stainless-runtime:
- CPython
x-stainless-runtime-version:
- 3.11.3
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: "{\n \"id\": \"chatcmpl-B6ujqKpb9i7auMhILi2oH8K4nIuga\",\n \"object\":
\"chat.completion\",\n \"created\": 1740987770,\n \"model\": \"gpt-3.5-turbo-0125\",\n
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
\"assistant\",\n \"content\": \"foo\",\n \"refusal\": null\n
\ },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n
\ ],\n \"usage\": {\n \"prompt_tokens\": 11,\n \"completion_tokens\":
2,\n \"total_tokens\": 13,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
\"default\",\n \"system_fingerprint\": null\n}\n"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 91a77fda8b1a2b96-LAX
Connection:
- keep-alive
Content-Type:
- application/json
Date:
- Mon, 03 Mar 2025 07:42:50 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=o7Bu7r6mqtHc01n2y2ijLPpAPH41tfdpsKC5hMLqUSE-1740987770-1.0.1.1-qsRq7jbgROuyZcyCqWQDGBzszIBIAmu2gbFkOWEedwVxS2iX243PDpZDcf7oAKHz17BJUK8H9LiZ.AgbLKD5Q.iZ7BoProS.BHFJ3vIXJIk;
path=/; expires=Mon, 03-Mar-25 08:12:50 GMT; domain=.api.openai.com; HttpOnly;
Secure; SameSite=None
- _cfuvid=iEq9VgxbpLmn7cLFBbwvJg_zX1f8APJtBSDm8T6bUpg-1740987770314-0.0.1.1-604800000;
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
Transfer-Encoding:
- chunked
X-Content-Type-Options:
- nosniff
access-control-expose-headers:
- X-Request-ID
alt-svc:
- h3=":443"; ma=86400
content-length:
- '767'
openai-organization:
- langchain
openai-processing-ms:
- '252'
openai-version:
- '2020-10-01'
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-ratelimit-limit-requests:
- '10000'
x-ratelimit-limit-tokens:
- '50000000'
x-ratelimit-remaining-requests:
- '9999'
x-ratelimit-remaining-tokens:
- '49999980'
x-ratelimit-reset-requests:
- 6ms
x-ratelimit-reset-tokens:
- 0s
x-request-id:
- req_d0f3aefed7b3cdd2a8f2ea55520bede5
status:
code: 200
message: OK
- request:
body: '{"messages": [{"role": "user", "content": "Say ''foo''"}], "model": "gpt-3.5-turbo",
"seed": 42, "stream": false, "temperature": 0}'
headers:
accept:
- application/json
accept-encoding:
- gzip, deflate, zstd
connection:
- keep-alive
content-length:
- '129'
content-type:
- application/json
host:
- api.openai.com
user-agent:
- AsyncOpenAI/Python 1.63.2
x-stainless-arch:
- arm64
x-stainless-async:
- async:asyncio
x-stainless-lang:
- python
x-stainless-os:
- MacOS
x-stainless-package-version:
- 1.63.2
x-stainless-read-timeout:
- '600'
x-stainless-retry-count:
- '0'
x-stainless-runtime:
- CPython
x-stainless-runtime-version:
- 3.11.3
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: "{\n \"id\": \"chatcmpl-B6ujqrMi392FjgcBBB9PiPJ4jQYXu\",\n \"object\":
\"chat.completion\",\n \"created\": 1740987770,\n \"model\": \"gpt-3.5-turbo-0125\",\n
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
\"assistant\",\n \"content\": \"foo\",\n \"refusal\": null\n
\ },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n
\ ],\n \"usage\": {\n \"prompt_tokens\": 11,\n \"completion_tokens\":
2,\n \"total_tokens\": 13,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
\"default\",\n \"system_fingerprint\": null\n}\n"
headers:
CF-RAY:
- 91a77fddac950fc1-LAX
Connection:
- keep-alive
Content-Type:
- application/json
Date:
- Mon, 03 Mar 2025 07:42:50 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=kI9703F0UbNjuKjIUNTB3eAry53TxrI1CmO2j0pKNx0-1740987770-1.0.1.1-7MAc669qUljv265tl7_q0T0NPE.aLJ11x2J1e9KJ2NZt0Dts..vQXVOx.pvfAfuKfcX_5kjVC5EmXdUVCp.yf5MUcy0S2t_nPE6EUt9Qbls;
path=/; expires=Mon, 03-Mar-25 08:12:50 GMT; domain=.api.openai.com; HttpOnly;
Secure; SameSite=None
- _cfuvid=rw7UmmS8HbrM8U6BC0JRaPn281r8kKn.QDjeqJLF3xs-1740987770778-0.0.1.1-604800000;
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
Transfer-Encoding:
- chunked
X-Content-Type-Options:
- nosniff
access-control-expose-headers:
- X-Request-ID
alt-svc:
- h3=":443"; ma=86400
cf-cache-status:
- DYNAMIC
content-length:
- '767'
openai-organization:
- langchain
openai-processing-ms:
- '215'
openai-version:
- '2020-10-01'
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-ratelimit-limit-requests:
- '10000'
x-ratelimit-limit-tokens:
- '50000000'
x-ratelimit-remaining-requests:
- '9999'
x-ratelimit-remaining-tokens:
- '49999980'
x-ratelimit-reset-requests:
- 6ms
x-ratelimit-reset-tokens:
- 0s
x-request-id:
- req_94c11a5b4f40ac6a0877a88c96e5da99
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit a7fc8bf

Please sign in to comment.