Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 16, 2024
1 parent 9a644fa commit 1b7c8fa
Show file tree
Hide file tree
Showing 11 changed files with 260 additions and 28 deletions.
5 changes: 5 additions & 0 deletions src/libs/AI21/Generated/AI21.Ai21Api.V1ConversationalRag.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ partial void ProcessV1ConversationalRagResponseContent(
/// <param name="hybridSearchAlpha">
/// Default Value: 0.98
/// </param>
/// <param name="responseLanguage">
/// Default Value: english
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::AI21.ConversationalRagResult> V1ConversationalRagAsync(
Expand All @@ -234,6 +237,7 @@ partial void ProcessV1ConversationalRagResponseContent(
double? retrievalSimilarityThreshold = default,
int? maxNeighbors = default,
double? hybridSearchAlpha = default,
global::AI21.ConversationalRagConfigResponseLanguage? responseLanguage = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::AI21.ConversationalRagConfig
Expand All @@ -247,6 +251,7 @@ partial void ProcessV1ConversationalRagResponseContent(
RetrievalSimilarityThreshold = retrievalSimilarityThreshold,
MaxNeighbors = maxNeighbors,
HybridSearchAlpha = hybridSearchAlpha,
ResponseLanguage = responseLanguage,
};

return await V1ConversationalRagAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public partial interface IAi21Api
/// <param name="hybridSearchAlpha">
/// Default Value: 0.98
/// </param>
/// <param name="responseLanguage">
/// Default Value: english
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::AI21.ConversationalRagResult> V1ConversationalRagAsync(
Expand All @@ -56,6 +59,7 @@ public partial interface IAi21Api
double? retrievalSimilarityThreshold = default,
int? maxNeighbors = default,
double? hybridSearchAlpha = default,
global::AI21.ConversationalRagConfigResponseLanguage? responseLanguage = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial interface ILibraryManagementClient
/// </param>
/// <param name="label"></param>
/// <param name="limit">
/// Default Value: 1000
/// Default Value: 10000
/// </param>
/// <param name="offset"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ partial void ProcessV1LibraryManagementResponseContent(
/// </param>
/// <param name="label"></param>
/// <param name="limit">
/// Default Value: 1000
/// Default Value: 10000
/// </param>
/// <param name="offset"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
Expand Down
14 changes: 13 additions & 1 deletion src/libs/AI21/Generated/AI21.Models.ConversationalRagConfig.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public sealed partial class ConversationalRagConfig
[global::System.Text.Json.Serialization.JsonPropertyName("hybrid_search_alpha")]
public double? HybridSearchAlpha { get; set; }

/// <summary>
/// Default Value: english
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("response_language")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::AI21.JsonConverters.ConversationalRagConfigResponseLanguageJsonConverter))]
public global::AI21.ConversationalRagConfigResponseLanguage? ResponseLanguage { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand Down Expand Up @@ -92,6 +99,9 @@ public sealed partial class ConversationalRagConfig
/// <param name="hybridSearchAlpha">
/// Default Value: 0.98
/// </param>
/// <param name="responseLanguage">
/// Default Value: english
/// </param>
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
public ConversationalRagConfig(
global::System.Collections.Generic.IList<global::AI21.Message> messages,
Expand All @@ -102,7 +112,8 @@ public ConversationalRagConfig(
global::AI21.ConversationalRagConfigRetrievalStrategy? retrievalStrategy,
double? retrievalSimilarityThreshold,
int? maxNeighbors,
double? hybridSearchAlpha)
double? hybridSearchAlpha,
global::AI21.ConversationalRagConfigResponseLanguage? responseLanguage)
{
this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages));
this.Path = path;
Expand All @@ -113,6 +124,7 @@ public ConversationalRagConfig(
this.RetrievalSimilarityThreshold = retrievalSimilarityThreshold;
this.MaxNeighbors = maxNeighbors;
this.HybridSearchAlpha = hybridSearchAlpha;
this.ResponseLanguage = responseLanguage;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

#nullable enable

namespace AI21
{
/// <summary>
/// Default Value: english
/// </summary>
public enum ConversationalRagConfigResponseLanguage
{
/// <summary>
///
/// </summary>
Dutch,
/// <summary>
///
/// </summary>
English,
/// <summary>
///
/// </summary>
French,
/// <summary>
///
/// </summary>
German,
/// <summary>
///
/// </summary>
Hebrew,
/// <summary>
///
/// </summary>
Italian,
/// <summary>
///
/// </summary>
Portuguese,
/// <summary>
///
/// </summary>
Spanish,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class ConversationalRagConfigResponseLanguageExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this ConversationalRagConfigResponseLanguage value)
{
return value switch
{
ConversationalRagConfigResponseLanguage.Dutch => "dutch",
ConversationalRagConfigResponseLanguage.English => "english",
ConversationalRagConfigResponseLanguage.French => "french",
ConversationalRagConfigResponseLanguage.German => "german",
ConversationalRagConfigResponseLanguage.Hebrew => "hebrew",
ConversationalRagConfigResponseLanguage.Italian => "italian",
ConversationalRagConfigResponseLanguage.Portuguese => "portuguese",
ConversationalRagConfigResponseLanguage.Spanish => "spanish",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static ConversationalRagConfigResponseLanguage? ToEnum(string value)
{
return value switch
{
"dutch" => ConversationalRagConfigResponseLanguage.Dutch,
"english" => ConversationalRagConfigResponseLanguage.English,
"french" => ConversationalRagConfigResponseLanguage.French,
"german" => ConversationalRagConfigResponseLanguage.German,
"hebrew" => ConversationalRagConfigResponseLanguage.Hebrew,
"italian" => ConversationalRagConfigResponseLanguage.Italian,
"portuguese" => ConversationalRagConfigResponseLanguage.Portuguese,
"spanish" => ConversationalRagConfigResponseLanguage.Spanish,
_ => null,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

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

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

return default;
}

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

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

namespace AI21.JsonConverters
{
/// <inheritdoc />
public sealed class ConversationalRagConfigResponseLanguageNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::AI21.ConversationalRagConfigResponseLanguage?>
{
/// <inheritdoc />
public override global::AI21.ConversationalRagConfigResponseLanguage? 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::AI21.ConversationalRagConfigResponseLanguageExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::AI21.ConversationalRagConfigResponseLanguage? 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::AI21.ConversationalRagConfigResponseLanguageExtensions.ToValueString(value.Value));
}
}
}
}
2 changes: 2 additions & 0 deletions src/libs/AI21/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ namespace AI21
typeof(global::AI21.JsonConverters.MessageRoleNullableJsonConverter),
typeof(global::AI21.JsonConverters.ConversationalRagConfigRetrievalStrategyJsonConverter),
typeof(global::AI21.JsonConverters.ConversationalRagConfigRetrievalStrategyNullableJsonConverter),
typeof(global::AI21.JsonConverters.ConversationalRagConfigResponseLanguageJsonConverter),
typeof(global::AI21.JsonConverters.ConversationalRagConfigResponseLanguageNullableJsonConverter),
typeof(global::AI21.JsonConverters.FileStatusJsonConverter),
typeof(global::AI21.JsonConverters.FileStatusNullableJsonConverter),
typeof(global::AI21.JsonConverters.LibrarySearchRequestLabelsFilterModeJsonConverter),
Expand Down
Loading

0 comments on commit 1b7c8fa

Please sign in to comment.