Skip to content
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

feat:Update OpenAPI spec for Jina Embedding Serving API to version 0.1.93 #81

Merged
merged 1 commit into from
Nov 20, 2024
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
22 changes: 22 additions & 0 deletions src/libs/Jina/Generated/Jina.Models.ImageEmbeddingInput.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ public sealed partial class ImageEmbeddingInput
[global::System.Text.Json.Serialization.JsonPropertyName("normalized")]
public bool? Normalized { get; set; }

/// <summary>
/// Used to convey intended downstream application to help the model produce better embeddings. Must be one of the following values:<br/>
/// - "retrieval.query": Specifies the given text is a query in a search or retrieval setting.<br/>
/// - "retrieval.passage": Specifies the given text is a document in a search or retrieval setting.<br/>
/// - "text-matching": Specifies the given text is used for Semantic Textual Similarity.<br/>
/// - "classification": Specifies that the embedding is used for classification.<br/>
/// - "separation": Specifies that the embedding is used for clustering.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("task")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Jina.JsonConverters.ImageEmbeddingInputTaskJsonConverter))]
public global::Jina.ImageEmbeddingInputTask? Task { get; set; }

/// <summary>
/// Used to specify output embedding size. If set, output embeddings will be truncated to the size specified.
/// </summary>
Expand Down Expand Up @@ -73,6 +85,14 @@ public sealed partial class ImageEmbeddingInput
/// <param name="normalized">
/// Flag to determine if the embeddings should be normalized to have a unit L2 norm
/// </param>
/// <param name="task">
/// Used to convey intended downstream application to help the model produce better embeddings. Must be one of the following values:<br/>
/// - "retrieval.query": Specifies the given text is a query in a search or retrieval setting.<br/>
/// - "retrieval.passage": Specifies the given text is a document in a search or retrieval setting.<br/>
/// - "text-matching": Specifies the given text is used for Semantic Textual Similarity.<br/>
/// - "classification": Specifies that the embedding is used for classification.<br/>
/// - "separation": Specifies that the embedding is used for clustering.
/// </param>
/// <param name="dimensions">
/// Used to specify output embedding size. If set, output embeddings will be truncated to the size specified.
/// </param>
Expand All @@ -82,12 +102,14 @@ public ImageEmbeddingInput(
global::Jina.AnyOf<global::Jina.ApiSchemasEmbeddingImageDoc, global::System.Collections.Generic.IList<global::Jina.ApiSchemasEmbeddingImageDoc>> input,
global::Jina.AnyOf<global::Jina.ImageEmbeddingInputEmbeddingType?, global::System.Collections.Generic.IList<global::Jina.ImageEmbeddingInputEmbeddingTypeItem>>? embeddingType,
bool? normalized,
global::Jina.ImageEmbeddingInputTask? task,
int? dimensions)
{
this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model));
this.Input = input;
this.EmbeddingType = embeddingType;
this.Normalized = normalized;
this.Task = task;
this.Dimensions = dimensions;
}

Expand Down
74 changes: 74 additions & 0 deletions src/libs/Jina/Generated/Jina.Models.ImageEmbeddingInputTask.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

#nullable enable

namespace Jina
{
/// <summary>
/// Used to convey intended downstream application to help the model produce better embeddings. Must be one of the following values:<br/>
/// - "retrieval.query": Specifies the given text is a query in a search or retrieval setting.<br/>
/// - "retrieval.passage": Specifies the given text is a document in a search or retrieval setting.<br/>
/// - "text-matching": Specifies the given text is used for Semantic Textual Similarity.<br/>
/// - "classification": Specifies that the embedding is used for classification.<br/>
/// - "separation": Specifies that the embedding is used for clustering.
/// </summary>
public enum ImageEmbeddingInputTask
{
/// <summary>
/// Specifies the given text is a query in a search or retrieval setting.
/// </summary>
RetrievalQuery,
/// <summary>
/// Specifies the given text is a document in a search or retrieval setting.
/// </summary>
RetrievalPassage,
/// <summary>
/// Specifies the given text is used for Semantic Textual Similarity.
/// </summary>
TextMatching,
/// <summary>
/// Specifies that the embedding is used for classification.
/// </summary>
Classification,
/// <summary>
/// Specifies that the embedding is used for clustering.
/// </summary>
Separation,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class ImageEmbeddingInputTaskExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this ImageEmbeddingInputTask value)
{
return value switch
{
ImageEmbeddingInputTask.RetrievalQuery => "retrieval.query",
ImageEmbeddingInputTask.RetrievalPassage => "retrieval.passage",
ImageEmbeddingInputTask.TextMatching => "text-matching",
ImageEmbeddingInputTask.Classification => "classification",
ImageEmbeddingInputTask.Separation => "separation",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static ImageEmbeddingInputTask? ToEnum(string value)
{
return value switch
{
"retrieval.query" => ImageEmbeddingInputTask.RetrievalQuery,
"retrieval.passage" => ImageEmbeddingInputTask.RetrievalPassage,
"text-matching" => ImageEmbeddingInputTask.TextMatching,
"classification" => ImageEmbeddingInputTask.Classification,
"separation" => ImageEmbeddingInputTask.Separation,
_ => null,
};
}
}
}
22 changes: 22 additions & 0 deletions src/libs/Jina/Generated/Jina.Models.MixedEmbeddingInput.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ public sealed partial class MixedEmbeddingInput
[global::System.Text.Json.Serialization.JsonPropertyName("normalized")]
public bool? Normalized { get; set; }

/// <summary>
/// Used to convey intended downstream application to help the model produce better embeddings. Must be one of the following values:<br/>
/// - "retrieval.query": Specifies the given text is a query in a search or retrieval setting.<br/>
/// - "retrieval.passage": Specifies the given text is a document in a search or retrieval setting.<br/>
/// - "text-matching": Specifies the given text is used for Semantic Textual Similarity.<br/>
/// - "classification": Specifies that the embedding is used for classification.<br/>
/// - "separation": Specifies that the embedding is used for clustering.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("task")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Jina.JsonConverters.MixedEmbeddingInputTaskJsonConverter))]
public global::Jina.MixedEmbeddingInputTask? Task { get; set; }

/// <summary>
/// Used to specify output embedding size. If set, output embeddings will be truncated to the size specified.
/// </summary>
Expand Down Expand Up @@ -72,6 +84,14 @@ public sealed partial class MixedEmbeddingInput
/// <param name="normalized">
/// Flag to determine if the embeddings should be normalized to have a unit L2 norm
/// </param>
/// <param name="task">
/// Used to convey intended downstream application to help the model produce better embeddings. Must be one of the following values:<br/>
/// - "retrieval.query": Specifies the given text is a query in a search or retrieval setting.<br/>
/// - "retrieval.passage": Specifies the given text is a document in a search or retrieval setting.<br/>
/// - "text-matching": Specifies the given text is used for Semantic Textual Similarity.<br/>
/// - "classification": Specifies that the embedding is used for classification.<br/>
/// - "separation": Specifies that the embedding is used for clustering.
/// </param>
/// <param name="dimensions">
/// Used to specify output embedding size. If set, output embeddings will be truncated to the size specified.
/// </param>
Expand All @@ -81,12 +101,14 @@ public MixedEmbeddingInput(
global::System.Collections.Generic.IList<global::Jina.AnyOf<global::Jina.ApiSchemasEmbeddingImageDoc, global::Jina.ApiSchemasEmbeddingTextDoc, string>> input,
global::Jina.AnyOf<global::Jina.MixedEmbeddingInputEmbeddingType?, global::System.Collections.Generic.IList<global::Jina.MixedEmbeddingInputEmbeddingTypeItem>>? embeddingType,
bool? normalized,
global::Jina.MixedEmbeddingInputTask? task,
int? dimensions)
{
this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model));
this.Input = input ?? throw new global::System.ArgumentNullException(nameof(input));
this.EmbeddingType = embeddingType;
this.Normalized = normalized;
this.Task = task;
this.Dimensions = dimensions;
}

Expand Down
74 changes: 74 additions & 0 deletions src/libs/Jina/Generated/Jina.Models.MixedEmbeddingInputTask.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

#nullable enable

namespace Jina
{
/// <summary>
/// Used to convey intended downstream application to help the model produce better embeddings. Must be one of the following values:<br/>
/// - "retrieval.query": Specifies the given text is a query in a search or retrieval setting.<br/>
/// - "retrieval.passage": Specifies the given text is a document in a search or retrieval setting.<br/>
/// - "text-matching": Specifies the given text is used for Semantic Textual Similarity.<br/>
/// - "classification": Specifies that the embedding is used for classification.<br/>
/// - "separation": Specifies that the embedding is used for clustering.
/// </summary>
public enum MixedEmbeddingInputTask
{
/// <summary>
/// Specifies the given text is a query in a search or retrieval setting.
/// </summary>
RetrievalQuery,
/// <summary>
/// Specifies the given text is a document in a search or retrieval setting.
/// </summary>
RetrievalPassage,
/// <summary>
/// Specifies the given text is used for Semantic Textual Similarity.
/// </summary>
TextMatching,
/// <summary>
/// Specifies that the embedding is used for classification.
/// </summary>
Classification,
/// <summary>
/// Specifies that the embedding is used for clustering.
/// </summary>
Separation,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class MixedEmbeddingInputTaskExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this MixedEmbeddingInputTask value)
{
return value switch
{
MixedEmbeddingInputTask.RetrievalQuery => "retrieval.query",
MixedEmbeddingInputTask.RetrievalPassage => "retrieval.passage",
MixedEmbeddingInputTask.TextMatching => "text-matching",
MixedEmbeddingInputTask.Classification => "classification",
MixedEmbeddingInputTask.Separation => "separation",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static MixedEmbeddingInputTask? ToEnum(string value)
{
return value switch
{
"retrieval.query" => MixedEmbeddingInputTask.RetrievalQuery,
"retrieval.passage" => MixedEmbeddingInputTask.RetrievalPassage,
"text-matching" => MixedEmbeddingInputTask.TextMatching,
"classification" => MixedEmbeddingInputTask.Classification,
"separation" => MixedEmbeddingInputTask.Separation,
_ => null,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace Jina.JsonConverters
{
/// <inheritdoc />
public sealed class ImageEmbeddingInputTaskJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Jina.ImageEmbeddingInputTask>
{
/// <inheritdoc />
public override global::Jina.ImageEmbeddingInputTask Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Jina.ImageEmbeddingInputTaskExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Jina.ImageEmbeddingInputTask)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Jina.ImageEmbeddingInputTask value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Jina.ImageEmbeddingInputTaskExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#nullable enable

namespace Jina.JsonConverters
{
/// <inheritdoc />
public sealed class ImageEmbeddingInputTaskNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Jina.ImageEmbeddingInputTask?>
{
/// <inheritdoc />
public override global::Jina.ImageEmbeddingInputTask? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Jina.ImageEmbeddingInputTaskExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Jina.ImageEmbeddingInputTask)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Jina.ImageEmbeddingInputTask? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::Jina.ImageEmbeddingInputTaskExtensions.ToValueString(value.Value));
}
}
}
}
Loading
Loading