diff --git a/README.md b/README.md index d134e1af..749e9e4a 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ anthropic = Anthropic( ) completion = anthropic.completions.create( - model="claude-2", + model="claude-2.1", max_tokens_to_sample=300, prompt=f"{HUMAN_PROMPT} how does a court case get to the Supreme Court?{AI_PROMPT}", ) @@ -122,7 +122,7 @@ anthropic = AsyncAnthropic( async def main(): completion = await anthropic.completions.create( - model="claude-2", + model="claude-2.1", max_tokens_to_sample=300, prompt=f"{HUMAN_PROMPT} how does a court case get to the Supreme Court?{AI_PROMPT}", ) @@ -146,7 +146,7 @@ anthropic = Anthropic() stream = anthropic.completions.create( prompt=f"{HUMAN_PROMPT} Your prompt here{AI_PROMPT}", max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", stream=True, ) for completion in stream: @@ -163,7 +163,7 @@ anthropic = AsyncAnthropic() stream = await anthropic.completions.create( prompt=f"{HUMAN_PROMPT} Your prompt here{AI_PROMPT}", max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", stream=True, ) async for completion in stream: @@ -206,7 +206,7 @@ try: client.completions.create( prompt=f"{anthropic.HUMAN_PROMPT} Your prompt here{anthropic.AI_PROMPT}", max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", ) except anthropic.APIConnectionError as e: print("The server could not be reached") @@ -253,7 +253,7 @@ anthropic = Anthropic( anthropic.with_options(max_retries=5).completions.create( prompt=f"{HUMAN_PROMPT} Can you help me effectively ask for a raise at work?{AI_PROMPT}", max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", ) ``` @@ -280,7 +280,7 @@ anthropic = Anthropic( anthropic.with_options(timeout=5 * 1000).completions.create( prompt=f"{HUMAN_PROMPT} Where can I get a good coffee in my neighbourhood?{AI_PROMPT}", max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", ) ``` @@ -338,7 +338,7 @@ from anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT anthropic = Anthropic() response = anthropic.completions.with_raw_response.create( - model="claude-2", + model="claude-2.1", max_tokens_to_sample=300, prompt=f"{HUMAN_PROMPT} how does a court case get to the Supreme Court?{AI_PROMPT}", ) diff --git a/examples/demo_async.py b/examples/demo_async.py index e4ec78d0..49fd5191 100644 --- a/examples/demo_async.py +++ b/examples/demo_async.py @@ -10,7 +10,7 @@ async def main() -> None: client = AsyncAnthropic() res = await client.completions.create( - model="claude-2", + model="claude-2.1", prompt=f"{anthropic.HUMAN_PROMPT} how does a court case get to the Supreme Court? {anthropic.AI_PROMPT}", max_tokens_to_sample=1000, ) diff --git a/examples/demo_sync.py b/examples/demo_sync.py index 0c1c0084..e386e2ad 100644 --- a/examples/demo_sync.py +++ b/examples/demo_sync.py @@ -8,7 +8,7 @@ def main() -> None: client = Anthropic() res = client.completions.create( - model="claude-2", + model="claude-2.1", prompt=f"{anthropic.HUMAN_PROMPT} how does a court case get to the Supreme Court? {anthropic.AI_PROMPT}", max_tokens_to_sample=1000, ) diff --git a/examples/streaming.py b/examples/streaming.py index 2e6d85dd..a738aad9 100644 --- a/examples/streaming.py +++ b/examples/streaming.py @@ -15,7 +15,7 @@ def sync_stream() -> None: stream = client.completions.create( prompt=f"{HUMAN_PROMPT} {question}{AI_PROMPT}", - model="claude-2", + model="claude-2.1", stream=True, max_tokens_to_sample=300, ) @@ -29,7 +29,7 @@ def sync_stream() -> None: async def async_stream() -> None: stream = await async_client.completions.create( prompt=f"{HUMAN_PROMPT} {question}{AI_PROMPT}", - model="claude-2", + model="claude-2.1", stream=True, max_tokens_to_sample=300, ) diff --git a/src/anthropic/resources/completions.py b/src/anthropic/resources/completions.py index a603634d..15d3d153 100644 --- a/src/anthropic/resources/completions.py +++ b/src/anthropic/resources/completions.py @@ -33,7 +33,7 @@ def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, stop_sequences: List[str] | NotGiven = NOT_GIVEN, @@ -62,7 +62,7 @@ def create( As we improve Claude, we develop new versions of it that you can query. This parameter controls which version of Claude answers your request. Right now we are offering two model families: Claude, and Claude Instant. You can use them by - setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See + setting `model` to `"claude-2.1"` or `"claude-instant-1"`, respectively. See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for additional details. @@ -125,7 +125,7 @@ def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, stream: Literal[True], metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, @@ -154,7 +154,7 @@ def create( As we improve Claude, we develop new versions of it that you can query. This parameter controls which version of Claude answers your request. Right now we are offering two model families: Claude, and Claude Instant. You can use them by - setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See + setting `model` to `"claude-2.1"` or `"claude-instant-1"`, respectively. See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for additional details. @@ -217,7 +217,7 @@ def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, stream: bool, metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, @@ -246,7 +246,7 @@ def create( As we improve Claude, we develop new versions of it that you can query. This parameter controls which version of Claude answers your request. Right now we are offering two model families: Claude, and Claude Instant. You can use them by - setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See + setting `model` to `"claude-2.1"` or `"claude-instant-1"`, respectively. See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for additional details. @@ -309,7 +309,7 @@ def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, stop_sequences: List[str] | NotGiven = NOT_GIVEN, @@ -361,7 +361,7 @@ async def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, stop_sequences: List[str] | NotGiven = NOT_GIVEN, @@ -390,7 +390,7 @@ async def create( As we improve Claude, we develop new versions of it that you can query. This parameter controls which version of Claude answers your request. Right now we are offering two model families: Claude, and Claude Instant. You can use them by - setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See + setting `model` to `"claude-2.1"` or `"claude-instant-1"`, respectively. See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for additional details. @@ -453,7 +453,7 @@ async def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, stream: Literal[True], metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, @@ -482,7 +482,7 @@ async def create( As we improve Claude, we develop new versions of it that you can query. This parameter controls which version of Claude answers your request. Right now we are offering two model families: Claude, and Claude Instant. You can use them by - setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See + setting `model` to `"claude-2.1"` or `"claude-instant-1"`, respectively. See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for additional details. @@ -545,7 +545,7 @@ async def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, stream: bool, metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, @@ -574,7 +574,7 @@ async def create( As we improve Claude, we develop new versions of it that you can query. This parameter controls which version of Claude answers your request. Right now we are offering two model families: Claude, and Claude Instant. You can use them by - setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See + setting `model` to `"claude-2.1"` or `"claude-instant-1"`, respectively. See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for additional details. @@ -637,7 +637,7 @@ async def create( self, *, max_tokens_to_sample: int, - model: Union[str, Literal["claude-2", "claude-instant-1"]], + model: Union[str, Literal["claude-2.1", "claude-instant-1"]], prompt: str, metadata: completion_create_params.Metadata | NotGiven = NOT_GIVEN, stop_sequences: List[str] | NotGiven = NOT_GIVEN, diff --git a/src/anthropic/types/completion_create_params.py b/src/anthropic/types/completion_create_params.py index 3dc40e37..ba1ebbe6 100644 --- a/src/anthropic/types/completion_create_params.py +++ b/src/anthropic/types/completion_create_params.py @@ -25,13 +25,13 @@ class CompletionCreateParamsBase(TypedDict, total=False): only specifies the absolute maximum number of tokens to generate. """ - model: Required[Union[str, Literal["claude-2", "claude-instant-1"]]] + model: Required[Union[str, Literal["claude-2.1", "claude-instant-1"]]] """The model that will complete your prompt. As we improve Claude, we develop new versions of it that you can query. This parameter controls which version of Claude answers your request. Right now we are offering two model families: Claude, and Claude Instant. You can use them by - setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See + setting `model` to `"claude-2.1"` or `"claude-instant-1"`, respectively. See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for additional details. """ diff --git a/tests/api_resources/test_completions.py b/tests/api_resources/test_completions.py index bc152842..f96563c9 100644 --- a/tests/api_resources/test_completions.py +++ b/tests/api_resources/test_completions.py @@ -24,7 +24,7 @@ class TestCompletions: def test_method_create_overload_1(self, client: Anthropic) -> None: completion = client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", ) assert_matches_type(Completion, completion, path=["response"]) @@ -33,7 +33,7 @@ def test_method_create_overload_1(self, client: Anthropic) -> None: def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> None: completion = client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, stop_sequences=["string", "string", "string"], @@ -48,7 +48,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No def test_raw_response_create_overload_1(self, client: Anthropic) -> None: response = client.completions.with_raw_response.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -59,7 +59,7 @@ def test_raw_response_create_overload_1(self, client: Anthropic) -> None: def test_method_create_overload_2(self, client: Anthropic) -> None: client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, ) @@ -68,7 +68,7 @@ def test_method_create_overload_2(self, client: Anthropic) -> None: def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> None: client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, @@ -82,7 +82,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No def test_raw_response_create_overload_2(self, client: Anthropic) -> None: response = client.completions.with_raw_response.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, ) @@ -99,7 +99,7 @@ class TestAsyncCompletions: async def test_method_create_overload_1(self, client: AsyncAnthropic) -> None: completion = await client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", ) assert_matches_type(Completion, completion, path=["response"]) @@ -108,7 +108,7 @@ async def test_method_create_overload_1(self, client: AsyncAnthropic) -> None: async def test_method_create_with_all_params_overload_1(self, client: AsyncAnthropic) -> None: completion = await client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, stop_sequences=["string", "string", "string"], @@ -123,7 +123,7 @@ async def test_method_create_with_all_params_overload_1(self, client: AsyncAnthr async def test_raw_response_create_overload_1(self, client: AsyncAnthropic) -> None: response = await client.completions.with_raw_response.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -134,7 +134,7 @@ async def test_raw_response_create_overload_1(self, client: AsyncAnthropic) -> N async def test_method_create_overload_2(self, client: AsyncAnthropic) -> None: await client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, ) @@ -143,7 +143,7 @@ async def test_method_create_overload_2(self, client: AsyncAnthropic) -> None: async def test_method_create_with_all_params_overload_2(self, client: AsyncAnthropic) -> None: await client.completions.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, @@ -157,7 +157,7 @@ async def test_method_create_with_all_params_overload_2(self, client: AsyncAnthr async def test_raw_response_create_overload_2(self, client: AsyncAnthropic) -> None: response = await client.completions.with_raw_response.create( max_tokens_to_sample=256, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, ) diff --git a/tests/test_client.py b/tests/test_client.py index 33b5095d..0aba50cf 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -799,7 +799,7 @@ def raise_for_status(response: httpx.Response) -> None: "/v1/complete", body=dict( max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", ), cast_to=httpx.Response, @@ -819,7 +819,7 @@ def raise_for_status(_response: httpx.Response) -> None: "/v1/complete", body=dict( max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", ), cast_to=httpx.Response, @@ -840,7 +840,7 @@ def raise_for_status(response: httpx.Response) -> None: "/v1/complete", body=dict( max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", ), cast_to=httpx.Response, @@ -1628,7 +1628,7 @@ def raise_for_status(response: httpx.Response) -> None: "/v1/complete", body=dict( max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", ), cast_to=httpx.Response, @@ -1648,7 +1648,7 @@ def raise_for_status(_response: httpx.Response) -> None: "/v1/complete", body=dict( max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", ), cast_to=httpx.Response, @@ -1669,7 +1669,7 @@ def raise_for_status(response: httpx.Response) -> None: "/v1/complete", body=dict( max_tokens_to_sample=300, - model="claude-2", + model="claude-2.1", prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", ), cast_to=httpx.Response,