Skip to content
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
1 change: 1 addition & 0 deletions src/libs/Cohere/Generated/Cohere.CohereClient.Embedv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ partial void ProcessEmbedv2ResponseContent(
/// * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"base64"`: Use this when you want to get back base64 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// Default Value: [float]<br/>
/// Included only in requests
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public partial interface ICohereClient
/// * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"base64"`: Use this when you want to get back base64 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// Default Value: [float]<br/>
/// Included only in requests
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ namespace Cohere
/// </summary>
public sealed partial class EmbedByTypeResponseEmbeddings
{
/// <summary>
/// An array of base64 embeddings. Each string is the result of appending the float embedding bytes together and base64 encoding that.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("base64")]
public global::System.Collections.Generic.IList<string>? Base64 { get; set; }

/// <summary>
/// An array of packed signed 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 -128 and 127.
/// </summary>
Expand Down Expand Up @@ -47,6 +53,9 @@ public sealed partial class EmbedByTypeResponseEmbeddings
/// <summary>
/// Initializes a new instance of the <see cref="EmbedByTypeResponseEmbeddings" /> class.
/// </summary>
/// <param name="base64">
/// An array of base64 embeddings. Each string is the result of appending the float embedding bytes together and base64 encoding that.
/// </param>
/// <param name="binary">
/// An array of packed signed 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 -128 and 127.
/// </param>
Expand All @@ -66,12 +75,14 @@ public sealed partial class EmbedByTypeResponseEmbeddings
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
public EmbedByTypeResponseEmbeddings(
global::System.Collections.Generic.IList<string>? base64,
global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<int>>? binary,
global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<double>>? @float,
global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<int>>? int8,
global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<int>>? ubinary,
global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<int>>? uint8)
{
this.Base64 = base64;
this.Binary = binary;
this.Float = @float;
this.Int8 = int8;
Expand Down
6 changes: 6 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.EmbeddingType.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public enum EmbeddingType
///
/// </summary>
Ubinary,
/// <summary>
///
/// </summary>
Base64,
}

/// <summary>
Expand All @@ -47,6 +51,7 @@ public static string ToValueString(this EmbeddingType value)
EmbeddingType.Uint8 => "uint8",
EmbeddingType.Binary => "binary",
EmbeddingType.Ubinary => "ubinary",
EmbeddingType.Base64 => "base64",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
Expand All @@ -62,6 +67,7 @@ public static string ToValueString(this EmbeddingType value)
"uint8" => EmbeddingType.Uint8,
"binary" => EmbeddingType.Binary,
"ubinary" => EmbeddingType.Ubinary,
"base64" => EmbeddingType.Base64,
_ => null,
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/libs/Cohere/Generated/Cohere.Models.Embedv2Request.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public sealed partial class Embedv2Request
/// * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"base64"`: Use this when you want to get back base64 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// Default Value: [float]<br/>
/// Included only in requests
/// </summary>
Expand Down Expand Up @@ -102,6 +103,7 @@ public sealed partial class Embedv2Request
/// * `"uint8"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"binary"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"ubinary"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// * `"base64"`: Use this when you want to get back base64 embeddings. Supported with Embed v3.0 and newer Embed models.<br/>
/// Default Value: [float]<br/>
/// Included only in requests
/// </param>
Expand Down
12 changes: 11 additions & 1 deletion src/libs/Cohere/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8861,7 +8861,7 @@ paths:
type: array
items:
$ref: '#/components/schemas/EmbeddingType'
description: "Specifies the types of embeddings you want to get back. Can be one or more of the following types.\n\n* `\"float\"`: Use this when you want to get back the default float embeddings. Supported with all Embed models.\n* `\"int8\"`: Use this when you want to get back signed int8 embeddings. Supported with Embed v3.0 and newer Embed models.\n* `\"uint8\"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.\n* `\"binary\"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.\n* `\"ubinary\"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models."
description: "Specifies the types of embeddings you want to get back. Can be one or more of the following types.\n\n* `\"float\"`: Use this when you want to get back the default float embeddings. Supported with all Embed models.\n* `\"int8\"`: Use this when you want to get back signed int8 embeddings. Supported with Embed v3.0 and newer Embed models.\n* `\"uint8\"`: Use this when you want to get back unsigned int8 embeddings. Supported with Embed v3.0 and newer Embed models.\n* `\"binary\"`: Use this when you want to get back signed binary embeddings. Supported with Embed v3.0 and newer Embed models.\n* `\"ubinary\"`: Use this when you want to get back unsigned binary embeddings. Supported with Embed v3.0 and newer Embed models.\n* `\"base64\"`: Use this when you want to get back base64 embeddings. Supported with Embed v3.0 and newer Embed models."
default:
- float
writeOnly: true
Expand Down Expand Up @@ -13937,6 +13937,15 @@ components:
x-fern-audiences:
- public
properties:
base64:
type: array
items:
type: string
x-fern-audiences:
- public
description: An array of base64 embeddings. Each string is the result of appending the float embedding bytes together and base64 encoding that.
x-fern-audiences:
- public
Comment on lines +13940 to +13948
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Mark base64 strings with OpenAPI format and make the field readOnly

Additions ensure client SDKs and validators recognize base64 and prevent requests from attempting to send this response-only field.

Apply this diff:

           properties:
             base64:
               type: array
               items:
                 type: string
+                format: byte
                 x-fern-audiences:
                   - public
-              description: An array of base64 embeddings. Each string is the result of appending the float embedding bytes together and base64 encoding that.
+              description: An array of base64-encoded embeddings. Each string is the result of concatenating the raw float embedding bytes (per input) and base64-encoding the result.
+              readOnly: true
               x-fern-audiences:
                 - public

Optional (but recommended): If sibling properties like float/int8/uint8/binary/ubinary specify readOnly, mirror that here for consistency.

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

🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around lines 13940 to 13948, the response-only
base64 string property needs an OpenAPI format and readOnly flag; update the
property's schema to include format: byte (or format: base64 if your generator
uses that) and set readOnly: true so clients/validators treat it as a
response-only base64-encoded string, and mirror readOnly on sibling
numeric/binary properties if those use readOnly for consistency.

binary:
type: array
items:
Expand Down Expand Up @@ -16436,6 +16445,7 @@ components:
- uint8
- binary
- ubinary
- base64
type: string
writeOnly: true
x-fern-audiences:
Expand Down