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
144 changes: 71 additions & 73 deletions poetry.lock

Large diffs are not rendered by default.

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.16.1"
version = "5.16.2"
description = ""
readme = "README.md"
authors = []
Expand Down
26 changes: 4 additions & 22 deletions src/cohere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
ChatContentStartEventDelta,
ChatContentStartEventDeltaMessage,
ChatContentStartEventDeltaMessageContent,
ChatContentStartEventDeltaMessageContentType,
ChatDataMetrics,
ChatDebugEvent,
ChatDocument,
Expand Down Expand Up @@ -205,6 +206,7 @@
TextResponseFormatV2,
TextSystemMessageV2ContentItem,
TextToolContent,
ThinkingAssistantMessageResponseContentItem,
TokenizeResponse,
Tool,
ToolCall,
Expand Down Expand Up @@ -247,18 +249,6 @@
UnprocessableEntityError,
)
from . import connectors, datasets, embed_jobs, finetuning, models, v2
from .aliases import (
ChatResponse,
ContentDeltaStreamedChatResponseV2,
ContentEndStreamedChatResponseV2,
ContentStartStreamedChatResponseV2,
MessageEndStreamedChatResponseV2,
MessageStartStreamedChatResponseV2,
StreamedChatResponseV2,
ToolCallDeltaStreamedChatResponseV2,
ToolCallEndStreamedChatResponseV2,
ToolCallStartStreamedChatResponseV2,
)
from .aws_client import AwsClient
from .bedrock_client import BedrockClient, BedrockClientV2
from .client import AsyncClient, Client
Expand Down Expand Up @@ -325,6 +315,7 @@
"ChatContentStartEventDelta",
"ChatContentStartEventDeltaMessage",
"ChatContentStartEventDeltaMessageContent",
"ChatContentStartEventDeltaMessageContentType",
"ChatDataMetrics",
"ChatDebugEvent",
"ChatDocument",
Expand All @@ -341,7 +332,6 @@
"ChatRequestCitationQuality",
"ChatRequestPromptTruncation",
"ChatRequestSafetyMode",
"ChatResponse",
"ChatSearchQueriesGenerationEvent",
"ChatSearchQuery",
"ChatSearchResult",
Expand Down Expand Up @@ -404,11 +394,8 @@
"ConnectorAuthStatus",
"ConnectorOAuth",
"Content",
"ContentDeltaStreamedChatResponseV2",
"ContentDeltaV2ChatStreamResponse",
"ContentEndStreamedChatResponseV2",
"ContentEndV2ChatStreamResponse",
"ContentStartStreamedChatResponseV2",
"ContentStartV2ChatStreamResponse",
"CreateConnectorOAuth",
"CreateConnectorResponse",
Expand Down Expand Up @@ -483,9 +470,7 @@
"ListModelsResponse",
"LogprobItem",
"Message",
"MessageEndStreamedChatResponseV2",
"MessageEndV2ChatStreamResponse",
"MessageStartStreamedChatResponseV2",
"MessageStartV2ChatStreamResponse",
"Metrics",
"NonStreamedChatResponse",
Expand Down Expand Up @@ -516,7 +501,6 @@
"StreamErrorGenerateStreamedResponse",
"StreamStartStreamedChatResponse",
"StreamedChatResponse",
"StreamedChatResponseV2",
"SummarizeRequestExtractiveness",
"SummarizeRequestFormat",
"SummarizeRequestLength",
Expand All @@ -536,16 +520,14 @@
"TextResponseFormatV2",
"TextSystemMessageV2ContentItem",
"TextToolContent",
"ThinkingAssistantMessageResponseContentItem",
"TokenizeResponse",
"TooManyRequestsError",
"Tool",
"ToolCall",
"ToolCallDelta",
"ToolCallDeltaStreamedChatResponseV2",
"ToolCallDeltaV2ChatStreamResponse",
"ToolCallEndStreamedChatResponseV2",
"ToolCallEndV2ChatStreamResponse",
"ToolCallStartStreamedChatResponseV2",
"ToolCallStartV2ChatStreamResponse",
"ToolCallV2",
"ToolCallV2Function",
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.16.1",
"User-Agent": "cohere/5.16.2",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "cohere",
"X-Fern-SDK-Version": "5.16.1",
"X-Fern-SDK-Version": "5.16.2",
}
if self._client_name is not None:
headers["X-Client-Name"] = self._client_name
Expand Down
38 changes: 38 additions & 0 deletions src/cohere/finetuning/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def list_finetuned_models(
request_options: typing.Optional[RequestOptions] = None,
) -> ListFinetunedModelsResponse:
"""
Returns a list of fine-tuned models that the user has access to.

Parameters
----------
page_size : typing.Optional[int]
Expand Down Expand Up @@ -88,6 +90,8 @@ def create_finetuned_model(
self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None
) -> CreateFinetunedModelResponse:
"""
Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete.

Parameters
----------
request : FinetunedModel
Expand Down Expand Up @@ -128,6 +132,8 @@ def get_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetFinetunedModelResponse:
"""
Retrieve a fine-tuned model by its ID.

Parameters
----------
id : str
Expand Down Expand Up @@ -160,6 +166,9 @@ def delete_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> DeleteFinetunedModelResponse:
"""
Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use.
This operation is irreversible.

Parameters
----------
id : str
Expand Down Expand Up @@ -198,6 +207,8 @@ def update_finetuned_model(
request_options: typing.Optional[RequestOptions] = None,
) -> UpdateFinetunedModelResponse:
"""
Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body.

Parameters
----------
id : str
Expand Down Expand Up @@ -255,6 +266,10 @@ def list_events(
request_options: typing.Optional[RequestOptions] = None,
) -> ListEventsResponse:
"""
Returns a list of events that occurred during the life-cycle of the fine-tuned model.
The events are ordered by creation time, with the most recent event first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down Expand Up @@ -313,6 +328,10 @@ def list_training_step_metrics(
request_options: typing.Optional[RequestOptions] = None,
) -> ListTrainingStepMetricsResponse:
"""
Returns a list of metrics measured during the training of a fine-tuned model.
The metrics are ordered by step number, with the most recent step first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down Expand Up @@ -375,6 +394,8 @@ async def list_finetuned_models(
request_options: typing.Optional[RequestOptions] = None,
) -> ListFinetunedModelsResponse:
"""
Returns a list of fine-tuned models that the user has access to.

Parameters
----------
page_size : typing.Optional[int]
Expand Down Expand Up @@ -427,6 +448,8 @@ async def create_finetuned_model(
self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None
) -> CreateFinetunedModelResponse:
"""
Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete.

Parameters
----------
request : FinetunedModel
Expand Down Expand Up @@ -475,6 +498,8 @@ async def get_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetFinetunedModelResponse:
"""
Retrieve a fine-tuned model by its ID.

Parameters
----------
id : str
Expand Down Expand Up @@ -515,6 +540,9 @@ async def delete_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> DeleteFinetunedModelResponse:
"""
Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use.
This operation is irreversible.

Parameters
----------
id : str
Expand Down Expand Up @@ -561,6 +589,8 @@ async def update_finetuned_model(
request_options: typing.Optional[RequestOptions] = None,
) -> UpdateFinetunedModelResponse:
"""
Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body.

Parameters
----------
id : str
Expand Down Expand Up @@ -626,6 +656,10 @@ async def list_events(
request_options: typing.Optional[RequestOptions] = None,
) -> ListEventsResponse:
"""
Returns a list of events that occurred during the life-cycle of the fine-tuned model.
The events are ordered by creation time, with the most recent event first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down Expand Up @@ -692,6 +726,10 @@ async def list_training_step_metrics(
request_options: typing.Optional[RequestOptions] = None,
) -> ListTrainingStepMetricsResponse:
"""
Returns a list of metrics measured during the training of a fine-tuned model.
The metrics are ordered by step number, with the most recent step first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down
38 changes: 38 additions & 0 deletions src/cohere/finetuning/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def list_finetuned_models(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[ListFinetunedModelsResponse]:
"""
Returns a list of fine-tuned models that the user has access to.

Parameters
----------
page_size : typing.Optional[int]
Expand Down Expand Up @@ -164,6 +166,8 @@ def create_finetuned_model(
self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[CreateFinetunedModelResponse]:
"""
Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete.

Parameters
----------
request : FinetunedModel
Expand Down Expand Up @@ -271,6 +275,8 @@ def get_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[GetFinetunedModelResponse]:
"""
Retrieve a fine-tuned model by its ID.

Parameters
----------
id : str
Expand Down Expand Up @@ -374,6 +380,9 @@ def delete_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[DeleteFinetunedModelResponse]:
"""
Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use.
This operation is irreversible.

Parameters
----------
id : str
Expand Down Expand Up @@ -483,6 +492,8 @@ def update_finetuned_model(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[UpdateFinetunedModelResponse]:
"""
Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body.

Parameters
----------
id : str
Expand Down Expand Up @@ -612,6 +623,10 @@ def list_events(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[ListEventsResponse]:
"""
Returns a list of events that occurred during the life-cycle of the fine-tuned model.
The events are ordered by creation time, with the most recent event first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down Expand Up @@ -740,6 +755,10 @@ def list_training_step_metrics(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[ListTrainingStepMetricsResponse]:
"""
Returns a list of metrics measured during the training of a fine-tuned model.
The metrics are ordered by step number, with the most recent step first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down Expand Up @@ -864,6 +883,8 @@ async def list_finetuned_models(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[ListFinetunedModelsResponse]:
"""
Returns a list of fine-tuned models that the user has access to.

Parameters
----------
page_size : typing.Optional[int]
Expand Down Expand Up @@ -984,6 +1005,8 @@ async def create_finetuned_model(
self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[CreateFinetunedModelResponse]:
"""
Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete.

Parameters
----------
request : FinetunedModel
Expand Down Expand Up @@ -1091,6 +1114,8 @@ async def get_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetFinetunedModelResponse]:
"""
Retrieve a fine-tuned model by its ID.

Parameters
----------
id : str
Expand Down Expand Up @@ -1194,6 +1219,9 @@ async def delete_finetuned_model(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[DeleteFinetunedModelResponse]:
"""
Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use.
This operation is irreversible.

Parameters
----------
id : str
Expand Down Expand Up @@ -1303,6 +1331,8 @@ async def update_finetuned_model(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[UpdateFinetunedModelResponse]:
"""
Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body.

Parameters
----------
id : str
Expand Down Expand Up @@ -1432,6 +1462,10 @@ async def list_events(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[ListEventsResponse]:
"""
Returns a list of events that occurred during the life-cycle of the fine-tuned model.
The events are ordered by creation time, with the most recent event first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down Expand Up @@ -1560,6 +1594,10 @@ async def list_training_step_metrics(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[ListTrainingStepMetricsResponse]:
"""
Returns a list of metrics measured during the training of a fine-tuned model.
The metrics are ordered by step number, with the most recent step first.
The list can be paginated using `page_size` and `page_token` parameters.

Parameters
----------
finetuned_model_id : str
Expand Down
Loading
Loading