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 Cohere API type definitions and deserialization logic for safety #26

Merged
merged 1 commit into from
Aug 29, 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
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.CohereApi.Chat.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ partial void ProcessChatResponseContent(
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Cohere.SourceGenerationContext.Default.NullableOneOfNonStreamedChatResponseStreamedChatResponse) ??
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Cohere.SourceGenerationContext.Default.NullableOneOfNonStreamedChatResponseNullableStreamedChatResponse) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ partial void ProcessChatv2ResponseContent(
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Cohere.SourceGenerationContext.Default.NullableOneOfNonStreamedChatResponse2StreamedChatResponse2) ??
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Cohere.SourceGenerationContext.Default.NullableOneOfNonStreamedChatResponse2NullableStreamedChatResponse2) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.CohereApi.Rerank.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ partial void ProcessRerankResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Cohere.RerankResponse> RerankAsync(
string query,
global::System.Collections.Generic.IList<global::System.OneOf<string?, global::Cohere.RerankDocument>> documents,
global::System.Collections.Generic.IList<global::System.OneOf<string, global::Cohere.RerankDocument>> documents,
string? xClientName = default,
string? model = default,
int topN = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed partial class AssistantMessage
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("content")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))]
public global::System.OneOf<string?, global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>>? Content { get; set; }
public global::System.OneOf<string, global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>>? Content { get; set; }

/// <summary>
///
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.Models.RerankRequest.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public sealed partial class RerankRequest
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("documents")]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.Collections.Generic.IList<global::System.OneOf<string?, global::Cohere.RerankDocument>> Documents { get; set; }
public required global::System.Collections.Generic.IList<global::System.OneOf<string, global::Cohere.RerankDocument>> Documents { get; set; }

/// <summary>
/// The number of most relevant documents or indices to return, defaults to the length of the documents
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.Models.SystemMessage.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed partial class SystemMessage
[global::System.Text.Json.Serialization.JsonPropertyName("content")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.OneOf<string?, global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>> Content { get; set; }
public required global::System.OneOf<string, global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>> Content { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Cohere/Generated/Cohere.Models.UserMessage.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed partial class UserMessage
[global::System.Text.Json.Serialization.JsonPropertyName("content")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.OneOf<string?, global::System.Collections.Generic.IList<global::Cohere.Content>> Content { get; set; }
public required global::System.OneOf<string, global::System.Collections.Generic.IList<global::Cohere.Content>> Content { get; set; }

/// <summary>
/// Documents seen by the model when generating the reply.
Expand Down
8 changes: 4 additions & 4 deletions src/libs/Cohere/Generated/JsonSerializerContextTypes.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public sealed partial class JsonSerializerContextTypes
/// <summary>
///
/// </summary>
public global::System.OneOf<string?, global::System.Collections.Generic.IList<global::Cohere.Content>>? Type67 { get; set; }
public global::System.OneOf<string, global::System.Collections.Generic.IList<global::Cohere.Content>>? Type67 { get; set; }
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -341,7 +341,7 @@ public sealed partial class JsonSerializerContextTypes
/// <summary>
///
/// </summary>
public global::System.OneOf<string?, global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>>? Type82 { get; set; }
public global::System.OneOf<string, global::System.Collections.Generic.IList<global::System.OneOf<global::Cohere.TextContent>>>? Type82 { get; set; }
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -1157,11 +1157,11 @@ public sealed partial class JsonSerializerContextTypes
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::System.OneOf<string?, global::Cohere.RerankDocument>>? Type286 { get; set; }
public global::System.Collections.Generic.IList<global::System.OneOf<string, global::Cohere.RerankDocument>>? Type286 { get; set; }
/// <summary>
///
/// </summary>
public global::System.OneOf<string?, global::Cohere.RerankDocument>? Type287 { get; set; }
public global::System.OneOf<string, global::Cohere.RerankDocument>? Type287 { get; set; }
/// <summary>
///
/// </summary>
Expand Down
Loading