Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ partial void ProcessOpenaiEmbeddingsResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<string> OpenaiEmbeddingsAsync(
string model,
global::System.Collections.Generic.IList<string> input,
global::DeepInfra.AnyOf<global::System.Collections.Generic.IList<string>, string> input,
string? xDeepinfraSource = default,
string? userAgent = default,
string? xiApiKey = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public partial interface IDeepInfraClient
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<string> OpenaiEmbeddingsAsync(
string model,
global::System.Collections.Generic.IList<string> input,
global::DeepInfra.AnyOf<global::System.Collections.Generic.IList<string>, string> input,
string? xDeepinfraSource = default,
string? userAgent = default,
string? xiApiKey = default,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

#pragma warning disable CS0618 // Type or member is obsolete

#nullable enable

namespace DeepInfra
Expand All @@ -23,8 +25,9 @@ public sealed partial class OpenAIEmbeddingsIn
/// </summary>
/// <example>[I like chocolate]</example>
[global::System.Text.Json.Serialization.JsonPropertyName("input")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::DeepInfra.JsonConverters.AnyOfJsonConverter<global::System.Collections.Generic.IList<string>, string>))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.Collections.Generic.IList<string> Input { get; set; }
public required global::DeepInfra.AnyOf<global::System.Collections.Generic.IList<string>, string> Input { get; set; }

/// <summary>
/// format used when encoding<br/>
Expand Down Expand Up @@ -60,11 +63,11 @@ public sealed partial class OpenAIEmbeddingsIn
#endif
public OpenAIEmbeddingsIn(
string model,
global::System.Collections.Generic.IList<string> input,
global::DeepInfra.AnyOf<global::System.Collections.Generic.IList<string>, string> input,
global::DeepInfra.OpenAIEmbeddingsInEncodingFormat? encodingFormat)
{
this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model));
this.Input = input ?? throw new global::System.ArgumentNullException(nameof(input));
this.Input = input;
this.EncodingFormat = encodingFormat;
}

Expand Down
1 change: 1 addition & 0 deletions src/libs/DeepInfra/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ namespace DeepInfra
typeof(global::DeepInfra.JsonConverters.AnyOfJsonConverter<global::DeepInfra.ChatCompletionToolMessage, global::DeepInfra.ChatCompletionAssistantMessage, global::DeepInfra.ChatCompletionUserMessage, global::DeepInfra.ChatCompletionSystemMessage>),
typeof(global::DeepInfra.JsonConverters.AnyOfJsonConverter<string, global::System.Collections.Generic.IList<string>>),
typeof(global::DeepInfra.JsonConverters.AnyOfJsonConverter<string, global::System.Collections.Generic.IList<string>>),
typeof(global::DeepInfra.JsonConverters.AnyOfJsonConverter<global::System.Collections.Generic.IList<string>, string>),
typeof(global::DeepInfra.JsonConverters.UnixTimestampJsonConverter),
})]

Expand Down
40 changes: 22 additions & 18 deletions src/libs/DeepInfra/Generated/JsonSerializerContextTypes.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -638,74 +638,78 @@ public sealed partial class JsonSerializerContextTypes
/// <summary>
///
/// </summary>
public global::DeepInfra.OpenAIEmbeddingsInEncodingFormat? Type153 { get; set; }
public global::DeepInfra.AnyOf<global::System.Collections.Generic.IList<string>, string>? Type153 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.OpenAIImageData? Type154 { get; set; }
public global::DeepInfra.OpenAIEmbeddingsInEncodingFormat? Type154 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.OpenAIImagesOut? Type155 { get; set; }
public global::DeepInfra.OpenAIImageData? Type155 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::DeepInfra.OpenAIImageData>? Type156 { get; set; }
public global::DeepInfra.OpenAIImagesOut? Type156 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.OpenAIModelOut? Type157 { get; set; }
public global::System.Collections.Generic.IList<global::DeepInfra.OpenAIImageData>? Type157 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.OpenAIModelsOut? Type158 { get; set; }
public global::DeepInfra.OpenAIModelOut? Type158 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::DeepInfra.OpenAIModelOut>? Type159 { get; set; }
public global::DeepInfra.OpenAIModelsOut? Type159 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.OpenAITextToSpeechIn? Type160 { get; set; }
public global::System.Collections.Generic.IList<global::DeepInfra.OpenAIModelOut>? Type160 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.RateLimitOut? Type161 { get; set; }
public global::DeepInfra.OpenAITextToSpeechIn? Type161 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.RateLimitRequestIn? Type162 { get; set; }
public global::DeepInfra.RateLimitOut? Type162 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.SchemaOut? Type163 { get; set; }
public global::DeepInfra.RateLimitRequestIn? Type163 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.ScopedJWTIn? Type164 { get; set; }
public global::DeepInfra.SchemaOut? Type164 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.ScopedJWTOut? Type165 { get; set; }
public global::DeepInfra.ScopedJWTIn? Type165 { get; set; }
/// <summary>
///
/// </summary>
public global::DeepInfra.UpdateLoraApiRequest? Type166 { get; set; }
public global::DeepInfra.ScopedJWTOut? Type166 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::DeepInfra.DeploymentOut>? Type167 { get; set; }
public global::DeepInfra.UpdateLoraApiRequest? Type167 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::DeepInfra.ModelOut>? Type168 { get; set; }
public global::System.Collections.Generic.IList<global::DeepInfra.DeploymentOut>? Type168 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::DeepInfra.ModelVersionOut>? Type169 { get; set; }
public global::System.Collections.Generic.IList<global::DeepInfra.ModelOut>? Type169 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::DeepInfra.ApiToken>? Type170 { get; set; }
public global::System.Collections.Generic.IList<global::DeepInfra.ModelVersionOut>? Type170 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::DeepInfra.ApiToken>? Type171 { get; set; }
}
}
10 changes: 6 additions & 4 deletions src/libs/DeepInfra/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5571,10 +5571,12 @@ components:
example: thenlper/gte-large
input:
title: Input
maxItems: 1024
type: array
items:
type: string
maxLength: 1024
anyOf:
- type: array
items:
type: string
- type: string
Comment on lines +5574 to +5579
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure correct application of length constraints for both variants
The current placement of maxLength: 1024 at the same level as anyOf may apply indiscriminately to arrays and strings, and the array variant no longer enforces a maximum of 1024 items. To preserve the original intent—limit string inputs to 1024 characters and array inputs to 1024 items—consider:

         input:
           title: Input
-          maxLength: 1024
-          anyOf:
-            - type: array
-              items:
-                type: string
-            - type: string
+          anyOf:
+            - type: array
+              items:
+                type: string
+              maxItems: 1024
+            - type: string
+              maxLength: 1024
           description: sequences to embed
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
maxLength: 1024
anyOf:
- type: array
items:
type: string
- type: string
input:
title: Input
anyOf:
- type: array
items:
type: string
maxItems: 1024
- type: string
maxLength: 1024
description: sequences to embed
🤖 Prompt for AI Agents
In src/libs/DeepInfra/openapi.yaml around lines 5574 to 5579, the maxLength
constraint is incorrectly applied at the same level as anyOf, causing it to
apply to both arrays and strings indiscriminately and removing the limit on
array items. To fix this, move the maxLength: 1024 constraint inside the string
type definition to limit string length, and add a maxItems: 1024 constraint
inside the array type definition to limit the number of items in the array.

description: sequences to embed
example:
- I like chocolate
Expand Down