diff --git a/tests/api_resources/beta/messages/test_batches.py b/tests/api_resources/beta/messages/test_batches.py index 12c5cae0..3ff7937e 100644 --- a/tests/api_resources/beta/messages/test_batches.py +++ b/tests/api_resources/beta/messages/test_batches.py @@ -39,33 +39,7 @@ def test_method_create(self, client: Anthropic) -> None: ], "model": "claude-3-5-sonnet-20241022", }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, + } ], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -86,96 +60,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: ], "model": "claude-3-5-sonnet-20241022", "metadata": {"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - "stop_sequences": ["string", "string", "string"], - "stream": False, - "system": [ - { - "text": "Today's date is 2024-06-01.", - "type": "text", - "cache_control": {"type": "ephemeral"}, - } - ], - "temperature": 1, - "tool_choice": { - "type": "auto", - "disable_parallel_tool_use": True, - }, - "tools": [ - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - ], - "top_k": 5, - "top_p": 0.7, - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - "metadata": {"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - "stop_sequences": ["string", "string", "string"], + "stop_sequences": ["string"], "stream": False, "system": [ { @@ -208,141 +93,14 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - ], - "top_k": 5, - "top_p": 0.7, - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", } ], - "model": "claude-3-5-sonnet-20241022", - "metadata": {"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - "stop_sequences": ["string", "string", "string"], - "stream": False, - "system": [ - { - "text": "Today's date is 2024-06-01.", - "type": "text", - "cache_control": {"type": "ephemeral"}, - } - ], - "temperature": 1, - "tool_choice": { - "type": "auto", - "disable_parallel_tool_use": True, - }, - "tools": [ - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - ], "top_k": 5, "top_p": 0.7, }, - }, + } ], - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -362,33 +120,7 @@ def test_raw_response_create(self, client: Anthropic) -> None: ], "model": "claude-3-5-sonnet-20241022", }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, + } ], ) @@ -413,33 +145,7 @@ def test_streaming_response_create(self, client: Anthropic) -> None: ], "model": "claude-3-5-sonnet-20241022", }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, + } ], ) as response: assert not response.is_closed @@ -461,7 +167,7 @@ def test_method_retrieve(self, client: Anthropic) -> None: def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: batch = client.beta.messages.batches.retrieve( message_batch_id="message_batch_id", - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -507,7 +213,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: after_id="after_id", before_id="before_id", limit=1, - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(SyncPage[BetaMessageBatch], batch, path=["response"]) @@ -542,7 +248,7 @@ def test_method_cancel(self, client: Anthropic) -> None: def test_method_cancel_with_all_params(self, client: Anthropic) -> None: batch = client.beta.messages.batches.cancel( message_batch_id="message_batch_id", - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -619,37 +325,11 @@ def test_path_params_results(self, client: Anthropic) -> None: class TestAsyncBatches: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncAnthropic) -> None: - batch = await async_client.beta.messages.batches.create( - requests=[ - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, + + @parametrize + async def test_method_create(self, async_client: AsyncAnthropic) -> None: + batch = await async_client.beta.messages.batches.create( + requests=[ { "custom_id": "my-custom-id-1", "params": { @@ -662,7 +342,7 @@ async def test_method_create(self, async_client: AsyncAnthropic) -> None: ], "model": "claude-3-5-sonnet-20241022", }, - }, + } ], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -683,96 +363,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) ], "model": "claude-3-5-sonnet-20241022", "metadata": {"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - "stop_sequences": ["string", "string", "string"], - "stream": False, - "system": [ - { - "text": "Today's date is 2024-06-01.", - "type": "text", - "cache_control": {"type": "ephemeral"}, - } - ], - "temperature": 1, - "tool_choice": { - "type": "auto", - "disable_parallel_tool_use": True, - }, - "tools": [ - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - ], - "top_k": 5, - "top_p": 0.7, - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - "metadata": {"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - "stop_sequences": ["string", "string", "string"], + "stop_sequences": ["string"], "stream": False, "system": [ { @@ -805,141 +396,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - ], - "top_k": 5, - "top_p": 0.7, - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - "metadata": {"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - "stop_sequences": ["string", "string", "string"], - "stream": False, - "system": [ - { - "text": "Today's date is 2024-06-01.", - "type": "text", - "cache_control": {"type": "ephemeral"}, } ], - "temperature": 1, - "tool_choice": { - "type": "auto", - "disable_parallel_tool_use": True, - }, - "tools": [ - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - ], "top_k": 5, "top_p": 0.7, }, - }, + } ], - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -959,33 +423,7 @@ async def test_raw_response_create(self, async_client: AsyncAnthropic) -> None: ], "model": "claude-3-5-sonnet-20241022", }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, + } ], ) @@ -1010,33 +448,7 @@ async def test_streaming_response_create(self, async_client: AsyncAnthropic) -> ], "model": "claude-3-5-sonnet-20241022", }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, - { - "custom_id": "my-custom-id-1", - "params": { - "max_tokens": 1024, - "messages": [ - { - "content": "Hello, world", - "role": "user", - } - ], - "model": "claude-3-5-sonnet-20241022", - }, - }, + } ], ) as response: assert not response.is_closed @@ -1058,7 +470,7 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: batch = await async_client.beta.messages.batches.retrieve( message_batch_id="message_batch_id", - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -1104,7 +516,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - after_id="after_id", before_id="before_id", limit=1, - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(AsyncPage[BetaMessageBatch], batch, path=["response"]) @@ -1139,7 +551,7 @@ async def test_method_cancel(self, async_client: AsyncAnthropic) -> None: async def test_method_cancel_with_all_params(self, async_client: AsyncAnthropic) -> None: batch = await async_client.beta.messages.batches.cancel( message_batch_id="message_batch_id", - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) diff --git a/tests/api_resources/beta/prompt_caching/test_messages.py b/tests/api_resources/beta/prompt_caching/test_messages.py index edd8ecf3..4ecb1624 100644 --- a/tests/api_resources/beta/prompt_caching/test_messages.py +++ b/tests/api_resources/beta/prompt_caching/test_messages.py @@ -43,7 +43,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No ], model="claude-3-5-sonnet-20241022", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, system=[ { @@ -75,47 +75,11 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No "name": "x", "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(PromptCachingBetaMessage, message, path=["response"]) @@ -185,7 +149,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No model="claude-3-5-sonnet-20241022", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], system=[ { "text": "Today's date is 2024-06-01.", @@ -216,47 +180,11 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No "name": "x", "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) message_stream.response.close() @@ -329,7 +257,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn ], model="claude-3-5-sonnet-20241022", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, system=[ { @@ -361,47 +289,11 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "name": "x", "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(PromptCachingBetaMessage, message, path=["response"]) @@ -471,7 +363,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn model="claude-3-5-sonnet-20241022", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], system=[ { "text": "Today's date is 2024-06-01.", @@ -502,47 +394,11 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "name": "x", "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) await message_stream.response.aclose() diff --git a/tests/api_resources/beta/test_messages.py b/tests/api_resources/beta/test_messages.py index 17c82308..ba7776cd 100644 --- a/tests/api_resources/beta/test_messages.py +++ b/tests/api_resources/beta/test_messages.py @@ -46,7 +46,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No ], model="claude-3-5-sonnet-20241022", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, system=[ { @@ -79,49 +79,11 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessage, message, path=["response"]) @@ -191,7 +153,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No model="claude-3-5-sonnet-20241022", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], system=[ { "text": "Today's date is 2024-06-01.", @@ -223,49 +185,11 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) message_stream.response.close() @@ -315,15 +239,7 @@ def test_method_count_tokens(self, client: Anthropic) -> None: { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", ) @@ -336,15 +252,7 @@ def test_method_count_tokens_with_all_params(self, client: Anthropic) -> None: { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", system=[ @@ -377,47 +285,9 @@ def test_method_count_tokens_with_all_params(self, client: Anthropic) -> None: "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, + } ], - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageTokensCount, message, path=["response"]) @@ -428,15 +298,7 @@ def test_raw_response_count_tokens(self, client: Anthropic) -> None: { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", ) @@ -453,15 +315,7 @@ def test_streaming_response_count_tokens(self, client: Anthropic) -> None: { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", ) as response: @@ -503,7 +357,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn ], model="claude-3-5-sonnet-20241022", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, system=[ { @@ -536,49 +390,11 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessage, message, path=["response"]) @@ -648,7 +464,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn model="claude-3-5-sonnet-20241022", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], system=[ { "text": "Today's date is 2024-06-01.", @@ -680,49 +496,11 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, + } ], top_k=5, top_p=0.7, - betas=["string", "string", "string"], + betas=["string"], ) await message_stream.response.aclose() @@ -772,15 +550,7 @@ async def test_method_count_tokens(self, async_client: AsyncAnthropic) -> None: { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", ) @@ -793,15 +563,7 @@ async def test_method_count_tokens_with_all_params(self, async_client: AsyncAnth { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", system=[ @@ -834,47 +596,9 @@ async def test_method_count_tokens_with_all_params(self, async_client: AsyncAnth "cache_control": {"type": "ephemeral"}, "description": "Get the current weather in a given location", "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "cache_control": {"type": "ephemeral"}, - "description": "Get the current weather in a given location", - "type": "custom", - }, + } ], - betas=["string", "string", "string"], + betas=["string"], ) assert_matches_type(BetaMessageTokensCount, message, path=["response"]) @@ -885,15 +609,7 @@ async def test_raw_response_count_tokens(self, async_client: AsyncAnthropic) -> { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", ) @@ -910,15 +626,7 @@ async def test_streaming_response_count_tokens(self, async_client: AsyncAnthropi { "content": "string", "role": "user", - }, - { - "content": "string", - "role": "user", - }, - { - "content": "string", - "role": "user", - }, + } ], model="string", ) as response: diff --git a/tests/api_resources/test_completions.py b/tests/api_resources/test_completions.py index cf87d9fe..24374a13 100644 --- a/tests/api_resources/test_completions.py +++ b/tests/api_resources/test_completions.py @@ -33,7 +33,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No model="string", prompt="\n\nHuman: Hello, world!\n\nAssistant:", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, temperature=1, top_k=5, @@ -87,7 +87,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], temperature=1, top_k=5, top_p=0.7, @@ -143,7 +143,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn model="string", prompt="\n\nHuman: Hello, world!\n\nAssistant:", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, temperature=1, top_k=5, @@ -197,7 +197,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn prompt="\n\nHuman: Hello, world!\n\nAssistant:", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], temperature=1, top_k=5, top_p=0.7, diff --git a/tests/api_resources/test_messages.py b/tests/api_resources/test_messages.py index 5219f7c4..533918dd 100644 --- a/tests/api_resources/test_messages.py +++ b/tests/api_resources/test_messages.py @@ -44,7 +44,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No ], model="claude-3-5-sonnet-20241022", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, system=[ { @@ -74,41 +74,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No }, "name": "x", "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7, @@ -181,7 +147,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No model="claude-3-5-sonnet-20241022", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], system=[ { "text": "Today's date is 2024-06-01.", @@ -210,41 +176,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No }, "name": "x", "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7, @@ -330,7 +262,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn ], model="claude-3-5-sonnet-20241022", metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], stream=False, system=[ { @@ -360,41 +292,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn }, "name": "x", "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7, @@ -467,7 +365,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn model="claude-3-5-sonnet-20241022", stream=True, metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"}, - stop_sequences=["string", "string", "string"], + stop_sequences=["string"], system=[ { "text": "Today's date is 2024-06-01.", @@ -496,41 +394,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn }, "name": "x", "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, - { - "input_schema": { - "type": "object", - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string", - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string", - }, - }, - }, - "name": "x", - "description": "Get the current weather in a given location", - }, + } ], top_k=5, top_p=0.7,