Skip to content

Commit

Permalink
Merge pull request #6 from tryAGI/bot/update-openapi_202409171521
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Sep 17, 2024
2 parents 118fbd2 + ba70c83 commit 3a5b73b
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 44 deletions.
25 changes: 25 additions & 0 deletions src/libs/Jina/Generated/Jina.Models.TextEmbeddingInput.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public sealed partial class TextEmbeddingInput
/// - `jina-embeddings-v2-base-de`, 161M, 768<br/>
/// - `jina-embeddings-v2-base-zh`, 161M, 768<br/>
/// - `jina-embeddings-v2-base-code`, 137M, 768<br/>
/// - `jina-embeddings-v3`, 570M, 1024<br/>
/// For more information, please checkout our [technical blog](https://arxiv.org/abs/2307.11224).
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("model")]
Expand All @@ -39,12 +40,36 @@ public sealed partial class TextEmbeddingInput
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Jina.JsonConverters.AnyOfJsonConverterFactory2))]
public global::Jina.AnyOf<global::Jina.TextEmbeddingInputEmbeddingType?, global::System.Collections.Generic.IList<global::Jina.TextEmbeddingInputEmbeddingTypeItem>>? EmbeddingType { 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.TextEmbeddingInputTaskJsonConverter))]
public global::Jina.TextEmbeddingInputTask? Task { get; set; }

/// <summary>
/// Used to specify output embedding size. If set, output embeddings will be truncated to the size specified.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("dimensions")]
public int? Dimensions { get; set; }

/// <summary>
/// Flag to determine if the embeddings should be normalized to have a unit L2 norm
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("normalized")]
public bool? Normalized { get; set; }

/// <summary>
/// Flag to determine if late chunking is applied. If True, all the sentences in inputs will be concatenated and used as input for late chunking.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("late_chunking")]
public bool? LateChunking { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand Down
74 changes: 74 additions & 0 deletions src/libs/Jina/Generated/Jina.Models.TextEmbeddingInputTask.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 TextEmbeddingInputTask
{
/// <summary>
///
/// </summary>
RetrievalQuery,
/// <summary>
///
/// </summary>
RetrievalPassage,
/// <summary>
///
/// </summary>
TextMatching,
/// <summary>
///
/// </summary>
Classification,
/// <summary>
///
/// </summary>
Separation,
}

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

namespace Jina.JsonConverters
{
/// <inheritdoc />
public sealed class TextEmbeddingInputTaskJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Jina.TextEmbeddingInputTask>
{
/// <inheritdoc />
public override global::Jina.TextEmbeddingInputTask 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.TextEmbeddingInputTaskExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

writer.WriteStringValue(global::Jina.TextEmbeddingInputTaskExtensions.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 TextEmbeddingInputTaskNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Jina.TextEmbeddingInputTask?>
{
/// <inheritdoc />
public override global::Jina.TextEmbeddingInputTask? 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.TextEmbeddingInputTaskExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Jina.TextEmbeddingInputTask? 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.TextEmbeddingInputTaskExtensions.ToValueString(value.Value));
}
}
}
}
2 changes: 2 additions & 0 deletions src/libs/Jina/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace Jina
typeof(global::Jina.JsonConverters.TextEmbeddingInputEmbeddingTypeNullableJsonConverter),
typeof(global::Jina.JsonConverters.TextEmbeddingInputEmbeddingTypeItemJsonConverter),
typeof(global::Jina.JsonConverters.TextEmbeddingInputEmbeddingTypeItemNullableJsonConverter),
typeof(global::Jina.JsonConverters.TextEmbeddingInputTaskJsonConverter),
typeof(global::Jina.JsonConverters.TextEmbeddingInputTaskNullableJsonConverter),
typeof(global::Jina.JsonConverters.ImageEmbeddingInputEmbeddingTypeJsonConverter),
typeof(global::Jina.JsonConverters.ImageEmbeddingInputEmbeddingTypeNullableJsonConverter),
typeof(global::Jina.JsonConverters.ImageEmbeddingInputEmbeddingTypeItemJsonConverter),
Expand Down
Loading

0 comments on commit 3a5b73b

Please sign in to comment.