From 6f0869ccd902eeaad531772c17e547edc1a0b613 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:31:43 +0000 Subject: [PATCH] docs: use latest sonnet in example snippets (#781) --- README.md | 18 +++++++++--------- tests/test_client.py | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index cd376246..843c572d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ message = client.messages.create( "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ) print(message.content) ``` @@ -70,7 +70,7 @@ async def main() -> None: "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ) print(message.content) @@ -97,7 +97,7 @@ stream = client.messages.create( "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", stream=True, ) for event in stream: @@ -119,7 +119,7 @@ stream = await client.messages.create( "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", stream=True, ) async for event in stream: @@ -399,7 +399,7 @@ try: "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ) except anthropic.APIConnectionError as e: print("The server could not be reached") @@ -475,7 +475,7 @@ client.with_options(max_retries=5).messages.create( "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ) ``` @@ -507,7 +507,7 @@ client.with_options(timeout=5.0).messages.create( "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ) ``` @@ -571,7 +571,7 @@ response = client.messages.with_raw_response.create( "role": "user", "content": "Hello, Claude", }], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ) print(response.headers.get('X-My-Header')) @@ -605,7 +605,7 @@ with client.messages.with_streaming_response.create( "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ) as response: print(response.headers.get("X-My-Header")) diff --git a/tests/test_client.py b/tests/test_client.py index f50233f0..ca181ada 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -745,7 +745,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ), ), cast_to=httpx.Response, @@ -772,7 +772,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ), ), cast_to=httpx.Response, @@ -1625,7 +1625,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ), ), cast_to=httpx.Response, @@ -1652,7 +1652,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) "content": "Hello, Claude", } ], - model="claude-3-opus-20240229", + model="claude-3-5-sonnet-latest", ), ), cast_to=httpx.Response,