generated from dataforgoodfr/d4g-project-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: record test for anthropic stream
- Loading branch information
1 parent
0665061
commit 8400285
Showing
2 changed files
with
224 additions
and
4 deletions.
There are no files selected for viewing
219 changes: 219 additions & 0 deletions
219
tests/cassettes/test_anthropic/test_anthropic_stream_chat.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
interactions: | ||
- request: | ||
body: '{"max_tokens": 100, "messages": [{"role": "user", "content": "Hello World!"}], | ||
"model": "claude-3-haiku-20240307", "stream": true}' | ||
headers: | ||
accept: | ||
- application/json | ||
accept-encoding: | ||
- gzip, deflate | ||
anthropic-version: | ||
- '2023-06-01' | ||
connection: | ||
- keep-alive | ||
content-length: | ||
- '130' | ||
content-type: | ||
- application/json | ||
host: | ||
- api.anthropic.com | ||
user-agent: | ||
- Anthropic/Python 0.18.1 | ||
x-stainless-arch: | ||
- x64 | ||
x-stainless-async: | ||
- 'false' | ||
x-stainless-custom-event-handler: | ||
- 'false' | ||
x-stainless-lang: | ||
- python | ||
x-stainless-os: | ||
- MacOS | ||
x-stainless-package-version: | ||
- 0.18.1 | ||
x-stainless-runtime: | ||
- CPython | ||
x-stainless-runtime-version: | ||
- 3.9.18 | ||
x-stainless-stream-helper: | ||
- messages | ||
method: POST | ||
uri: https://api.anthropic.com/v1/messages | ||
response: | ||
body: | ||
string: 'event: message_start | ||
data: {"type":"message_start","message":{"id":"msg_018kQVU9yEuGyZgQCbUy286U","type":"message","role":"assistant","content":[],"model":"claude-3-haiku-20240307","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":10,"output_tokens":1}} } | ||
event: content_block_start | ||
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } | ||
event: ping | ||
data: {"type": "ping"} | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"} | ||
} | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"!"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
I"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"''m"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
an"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
AI"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
assistant"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
created"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
by"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
Anthrop"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"ic"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"."} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
It"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"''s"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
nice"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
to"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
meet"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" | ||
you"} } | ||
event: content_block_delta | ||
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"."} } | ||
event: content_block_stop | ||
data: {"type":"content_block_stop","index":0 } | ||
event: message_delta | ||
data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":23} } | ||
event: message_stop | ||
data: {"type":"message_stop" } | ||
' | ||
headers: | ||
CF-Cache-Status: | ||
- DYNAMIC | ||
CF-RAY: | ||
- 8722b7ccce5d0471-CDG | ||
Cache-Control: | ||
- no-cache | ||
Connection: | ||
- keep-alive | ||
Content-Type: | ||
- text/event-stream; charset=utf-8 | ||
Date: | ||
- Wed, 10 Apr 2024 12:25:10 GMT | ||
Server: | ||
- cloudflare | ||
Transfer-Encoding: | ||
- chunked | ||
anthropic-ratelimit-requests-limit: | ||
- '5' | ||
anthropic-ratelimit-requests-remaining: | ||
- '4' | ||
anthropic-ratelimit-requests-reset: | ||
- '2024-04-10T12:26:00Z' | ||
anthropic-ratelimit-tokens-limit: | ||
- '25000' | ||
anthropic-ratelimit-tokens-remaining: | ||
- '25000' | ||
anthropic-ratelimit-tokens-reset: | ||
- '2024-04-10T12:26:00Z' | ||
request-id: | ||
- req_0132wdJjsUTFg6svV4aLRf49 | ||
via: | ||
- 1.1 google | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters