diff --git a/poetry.lock b/poetry.lock
index 1ca38b7ac..fd2e611ae 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -89,17 +89,17 @@ files = [
[[package]]
name = "boto3"
-version = "1.35.49"
+version = "1.35.51"
description = "The AWS SDK for Python"
optional = true
python-versions = ">=3.8"
files = [
- {file = "boto3-1.35.49-py3-none-any.whl", hash = "sha256:b660c649a27a6b47a34f6f858f5bd7c3b0a798a16dec8dda7cbebeee80fd1f60"},
- {file = "boto3-1.35.49.tar.gz", hash = "sha256:ddecb27f5699ca9f97711c52b6c0652c2e63bf6c2bfbc13b819b4f523b4d30ff"},
+ {file = "boto3-1.35.51-py3-none-any.whl", hash = "sha256:c922f6a18958af9d8af0489d6d8503b517029d8159b26aa4859a8294561c72e9"},
+ {file = "boto3-1.35.51.tar.gz", hash = "sha256:a57c6c7012ecb40c43e565a6f7a891f39efa990ff933eab63cd456f7501c2731"},
]
[package.dependencies]
-botocore = ">=1.35.49,<1.36.0"
+botocore = ">=1.35.51,<1.36.0"
jmespath = ">=0.7.1,<2.0.0"
s3transfer = ">=0.10.0,<0.11.0"
@@ -108,13 +108,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
[[package]]
name = "botocore"
-version = "1.35.49"
+version = "1.35.51"
description = "Low-level, data-driven core of boto 3."
optional = true
python-versions = ">=3.8"
files = [
- {file = "botocore-1.35.49-py3-none-any.whl", hash = "sha256:aed4d3643afd702920792b68fbe712a8c3847993820d1048cd238a6469354da1"},
- {file = "botocore-1.35.49.tar.gz", hash = "sha256:07d0c1325fdbfa49a4a054413dbdeab0a6030449b2aa66099241af2dac48afd8"},
+ {file = "botocore-1.35.51-py3-none-any.whl", hash = "sha256:4d65b00111bd12b98e9f920ecab602cf619cc6a6d0be6e5dd53f517e4b92901c"},
+ {file = "botocore-1.35.51.tar.gz", hash = "sha256:a9b3d1da76b3e896ad74605c01d88f596324a3337393d4bfbfa0d6c35822ca9c"},
]
[package.dependencies]
@@ -1027,13 +1027,13 @@ files = [
[[package]]
name = "huggingface-hub"
-version = "0.26.1"
+version = "0.26.2"
description = "Client library to download and publish models, datasets and other repos on the huggingface.co hub"
optional = false
python-versions = ">=3.8.0"
files = [
- {file = "huggingface_hub-0.26.1-py3-none-any.whl", hash = "sha256:5927a8fc64ae68859cd954b7cc29d1c8390a5e15caba6d3d349c973be8fdacf3"},
- {file = "huggingface_hub-0.26.1.tar.gz", hash = "sha256:414c0d9b769eecc86c70f9d939d0f48bb28e8461dd1130021542eff0212db890"},
+ {file = "huggingface_hub-0.26.2-py3-none-any.whl", hash = "sha256:98c2a5a8e786c7b2cb6fdeb2740893cba4d53e312572ed3d8afafda65b128c46"},
+ {file = "huggingface_hub-0.26.2.tar.gz", hash = "sha256:b100d853465d965733964d123939ba287da60a547087783ddff8a323f340332b"},
]
[package.dependencies]
@@ -2743,13 +2743,13 @@ crt = ["botocore[crt] (>=1.33.2,<2.0a.0)"]
[[package]]
name = "sagemaker"
-version = "2.232.2"
+version = "2.232.3"
description = "Open source library for training and deploying models on Amazon SageMaker."
optional = true
python-versions = ">=3.8"
files = [
- {file = "sagemaker-2.232.2-py3-none-any.whl", hash = "sha256:49afdb0d83635bb71c5177e5ca6fb0b2dca804fa3c3f115f74dac88b77238f2f"},
- {file = "sagemaker-2.232.2.tar.gz", hash = "sha256:96732fc6986ad5b723b05bac5d5ee8e4594e51c6c65c0cc0d07c0dbef69e82b7"},
+ {file = "sagemaker-2.232.3-py3-none-any.whl", hash = "sha256:cff39fc1e93f1468f1627a7a4078d4a7c009c903a9b0ca55b6c646dee5d1d2a5"},
+ {file = "sagemaker-2.232.3.tar.gz", hash = "sha256:d46eb5dc98e4abc4b68548aeea3a8c36b7bdf107f14adcb5b3b25da3e36282c6"},
]
[package.dependencies]
@@ -2778,22 +2778,22 @@ tqdm = "*"
urllib3 = ">=1.26.8,<3.0.0"
[package.extras]
-all = ["accelerate (>=0.24.1,<=0.27.0)", "docker (>=5.0.2,<8.0.0)", "fastapi (>=0.111.0)", "nest-asyncio", "pyspark (==3.3.1)", "pyyaml (>=5.4.1,<7)", "sagemaker-feature-store-pyspark-3-3", "sagemaker-schema-inference-artifacts (>=0.0.5)", "scipy (==1.10.1)", "urllib3 (>=1.26.8,<3.0.0)", "uvicorn (>=0.30.1)"]
-feature-processor = ["pyspark (==3.3.1)", "sagemaker-feature-store-pyspark-3-3"]
+all = ["accelerate (>=0.24.1,<=0.27.0)", "docker (>=5.0.2,<8.0.0)", "fastapi (>=0.111.0)", "nest-asyncio", "pyspark (==3.3.2)", "pyyaml (>=5.4.1,<7)", "sagemaker-feature-store-pyspark-3-3", "sagemaker-schema-inference-artifacts (>=0.0.5)", "scipy (==1.10.1)", "urllib3 (>=1.26.8,<3.0.0)", "uvicorn (>=0.30.1)"]
+feature-processor = ["pyspark (==3.3.2)", "sagemaker-feature-store-pyspark-3-3"]
huggingface = ["accelerate (>=0.24.1,<=0.27.0)", "fastapi (>=0.111.0)", "nest-asyncio", "sagemaker-schema-inference-artifacts (>=0.0.5)", "uvicorn (>=0.30.1)"]
local = ["docker (>=5.0.2,<8.0.0)", "pyyaml (>=5.4.1,<7)", "urllib3 (>=1.26.8,<3.0.0)"]
scipy = ["scipy (==1.10.1)"]
-test = ["accelerate (>=0.24.1,<=0.27.0)", "apache-airflow (==2.9.3)", "apache-airflow-providers-amazon (==7.2.1)", "attrs (>=23.1.0,<24)", "awslogs (==0.14.0)", "black (==24.3.0)", "build[virtualenv] (==1.2.1)", "cloudpickle (==2.2.1)", "contextlib2 (==21.6.0)", "coverage (>=5.2,<6.2)", "docker (>=5.0.2,<8.0.0)", "fabric (==2.6.0)", "fastapi (>=0.111.0)", "flake8 (==4.0.1)", "huggingface-hub (>=0.23.4)", "jinja2 (==3.1.4)", "mlflow (>=2.12.2,<2.13)", "mock (==4.0.3)", "nbformat (>=5.9,<6)", "nest-asyncio", "numpy (>=1.24.0)", "onnx (>=1.15.0)", "pandas (>=1.3.5,<1.5)", "pillow (>=10.0.1,<=11)", "pyspark (==3.3.1)", "pytest (==6.2.5)", "pytest-cov (==3.0.0)", "pytest-rerunfailures (==10.2)", "pytest-timeout (==2.1.0)", "pytest-xdist (==2.4.0)", "pyvis (==0.2.1)", "pyyaml (==6.0)", "pyyaml (>=5.4.1,<7)", "requests (==2.32.2)", "sagemaker-experiments (==0.1.35)", "sagemaker-feature-store-pyspark-3-3", "sagemaker-schema-inference-artifacts (>=0.0.5)", "schema (==0.7.5)", "scikit-learn (==1.3.0)", "scipy (==1.10.1)", "stopit (==1.1.2)", "tensorflow (>=2.1,<=2.16)", "tox (==3.24.5)", "tritonclient[http] (<2.37.0)", "urllib3 (>=1.26.8,<3.0.0)", "uvicorn (>=0.30.1)", "xgboost (>=1.6.2,<=1.7.6)"]
+test = ["accelerate (>=0.24.1,<=0.27.0)", "apache-airflow (==2.9.3)", "apache-airflow-providers-amazon (==7.2.1)", "attrs (>=23.1.0,<24)", "awslogs (==0.14.0)", "black (==24.3.0)", "build[virtualenv] (==1.2.1)", "cloudpickle (>=2.2.1)", "contextlib2 (==21.6.0)", "coverage (>=5.2,<6.2)", "docker (>=5.0.2,<8.0.0)", "fabric (==2.6.0)", "fastapi (>=0.111.0)", "flake8 (==4.0.1)", "huggingface-hub (>=0.23.4)", "jinja2 (==3.1.4)", "mlflow (>=2.12.2,<2.13)", "mock (==4.0.3)", "nbformat (>=5.9,<6)", "nest-asyncio", "numpy (>=1.24.0)", "onnx (>=1.15.0)", "pandas (>=1.3.5,<1.5)", "pillow (>=10.0.1,<=11)", "pyspark (==3.3.2)", "pytest (==6.2.5)", "pytest-cov (==3.0.0)", "pytest-rerunfailures (==10.2)", "pytest-timeout (==2.1.0)", "pytest-xdist (==2.4.0)", "pyvis (==0.2.1)", "pyyaml (==6.0)", "pyyaml (>=5.4.1,<7)", "requests (==2.32.2)", "sagemaker-experiments (==0.1.35)", "sagemaker-feature-store-pyspark-3-3", "sagemaker-schema-inference-artifacts (>=0.0.5)", "schema (==0.7.5)", "scikit-learn (==1.3.0)", "scipy (==1.10.1)", "stopit (==1.1.2)", "tensorflow (>=2.1,<=2.16)", "tox (==3.24.5)", "tritonclient[http] (<2.37.0)", "urllib3 (>=1.26.8,<3.0.0)", "uvicorn (>=0.30.1)", "xgboost (>=1.6.2,<=1.7.6)"]
[[package]]
name = "sagemaker-core"
-version = "1.0.10"
+version = "1.0.11"
description = "An python package for sagemaker core functionalities"
optional = true
python-versions = ">=3.8"
files = [
- {file = "sagemaker_core-1.0.10-py3-none-any.whl", hash = "sha256:0bdcf6a467db988919cc6b6d0077f74871ee24c24adf7f759f9cb98460e08953"},
- {file = "sagemaker_core-1.0.10.tar.gz", hash = "sha256:6d34a9b6dc5e17e8bfffd1d0650726865779c92b3b8f1b59fc15d42061a0dd29"},
+ {file = "sagemaker_core-1.0.11-py3-none-any.whl", hash = "sha256:d8ee3db83759073aa8c9f2bd4899113088a7c2acf340597e76cf9934e384d915"},
+ {file = "sagemaker_core-1.0.11.tar.gz", hash = "sha256:fb48a5dcb859a54de7461c71cf58562a3be259294dcd39c317020a9b018f5016"},
]
[package.dependencies]
diff --git a/pyproject.toml b/pyproject.toml
index 15da59a41..0664f1e8e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cohere"
-version = "5.11.2"
+version = "5.11.3"
description = ""
readme = "README.md"
authors = []
diff --git a/reference.md b/reference.md
index f1b6b9cb2..3721861a7 100644
--- a/reference.md
+++ b/reference.md
@@ -2319,7 +2319,7 @@ client.check_api_key()
-
-Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
+Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.
@@ -2599,7 +2599,7 @@ Defaults to `0.75`. min value of `0.01`, max value of `0.99`.
-
-Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
+Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.
diff --git a/src/cohere/__init__.py b/src/cohere/__init__.py
index bbccc3a17..d68434c9f 100644
--- a/src/cohere/__init__.py
+++ b/src/cohere/__init__.py
@@ -25,6 +25,7 @@
ChatContentStartEventDeltaMessage,
ChatContentStartEventDeltaMessageContent,
ChatDataMetrics,
+ ChatDebugEvent,
ChatDocument,
ChatFinishReason,
ChatMessage,
@@ -104,6 +105,7 @@
DatasetPart,
DatasetType,
DatasetValidationStatus,
+ DebugStreamedChatResponse,
DeleteConnectorResponse,
DetokenizeResponse,
Document,
@@ -297,6 +299,7 @@
"ChatContentStartEventDeltaMessage",
"ChatContentStartEventDeltaMessageContent",
"ChatDataMetrics",
+ "ChatDebugEvent",
"ChatDocument",
"ChatFinishReason",
"ChatMessage",
@@ -386,6 +389,7 @@
"DatasetsGetResponse",
"DatasetsGetUsageResponse",
"DatasetsListResponse",
+ "DebugStreamedChatResponse",
"DeleteConnectorResponse",
"DetokenizeResponse",
"Document",
diff --git a/src/cohere/core/client_wrapper.py b/src/cohere/core/client_wrapper.py
index 06b6665a7..bb3170c91 100644
--- a/src/cohere/core/client_wrapper.py
+++ b/src/cohere/core/client_wrapper.py
@@ -24,7 +24,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "cohere",
- "X-Fern-SDK-Version": "5.11.2",
+ "X-Fern-SDK-Version": "5.11.3",
}
if self._client_name is not None:
headers["X-Client-Name"] = self._client_name
diff --git a/src/cohere/types/__init__.py b/src/cohere/types/__init__.py
index feccf79b6..ff1227cf0 100644
--- a/src/cohere/types/__init__.py
+++ b/src/cohere/types/__init__.py
@@ -26,6 +26,7 @@
from .chat_content_start_event_delta_message import ChatContentStartEventDeltaMessage
from .chat_content_start_event_delta_message_content import ChatContentStartEventDeltaMessageContent
from .chat_data_metrics import ChatDataMetrics
+from .chat_debug_event import ChatDebugEvent
from .chat_document import ChatDocument
from .chat_finish_reason import ChatFinishReason
from .chat_message import ChatMessage
@@ -110,6 +111,7 @@
from .detokenize_response import DetokenizeResponse
from .document import Document
from .document_content import DocumentContent
+from .document_source import DocumentSource
from .embed_by_type_response import EmbedByTypeResponse
from .embed_by_type_response_embeddings import EmbedByTypeResponseEmbeddings
from .embed_floats_response import EmbedFloatsResponse
@@ -170,6 +172,7 @@
from .source import DocumentSource, Source, ToolSource
from .streamed_chat_response import (
CitationGenerationStreamedChatResponse,
+ DebugStreamedChatResponse,
SearchQueriesGenerationStreamedChatResponse,
SearchResultsStreamedChatResponse,
StreamEndStreamedChatResponse,
@@ -197,8 +200,12 @@
from .summarize_request_format import SummarizeRequestFormat
from .summarize_request_length import SummarizeRequestLength
from .summarize_response import SummarizeResponse
+from .system_message import SystemMessage
from .system_message_content import SystemMessageContent
from .system_message_content_item import SystemMessageContentItem, TextSystemMessageContentItem
+from .text_content import TextContent
+from .text_response_format import TextResponseFormat
+from .text_response_format_v2 import TextResponseFormatV2
from .tokenize_response import TokenizeResponse
from .too_many_requests_error_body import TooManyRequestsErrorBody
from .tool import Tool
@@ -207,10 +214,12 @@
from .tool_call_v2 import ToolCallV2
from .tool_call_v2function import ToolCallV2Function
from .tool_content import DocumentToolContent, TextToolContent, ToolContent
+from .tool_message import ToolMessage
from .tool_message_v2 import ToolMessageV2
from .tool_message_v2content import ToolMessageV2Content
from .tool_parameter_definitions_value import ToolParameterDefinitionsValue
from .tool_result import ToolResult
+from .tool_source import ToolSource
from .tool_v2 import ToolV2
from .tool_v2function import ToolV2Function
from .unprocessable_entity_error_body import UnprocessableEntityErrorBody
@@ -218,6 +227,7 @@
from .usage import Usage
from .usage_billed_units import UsageBilledUnits
from .usage_tokens import UsageTokens
+from .user_message import UserMessage
from .user_message_content import UserMessageContent
__all__ = [
@@ -245,6 +255,7 @@
"ChatContentStartEventDeltaMessage",
"ChatContentStartEventDeltaMessageContent",
"ChatDataMetrics",
+ "ChatDebugEvent",
"ChatDocument",
"ChatFinishReason",
"ChatMessage",
@@ -324,6 +335,7 @@
"DatasetPart",
"DatasetType",
"DatasetValidationStatus",
+ "DebugStreamedChatResponse",
"DeleteConnectorResponse",
"DetokenizeResponse",
"Document",
diff --git a/src/cohere/types/chat_debug_event.py b/src/cohere/types/chat_debug_event.py
new file mode 100644
index 000000000..26ae58212
--- /dev/null
+++ b/src/cohere/types/chat_debug_event.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from .chat_stream_event import ChatStreamEvent
+import typing
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+import pydantic
+
+
+class ChatDebugEvent(ChatStreamEvent):
+ prompt: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/cohere/types/streamed_chat_response.py b/src/cohere/types/streamed_chat_response.py
index f197f1c53..aa433c981 100644
--- a/src/cohere/types/streamed_chat_response.py
+++ b/src/cohere/types/streamed_chat_response.py
@@ -157,6 +157,23 @@ class Config:
extra = pydantic.Extra.allow
+class DebugStreamedChatResponse(UncheckedBaseModel):
+ """
+ StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request).
+ """
+
+ event_type: typing.Literal["debug"] = "debug"
+ prompt: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
StreamedChatResponse = typing_extensions.Annotated[
typing.Union[
StreamStartStreamedChatResponse,
@@ -167,6 +184,7 @@ class Config:
ToolCallsGenerationStreamedChatResponse,
StreamEndStreamedChatResponse,
ToolCallsChunkStreamedChatResponse,
+ DebugStreamedChatResponse,
],
UnionMetadata(discriminant="event_type"),
]
diff --git a/src/cohere/v2/client.py b/src/cohere/v2/client.py
index 3e12d7af9..1adddc1a5 100644
--- a/src/cohere/v2/client.py
+++ b/src/cohere/v2/client.py
@@ -73,7 +73,7 @@ def chat_stream(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Iterator[StreamedChatResponseV2]:
"""
- Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
+ Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.
@@ -401,7 +401,7 @@ def chat(
request_options: typing.Optional[RequestOptions] = None,
) -> ChatResponse:
"""
- Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
+ Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.
@@ -1124,7 +1124,7 @@ async def chat_stream(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.AsyncIterator[StreamedChatResponseV2]:
"""
- Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
+ Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.
@@ -1460,7 +1460,7 @@ async def chat(
request_options: typing.Optional[RequestOptions] = None,
) -> ChatResponse:
"""
- Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
+ Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).
Follow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.