Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 39 additions & 44 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "cohere"

[tool.poetry]
name = "cohere"
version = "5.17.0"
version = "6.0.0"
description = ""
readme = "README.md"
authors = []
Expand Down
2 changes: 2 additions & 0 deletions src/cohere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
ChatTextGenerationEvent,
ChatTextResponseFormat,
ChatTextResponseFormatV2,
ChatThinkingContent,
ChatToolCallDeltaEvent,
ChatToolCallDeltaEventDelta,
ChatToolCallDeltaEventDeltaMessage,
Expand Down Expand Up @@ -364,6 +365,7 @@
"ChatTextGenerationEvent",
"ChatTextResponseFormat",
"ChatTextResponseFormatV2",
"ChatThinkingContent",
"ChatToolCallDeltaEvent",
"ChatToolCallDeltaEventDelta",
"ChatToolCallDeltaEventDeltaMessage",
Expand Down
4 changes: 2 additions & 2 deletions src/cohere/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def __init__(

def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"User-Agent": "cohere/5.17.0",
"User-Agent": "cohere/6.0.0",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "cohere",
"X-Fern-SDK-Version": "5.17.0",
"X-Fern-SDK-Version": "6.0.0",
}
if self._client_name is not None:
headers["X-Client-Name"] = self._client_name
Expand Down
2 changes: 2 additions & 0 deletions src/cohere/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
from .chat_text_generation_event import ChatTextGenerationEvent
from .chat_text_response_format import ChatTextResponseFormat
from .chat_text_response_format_v2 import ChatTextResponseFormatV2
from .chat_thinking_content import ChatThinkingContent
from .chat_tool_call_delta_event import ChatToolCallDeltaEvent
from .chat_tool_call_delta_event_delta import ChatToolCallDeltaEventDelta
from .chat_tool_call_delta_event_delta_message import ChatToolCallDeltaEventDeltaMessage
Expand Down Expand Up @@ -289,6 +290,7 @@
"ChatTextGenerationEvent",
"ChatTextResponseFormat",
"ChatTextResponseFormatV2",
"ChatThinkingContent",
"ChatToolCallDeltaEvent",
"ChatToolCallDeltaEventDelta",
"ChatToolCallDeltaEventDeltaMessage",
Expand Down
7 changes: 5 additions & 2 deletions src/cohere/types/assistant_message_response_content_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ class Config:


class ThinkingAssistantMessageResponseContentItem(UncheckedBaseModel):
value: typing.Optional[typing.Any] = None
type: typing.Literal["thinking"] = "thinking"
thinking: str

if not IS_PYDANTIC_V2:
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


AssistantMessageResponseContentItem = typing_extensions.Annotated[
Expand Down
7 changes: 5 additions & 2 deletions src/cohere/types/assistant_message_v2content_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ class Config:


class ThinkingAssistantMessageV2ContentItem(UncheckedBaseModel):
value: typing.Optional[typing.Any] = None
type: typing.Literal["thinking"] = "thinking"
thinking: str

if not IS_PYDANTIC_V2:
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


AssistantMessageV2ContentItem = typing_extensions.Annotated[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


class ChatContentStartEventDeltaMessageContent(UncheckedBaseModel):
thinking: typing.Optional[str] = None
text: typing.Optional[str] = None
type: typing.Optional[ChatContentStartEventDeltaMessageContentType] = None

Expand Down
23 changes: 23 additions & 0 deletions src/cohere/types/chat_thinking_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel


class ChatThinkingContent(UncheckedBaseModel):
"""
Thinking content of the message. This will be present when `thinking` is enabled, and will contain the models internal reasoning.
"""

thinking: str

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
5 changes: 5 additions & 0 deletions src/cohere/types/embed_by_type_response_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class EmbedByTypeResponseEmbeddings(UncheckedBaseModel):
An array of packed unsigned binary embeddings. The length of each binary embedding is 1/8 the length of the float embeddings of the provided model. Each value is between 0 and 255.
"""

base64: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
"""
An array of base64 embeddings. Each string is the result of appending the float embedding bytes together and base64 encoding that.
"""

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2
else:
Expand Down
2 changes: 1 addition & 1 deletion src/cohere/types/embedding_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

import typing

EmbeddingType = typing.Union[typing.Literal["float", "int8", "uint8", "binary", "ubinary"], typing.Any]
EmbeddingType = typing.Union[typing.Literal["float", "int8", "uint8", "binary", "ubinary", "base64"], typing.Any]
10 changes: 6 additions & 4 deletions src/cohere/types/thinking.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

class Thinking(UncheckedBaseModel):
"""
Thinking gives the model enhanced reasoning capabilities for complex tasks, while also providing transparency into its step-by-step thought process before it delivers its final answer.
When thinking is turned on, the model creates thinking content blocks where it outputs its internal reasoning. The model will incorporate insights from this reasoning before crafting a final response.
When thinking is used without tools, the API response will include both thinking and text content blocks. Meanwhile, when thinking is used alongside tools and the model makes tool calls, the API response will include the thinking content block and `tool_calls`.
Configuration for [reasoning features](https://docs.cohere.com/docs/reasoning).
"""

type: ThinkingType = pydantic.Field()
"""
Reasoning is enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
"""

type: ThinkingType
token_budget: typing.Optional[int] = pydantic.Field(default=None)
"""
The maximum number of tokens the model can use for thinking, which must be set to a positive integer.
Expand Down
2 changes: 2 additions & 0 deletions src/cohere/v2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ def embed(
* `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.
* `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.
* `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models.
* `"base64"`: Use this when you want to get back base64 embeddings. Supported with Embed v3.0 and newer Embed models.

truncate : typing.Optional[V2EmbedRequestTruncate]
One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.
Expand Down Expand Up @@ -996,6 +997,7 @@ async def embed(
* `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.
* `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.
* `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models.
* `"base64"`: Use this when you want to get back base64 embeddings. Supported with Embed v3.0 and newer Embed models.

truncate : typing.Optional[V2EmbedRequestTruncate]
One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.
Expand Down
Loading