Skip to content

feat:Update Cohere embed endpoints to support flexible input and new parameters #175

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
Apr 15, 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
16 changes: 16 additions & 0 deletions src/libs/Cohere/Generated/Cohere.CohereClient.Embedv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ partial void ProcessEmbedv2ResponseContent(
/// - `"clustering"`: Used for the embeddings run through a clustering algorithm.<br/>
/// - `"image"`: Used for embeddings with image input.
/// </param>
/// <param name="inputs">
/// An array of inputs for the model to embed. Maximum number of inputs per call is `96`. An input can contain a mix of text and image components.
/// </param>
/// <param name="maxTokens">
/// The maximum number of tokens to embed per input. If the input text is longer than this, it will be truncated according to the `truncate` parameter.
/// </param>
/// <param name="model">
/// Defaults to embed-english-v2.0<br/>
/// The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID.<br/>
Expand All @@ -557,6 +563,10 @@ partial void ProcessEmbedv2ResponseContent(
/// * `embed-multilingual-v2.0` 768<br/>
/// Included only in requests
/// </param>
/// <param name="outputDimension">
/// The number of dimensions of the output embedding. This is only available for `embed-v4` and newer models.<br/>
/// Possible values are `256`, `512`, `1024`, and `1536`. The default is `1536`.
/// </param>
/// <param name="texts">
/// An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality.<br/>
/// Included only in requests
Expand All @@ -578,14 +588,20 @@ partial void ProcessEmbedv2ResponseContent(
global::Cohere.Embedv2RequestTruncate truncate,
string? xClientName = default,
global::System.Collections.Generic.IList<string>? images = default,
global::System.Collections.Generic.IList<global::Cohere.EmbedInput>? inputs = default,
int? maxTokens = default,
int? outputDimension = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::Cohere.Embedv2Request
{
EmbeddingTypes = embeddingTypes,
Images = images,
InputType = inputType,
Inputs = inputs,
MaxTokens = maxTokens,
Model = model,
OutputDimension = outputDimension,
Texts = texts,
Truncate = truncate,
};
Expand Down
13 changes: 13 additions & 0 deletions src/libs/Cohere/Generated/Cohere.ICohereClient.Embedv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public partial interface ICohereClient
/// - `"clustering"`: Used for the embeddings run through a clustering algorithm.<br/>
/// - `"image"`: Used for embeddings with image input.
/// </param>
/// <param name="inputs">
/// An array of inputs for the model to embed. Maximum number of inputs per call is `96`. An input can contain a mix of text and image components.
/// </param>
/// <param name="maxTokens">
/// The maximum number of tokens to embed per input. If the input text is longer than this, it will be truncated according to the `truncate` parameter.
/// </param>
/// <param name="model">
/// Defaults to embed-english-v2.0<br/>
/// The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID.<br/>
Expand All @@ -60,6 +66,10 @@ public partial interface ICohereClient
/// * `embed-multilingual-v2.0` 768<br/>
/// Included only in requests
/// </param>
/// <param name="outputDimension">
/// The number of dimensions of the output embedding. This is only available for `embed-v4` and newer models.<br/>
/// Possible values are `256`, `512`, `1024`, and `1536`. The default is `1536`.
/// </param>
/// <param name="texts">
/// An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality.<br/>
/// Included only in requests
Expand All @@ -81,6 +91,9 @@ public partial interface ICohereClient
global::Cohere.Embedv2RequestTruncate truncate,
string? xClientName = default,
global::System.Collections.Generic.IList<string>? images = default,
global::System.Collections.Generic.IList<global::Cohere.EmbedInput>? inputs = default,
int? maxTokens = default,
int? outputDimension = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
4 changes: 2 additions & 2 deletions src/libs/Cohere/Generated/Cohere.Models.EmbedContent.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Cohere
public global::Cohere.EmbedContentDiscriminatorType? Type { get; }

/// <summary>
///
/// Image content of the input.
/// </summary>
#if NET6_0_OR_GREATER
public global::Cohere.EmbedImage? ImageUrl { get; init; }
Expand Down Expand Up @@ -50,7 +50,7 @@ public EmbedContent(global::Cohere.EmbedImage? value)
}

/// <summary>
///
/// Text content of the input.
/// </summary>
#if NET6_0_OR_GREATER
public global::Cohere.EmbedText? Text { get; init; }
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.Models.EmbedImage.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Cohere
{
/// <summary>
///
/// Image content of the input.
/// </summary>
public sealed partial class EmbedImage
{
Expand Down
6 changes: 4 additions & 2 deletions src/libs/Cohere/Generated/Cohere.Models.EmbedInput.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Cohere
public sealed partial class EmbedInput
{
/// <summary>
///
/// An array of objects containing the input data for the model to embed.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("content")]
[global::System.Text.Json.Serialization.JsonRequired]
Expand All @@ -24,7 +24,9 @@ public sealed partial class EmbedInput
/// <summary>
/// Initializes a new instance of the <see cref="EmbedInput" /> class.
/// </summary>
/// <param name="content"></param>
/// <param name="content">
/// An array of objects containing the input data for the model to embed.
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.Models.EmbedText.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Cohere
{
/// <summary>
///
/// Text content of the input.
/// </summary>
public sealed partial class EmbedText
{
Expand Down
35 changes: 35 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.Embedv2Request.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public sealed partial class Embedv2Request
[global::System.Text.Json.Serialization.JsonRequired]
public required global::Cohere.EmbedInputType InputType { get; set; }

/// <summary>
/// An array of inputs for the model to embed. Maximum number of inputs per call is `96`. An input can contain a mix of text and image components.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("inputs")]
public global::System.Collections.Generic.IList<global::Cohere.EmbedInput>? Inputs { get; set; }

/// <summary>
/// The maximum number of tokens to embed per input. If the input text is longer than this, it will be truncated according to the `truncate` parameter.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("max_tokens")]
public int? MaxTokens { get; set; }

/// <summary>
/// Defaults to embed-english-v2.0<br/>
/// The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID.<br/>
Expand All @@ -56,6 +68,13 @@ public sealed partial class Embedv2Request
[global::System.Text.Json.Serialization.JsonPropertyName("model")]
public string? Model { get; set; }

/// <summary>
/// The number of dimensions of the output embedding. This is only available for `embed-v4` and newer models.<br/>
/// Possible values are `256`, `512`, `1024`, and `1536`. The default is `1536`.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("output_dimension")]
public int? OutputDimension { get; set; }

/// <summary>
/// An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality.<br/>
/// Included only in requests
Expand Down Expand Up @@ -104,6 +123,12 @@ public sealed partial class Embedv2Request
/// - `"clustering"`: Used for the embeddings run through a clustering algorithm.<br/>
/// - `"image"`: Used for embeddings with image input.
/// </param>
/// <param name="inputs">
/// An array of inputs for the model to embed. Maximum number of inputs per call is `96`. An input can contain a mix of text and image components.
/// </param>
/// <param name="maxTokens">
/// The maximum number of tokens to embed per input. If the input text is longer than this, it will be truncated according to the `truncate` parameter.
/// </param>
/// <param name="model">
/// Defaults to embed-english-v2.0<br/>
/// The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](https://docs.cohere.com/docs/training-custom-models) can also be supplied with their full ID.<br/>
Expand All @@ -117,6 +142,10 @@ public sealed partial class Embedv2Request
/// * `embed-multilingual-v2.0` 768<br/>
/// Included only in requests
/// </param>
/// <param name="outputDimension">
/// The number of dimensions of the output embedding. This is only available for `embed-v4` and newer models.<br/>
/// Possible values are `256`, `512`, `1024`, and `1536`. The default is `1536`.
/// </param>
/// <param name="texts">
/// An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality.<br/>
/// Included only in requests
Expand All @@ -135,14 +164,20 @@ public Embedv2Request(
global::Cohere.EmbedInputType inputType,
global::System.Collections.Generic.IList<global::Cohere.EmbeddingType>? embeddingTypes,
global::System.Collections.Generic.IList<string>? images,
global::System.Collections.Generic.IList<global::Cohere.EmbedInput>? inputs,
int? maxTokens,
string? model,
int? outputDimension,
global::System.Collections.Generic.IList<string>? texts,
global::Cohere.Embedv2RequestTruncate? truncate)
{
this.InputType = inputType;
this.EmbeddingTypes = embeddingTypes;
this.Images = images;
this.Inputs = inputs;
this.MaxTokens = maxTokens;
this.Model = model;
this.OutputDimension = outputDimension;
this.Texts = texts;
this.Truncate = truncate;
}
Expand Down
Loading
Loading