diff --git a/tests/test_async_client.py b/tests/test_async_client.py index d6c48cd67..4a9e69eb9 100644 --- a/tests/test_async_client.py +++ b/tests/test_async_client.py @@ -25,6 +25,7 @@ async def test_context_manager(self) -> None: async def test_chat(self) -> None: chat = await self.co.chat( + model="command-a-03-2025", chat_history=[ UserMessage( message="Who discovered gravity?"), @@ -32,13 +33,13 @@ async def test_chat(self) -> None: "gravity is Sir Isaac Newton") ], message="What year was he born?", - connectors=[ChatConnector(id="web-search")] ) print(chat) async def test_chat_stream(self) -> None: stream = self.co.chat_stream( + model="command-a-03-2025", chat_history=[ UserMessage( message="Who discovered gravity?"), @@ -46,7 +47,6 @@ async def test_chat_stream(self) -> None: "gravity is Sir Isaac Newton") ], message="What year was he born?", - connectors=[ChatConnector(id="web-search")] ) events = set() @@ -218,40 +218,10 @@ async def test_save_load(self) -> None: await self.co.datasets.delete(my_dataset.id or "") - async def test_summarize(self) -> None: - text = ( - "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. " - "It may be made from milk or cream and is flavoured with a sweetener, " - "either sugar or an alternative, and a spice, such as cocoa or vanilla, " - "or with fruit such as strawberries or peaches. " - "It can also be made by whisking a flavored cream base and liquid nitrogen together. " - "Food coloring is sometimes added, in addition to stabilizers. " - "The mixture is cooled below the freezing point of water and stirred to incorporate air spaces " - "and to prevent detectable ice crystals from forming. The result is a smooth, " - "semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F). " - "It becomes more malleable as its temperature increases.\n\n" - "The meaning of the name \"ice cream\" varies from one country to another. " - "In some countries, such as the United States, \"ice cream\" applies only to a specific variety, " - "and most governments regulate the commercial use of the various terms according to the " - "relative quantities of the main ingredients, notably the amount of cream. " - "Products that do not meet the criteria to be called ice cream are sometimes labelled " - "\"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, " - "one word is used fo\r all variants. Analogues made from dairy alternatives, " - "such as goat's or sheep's milk, or milk substitutes " - "(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are " - "lactose intolerant, allergic to dairy protein or vegan." - ) - - response = await self.co.summarize( - text=text, - ) - - print(response) - async def test_tokenize(self) -> None: response = await self.co.tokenize( text='tokenize me! :D', - model='command', + model="command-a-03-2025", offline=False, ) print(response) @@ -259,34 +229,11 @@ async def test_tokenize(self) -> None: async def test_detokenize(self) -> None: response = await self.co.detokenize( tokens=[10104, 12221, 1315, 34, 1420, 69], - model="command", + model="command-a-03-2025", offline=False, ) print(response) - @unittest.skipIf(os.getenv("CO_API_URL") is not None, "Doesn't work in staging.") - async def test_connectors_crud(self) -> None: - created_connector = await self.co.connectors.create( - name="Example connector", - url="https://dummy-connector-o5btz7ucgq-uc.a.run.app/search", - service_auth=CreateConnectorServiceAuth( - token="dummy-connector-token", - type="bearer", - ) - ) - print(created_connector) - - connector = await self.co.connectors.get(created_connector.connector.id) - - print(connector) - - updated_connector = await self.co.connectors.update( - id=connector.connector.id, name="new name") - - print(updated_connector) - - await self.co.connectors.delete(created_connector.connector.id) - @unittest.skipIf(os.getenv("CO_API_URL") is not None, "Doesn't work in staging.") async def test_tool_use(self) -> None: tools = [ @@ -347,7 +294,7 @@ async def test_tool_use(self) -> None: tools=tools, tool_results=tool_results, force_single_step=True, - model="command-nightly", + model="command-a-03-2025", ) self.assertEqual(cited_response.documents, [ @@ -362,14 +309,14 @@ async def test_tool_use(self) -> None: async def test_local_tokenize(self) -> None: response = await self.co.tokenize( - model="command", + model="command-a-03-2025", text="tokenize me! :D" ) print(response) async def test_local_detokenize(self) -> None: response = await self.co.detokenize( - model="command", + model="command-a-03-2025", tokens=[10104, 12221, 1315, 34, 1420, 69] ) print(response) @@ -377,6 +324,6 @@ async def test_local_detokenize(self) -> None: async def test_tokenize_async_context_with_sync_client(self) -> None: # Test that the sync client can be used in an async context. co = cohere.Client(timeout=10000) - print(co.tokenize(model="command", text="tokenize me! :D")) - print(co.detokenize(model="command", tokens=[ + print(co.tokenize(model="command-a-03-2025", text="tokenize me! :D")) + print(co.detokenize(model="command-a-03-2025", tokens=[ 10104, 12221, 1315, 34, 1420, 69])) diff --git a/tests/test_client.py b/tests/test_client.py index 77743c58f..6bb80c7e5 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -31,7 +31,6 @@ def test_chat(self) -> None: "gravity is Sir Isaac Newton") ], message="What year was he born?", - connectors=[ChatConnector(id="web-search")] ) print(chat) @@ -45,7 +44,6 @@ def test_chat_stream(self) -> None: "gravity is Sir Isaac Newton") ], message="What year was he born?", - connectors=[ChatConnector(id="web-search")] ) events = set() @@ -257,40 +255,10 @@ def test_save_load(self) -> None: co.datasets.delete(my_dataset.id or "") - def test_summarize(self) -> None: - text = ( - "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. " - "It may be made from milk or cream and is flavoured with a sweetener, " - "either sugar or an alternative, and a spice, such as cocoa or vanilla, " - "or with fruit such as strawberries or peaches. " - "It can also be made by whisking a flavored cream base and liquid nitrogen together. " - "Food coloring is sometimes added, in addition to stabilizers. " - "The mixture is cooled below the freezing point of water and stirred to incorporate air spaces " - "and to prevent detectable ice crystals from forming. The result is a smooth, " - "semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F). " - "It becomes more malleable as its temperature increases.\n\n" - "The meaning of the name \"ice cream\" varies from one country to another. " - "In some countries, such as the United States, \"ice cream\" applies only to a specific variety, " - "and most governments regulate the commercial use of the various terms according to the " - "relative quantities of the main ingredients, notably the amount of cream. " - "Products that do not meet the criteria to be called ice cream are sometimes labelled " - "\"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, " - "one word is used fo\r all variants. Analogues made from dairy alternatives, " - "such as goat's or sheep's milk, or milk substitutes " - "(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are " - "lactose intolerant, allergic to dairy protein or vegan." - ) - - response = co.summarize( - text=text, - ) - - print(response) - def test_tokenize(self) -> None: response = co.tokenize( text='tokenize me! :D', - model='command', + model='command-a-03-2025', offline=False, ) print(response) @@ -298,33 +266,11 @@ def test_tokenize(self) -> None: def test_detokenize(self) -> None: response = co.detokenize( tokens=[10104, 12221, 1315, 34, 1420, 69], - model="command", + model="command-a-03-2025", offline=False, ) print(response) - @unittest.skipIf(os.getenv("CO_API_URL") is not None, "Doesn't work in staging.") - def test_connectors_crud(self) -> None: - created_connector = co.connectors.create( - name="Example connector", - url="https://dummy-connector-o5btz7ucgq-uc.a.run.app/search", - service_auth=CreateConnectorServiceAuth( - token="dummy-connector-token", - type="bearer", - ) - ) - print(created_connector) - - connector = co.connectors.get(created_connector.connector.id) - - print(connector) - - updated_connector = co.connectors.update( - id=connector.connector.id, name="new name") - - print(updated_connector) - - co.connectors.delete(created_connector.connector.id) @unittest.skipIf(os.getenv("CO_API_URL") is not None, "Doesn't work in staging.") def test_tool_use(self) -> None: @@ -401,14 +347,14 @@ def test_tool_use(self) -> None: def test_local_tokenize(self) -> None: response = co.tokenize( - model="command", + model="command-a-03-2025", text="tokenize me! :D" ) print(response) def test_local_detokenize(self) -> None: response = co.detokenize( - model="command", + model="command-a-03-2025", tokens=[10104, 12221, 1315, 34, 1420, 69] ) print(response) diff --git a/tests/test_client_v2.py b/tests/test_client_v2.py index 18ac8ed33..e670b1360 100644 --- a/tests/test_client_v2.py +++ b/tests/test_client_v2.py @@ -15,13 +15,13 @@ class TestClientV2(unittest.TestCase): def test_chat(self) -> None: response = co.chat( - model="command-r-plus", messages=[cohere.UserChatMessageV2(content="hello world!")]) + model="command-a-03-2025", messages=[cohere.UserChatMessageV2(content="hello world!")]) print(response.message) def test_chat_stream(self) -> None: stream = co.chat_stream( - model="command-r-plus", messages=[cohere.UserChatMessageV2(content="hello world!")]) + model="command-a-03-2025", messages=[cohere.UserChatMessageV2(content="hello world!")]) events = set() @@ -49,7 +49,7 @@ def test_chat_documents(self) -> None: messages=[cohere.UserChatMessageV2( content=[cohere.TextContent(text="how many widges were sold in 2020?")], )], - model="command-r-plus", + model="command-a-03-2025", documents=documents, ) @@ -76,7 +76,7 @@ def test_chat_tools(self) -> None: messages: cohere.ChatMessages = [ cohere.UserChatMessageV2(content="what is the weather in Toronto?") ] - res = co.chat(model="command-r-plus", tools=tools, messages=messages) + res = co.chat(model="command-a-03-2025", tools=tools, messages=messages) # call the get_weather tool tool_result = {"temperature": "30C"} @@ -88,5 +88,5 @@ def test_chat_tools(self) -> None: messages.append(cohere.ToolChatMessageV2( tool_call_id=res.message.tool_calls[0].id, content=list(tool_content))) - res = co.chat(tools=tools, messages=messages, model="command-r-plus") + res = co.chat(tools=tools, messages=messages, model="command-a-03-2025") print(res.message)