Skip to content

Commit

Permalink
Merge pull request #81 from tryAGI/bot/update-openapi_202411201241
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Nov 20, 2024
2 parents a35e1be + 419df1a commit 15e737b
Show file tree
Hide file tree
Showing 11 changed files with 480 additions and 46 deletions.
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

0 comments on commit 15e737b

Please sign in to comment.