Skip to content

feat:Add descriptions to /finetuning endpoints and support "thinking" chat type #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ partial void ProcessCreateFinetunedModelResponseContent(
ref string content);

/// <summary>
/// Trains and deploys a fine-tuned model.
/// Trains and deploys a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="xClientName"></param>
/// <param name="request"></param>
Expand Down Expand Up @@ -400,7 +401,8 @@ partial void ProcessCreateFinetunedModelResponseContent(
}

/// <summary>
/// Trains and deploys a fine-tuned model.
/// Trains and deploys a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="xClientName"></param>
/// <param name="name">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ partial void ProcessDeleteFinetunedModelResponseContent(
ref string content);

/// <summary>
/// Deletes a fine-tuned model.
/// Deletes a fine-tuned model.<br/>
/// Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use.<br/>
/// This operation is irreversible.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ partial void ProcessGetFinetunedModelResponseContent(
ref string content);

/// <summary>
/// Returns a fine-tuned model by ID.
/// Returns a fine-tuned model by ID.<br/>
/// Retrieve a fine-tuned model by its ID.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ partial void ProcessListEventsResponseContent(
ref string content);

/// <summary>
/// Retrieves the chronology of statuses the fine-tuned model has been through.
/// Retrieves the chronology of statuses the fine-tuned model has been through.<br/>
/// Returns a list of events that occurred during the life-cycle of the fine-tuned model.<br/>
/// The events are ordered by creation time, with the most recent event first.<br/>
/// The list can be paginated using `page_size` and `page_token` parameters.
/// </summary>
/// <param name="finetunedModelId"></param>
/// <param name="pageSize"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ partial void ProcessListFinetunedModelsResponseContent(
ref string content);

/// <summary>
/// Lists fine-tuned models.
/// Lists fine-tuned models.<br/>
/// Returns a list of fine-tuned models that the user has access to.
/// </summary>
/// <param name="pageSize"></param>
/// <param name="pageToken"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ partial void ProcessListTrainingStepMetricsResponseContent(
ref string content);

/// <summary>
/// Retrieves metrics measured during the training of a fine-tuned model.
/// Retrieves metrics measured during the training of a fine-tuned model.<br/>
/// Returns a list of metrics measured during the training of a fine-tuned model.<br/>
/// The metrics are ordered by step number, with the most recent step first.<br/>
/// The list can be paginated using `page_size` and `page_token` parameters.
/// </summary>
/// <param name="finetunedModelId"></param>
/// <param name="pageSize"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ partial void ProcessUpdateFinetunedModelResponseContent(
ref string content);

/// <summary>
/// Updates a fine-tuned model.
/// Updates a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand Down Expand Up @@ -406,7 +407,8 @@ partial void ProcessUpdateFinetunedModelResponseContent(
}

/// <summary>
/// Updates a fine-tuned model.
/// Updates a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Cohere
public partial interface IFinetuningClient
{
/// <summary>
/// Trains and deploys a fine-tuned model.
/// Trains and deploys a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="xClientName"></param>
/// <param name="request"></param>
Expand All @@ -17,7 +18,8 @@ public partial interface IFinetuningClient
global::System.Threading.CancellationToken cancellationToken = default);

/// <summary>
/// Trains and deploys a fine-tuned model.
/// Trains and deploys a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="xClientName"></param>
/// <param name="name">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ namespace Cohere
public partial interface IFinetuningClient
{
/// <summary>
/// Deletes a fine-tuned model.
/// Deletes a fine-tuned model.<br/>
/// Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use.<br/>
/// This operation is irreversible.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Cohere
public partial interface IFinetuningClient
{
/// <summary>
/// Returns a fine-tuned model by ID.
/// Returns a fine-tuned model by ID.<br/>
/// Retrieve a fine-tuned model by its ID.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ namespace Cohere
public partial interface IFinetuningClient
{
/// <summary>
/// Retrieves the chronology of statuses the fine-tuned model has been through.
/// Retrieves the chronology of statuses the fine-tuned model has been through.<br/>
/// Returns a list of events that occurred during the life-cycle of the fine-tuned model.<br/>
/// The events are ordered by creation time, with the most recent event first.<br/>
/// The list can be paginated using `page_size` and `page_token` parameters.
/// </summary>
/// <param name="finetunedModelId"></param>
/// <param name="pageSize"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Cohere
public partial interface IFinetuningClient
{
/// <summary>
/// Lists fine-tuned models.
/// Lists fine-tuned models.<br/>
/// Returns a list of fine-tuned models that the user has access to.
/// </summary>
/// <param name="pageSize"></param>
/// <param name="pageToken"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ namespace Cohere
public partial interface IFinetuningClient
{
/// <summary>
/// Retrieves metrics measured during the training of a fine-tuned model.
/// Retrieves metrics measured during the training of a fine-tuned model.<br/>
/// Returns a list of metrics measured during the training of a fine-tuned model.<br/>
/// The metrics are ordered by step number, with the most recent step first.<br/>
/// The list can be paginated using `page_size` and `page_token` parameters.
/// </summary>
/// <param name="finetunedModelId"></param>
/// <param name="pageSize"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Cohere
public partial interface IFinetuningClient
{
/// <summary>
/// Updates a fine-tuned model.
/// Updates a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand All @@ -19,7 +20,8 @@ public partial interface IFinetuningClient
global::System.Threading.CancellationToken cancellationToken = default);

/// <summary>
/// Updates a fine-tuned model.
/// Updates a fine-tuned model.<br/>
/// 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.
/// </summary>
/// <param name="id"></param>
/// <param name="xClientName"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public enum AssistantMessageResponseContentItemDiscriminatorType
///
/// </summary>
Text,
/// <summary>
///
/// </summary>
Thinking,
}

/// <summary>
Expand All @@ -27,6 +31,7 @@ public static string ToValueString(this AssistantMessageResponseContentItemDiscr
return value switch
{
AssistantMessageResponseContentItemDiscriminatorType.Text => "text",
AssistantMessageResponseContentItemDiscriminatorType.Thinking => "thinking",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
Expand All @@ -38,6 +43,7 @@ public static string ToValueString(this AssistantMessageResponseContentItemDiscr
return value switch
{
"text" => AssistantMessageResponseContentItemDiscriminatorType.Text,
"thinking" => AssistantMessageResponseContentItemDiscriminatorType.Thinking,
_ => null,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public enum ChatContentStartEventVariant2DeltaMessageContentType
///
/// </summary>
Text,
/// <summary>
///
/// </summary>
Thinking,
}

/// <summary>
Expand All @@ -27,6 +31,7 @@ public static string ToValueString(this ChatContentStartEventVariant2DeltaMessag
return value switch
{
ChatContentStartEventVariant2DeltaMessageContentType.Text => "text",
ChatContentStartEventVariant2DeltaMessageContentType.Thinking => "thinking",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
Expand All @@ -38,6 +43,7 @@ public static string ToValueString(this ChatContentStartEventVariant2DeltaMessag
return value switch
{
"text" => ChatContentStartEventVariant2DeltaMessageContentType.Text,
"thinking" => ChatContentStartEventVariant2DeltaMessageContentType.Thinking,
_ => null,
};
}
Expand Down
9 changes: 9 additions & 0 deletions src/libs/Cohere/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5684,6 +5684,7 @@ paths:
tags:
- /finetuning
summary: Lists fine-tuned models.
description: Returns a list of fine-tuned models that the user has access to.
operationId: ListFinetunedModels
parameters:
- name: page_size
Expand Down Expand Up @@ -5813,6 +5814,7 @@ paths:
tags:
- /finetuning
summary: Trains and deploys a fine-tuned model.
description: '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.'
operationId: CreateFinetunedModel
parameters:
- $ref: '#/components/parameters/RequestSource'
Expand Down Expand Up @@ -5901,6 +5903,7 @@ paths:
tags:
- /finetuning
summary: Retrieves the chronology of statuses the fine-tuned model has been through.
description: "Returns a list of events that occurred during the life-cycle of the fine-tuned model.\nThe events are ordered by creation time, with the most recent event first.\nThe list can be paginated using `page_size` and `page_token` parameters."
operationId: ListEvents
parameters:
- name: finetuned_model_id
Expand Down Expand Up @@ -6013,6 +6016,7 @@ paths:
tags:
- /finetuning
summary: Retrieves metrics measured during the training of a fine-tuned model.
description: "Returns a list of metrics measured during the training of a fine-tuned model.\nThe metrics are ordered by step number, with the most recent step first.\nThe list can be paginated using `page_size` and `page_token` parameters."
operationId: ListTrainingStepMetrics
parameters:
- name: finetuned_model_id
Expand Down Expand Up @@ -6123,6 +6127,7 @@ paths:
tags:
- /finetuning
summary: Deletes a fine-tuned model.
description: "Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use.\nThis operation is irreversible."
operationId: DeleteFinetunedModel
parameters:
- name: id
Expand Down Expand Up @@ -6203,6 +6208,7 @@ paths:
tags:
- /finetuning
summary: Returns a fine-tuned model by ID.
description: Retrieve a fine-tuned model by its ID.
operationId: GetFinetunedModel
parameters:
- name: id
Expand Down Expand Up @@ -6307,6 +6313,7 @@ paths:
tags:
- /finetuning
summary: Updates a fine-tuned model.
description: 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.
operationId: UpdateFinetunedModel
parameters:
- name: id
Expand Down Expand Up @@ -12357,6 +12364,7 @@ components:
propertyName: type
mapping:
text: '#/components/schemas/ChatTextContent'
thinking: '#/components/schemas/ChatThinkingContent'
Comment on lines 12364 to +12367
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

ChatThinkingContent schema is missing – spec will break
The discriminator now maps thinking to #/components/schemas/ChatThinkingContent, but that schema isn’t defined anywhere in the file. This makes the OpenAPI document invalid.

+    ChatThinkingContent:
+      type: object
+      description: Content representing the assistant’s chain-of-thought. **Not returned to the end user** unless explicitly requested.
+      properties:
+        type:
+          type: string
+          enum: [thinking]
+        text:
+          type: string
+      required: [type, text]

Add a proper schema (and possibly mark it readOnly: true or behind a feature flag) before merging.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around lines 12364 to 12367, the discriminator
mapping references a ChatThinkingContent schema that is not defined, causing the
OpenAPI spec to be invalid. Define the ChatThinkingContent schema in the
components/schemas section with appropriate properties, and consider marking it
as readOnly or gating it behind a feature flag as suggested. This will ensure
the spec is valid and the discriminator mapping works correctly.

role:
enum:
- assistant
Expand Down Expand Up @@ -12589,6 +12597,7 @@ components:
type:
enum:
- text
- thinking
type: string
x-fern-type-name: ChatContentStartEventDeltaMessageContent
x-fern-type-name: ChatContentStartEventDeltaMessage
Expand Down