Skip to content

Commit

Permalink
Merge pull request #54 from tryAGI/bot/update-openapi_202408070101
Browse files Browse the repository at this point in the history
feat:Updated OpenAPI spec
  • Loading branch information
github-actions[bot] authored Aug 7, 2024
2 parents f1fe0e8 + 34d7fc6 commit e536135
Show file tree
Hide file tree
Showing 284 changed files with 20,783 additions and 5,444 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,52 @@ public class AssistantsApiResponseFormatOptionJsonConverter : global::System.Tex
}

readerCopy = reader;
global::OpenAI.AssistantsApiResponseFormat? value2 = default;
global::OpenAI.ResponseFormatText? value2 = default;
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.AssistantsApiResponseFormat), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.AssistantsApiResponseFormat> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.AssistantsApiResponseFormat).Name}");
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatText), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatText> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatText).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}

readerCopy = reader;
global::OpenAI.ResponseFormatJsonObject? value3 = default;
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatJsonObject), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatJsonObject> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatJsonObject).Name}");
value3 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}

readerCopy = reader;
global::OpenAI.ResponseFormatJsonSchema? value4 = default;
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatJsonSchema), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatJsonSchema> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatJsonSchema).Name}");
value4 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
var result = new global::OpenAI.AssistantsApiResponseFormatOption(
value1,

value2
value2,

value3,

value4
);
if (!result.Validate())
{
throw new global::System.Text.Json.JsonException($"Invalid JSON format for OneOf<{typeof(global::OpenAI.AssistantsApiResponseFormatOptionVariant1).Name}, {typeof(global::OpenAI.AssistantsApiResponseFormat).Name}>");
throw new global::System.Text.Json.JsonException($"Invalid JSON format for OneOf<{typeof(global::OpenAI.AssistantsApiResponseFormatOptionVariant1).Name}, {typeof(global::OpenAI.ResponseFormatText).Name}, {typeof(global::OpenAI.ResponseFormatJsonObject).Name}, {typeof(global::OpenAI.ResponseFormatJsonSchema).Name}>");
}

if (value1 != null)
Expand All @@ -58,8 +86,22 @@ public class AssistantsApiResponseFormatOptionJsonConverter : global::System.Tex

else if (value2 != null)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.AssistantsApiResponseFormat), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.AssistantsApiResponseFormat> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.AssistantsApiResponseFormat).Name}");
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatText), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatText> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatText).Name}");
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}

else if (value3 != null)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatJsonObject), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatJsonObject> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatJsonObject).Name}");
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}

else if (value4 != null)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatJsonSchema), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatJsonSchema> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatJsonSchema).Name}");
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
return result;
Expand All @@ -76,7 +118,7 @@ public override void Write(

if (!value.Validate())
{
throw new global::System.Text.Json.JsonException($"Invalid OneOf<{typeof(global::OpenAI.AssistantsApiResponseFormatOptionVariant1).Name}, {typeof(global::OpenAI.AssistantsApiResponseFormat).Name}> object.");
throw new global::System.Text.Json.JsonException($"Invalid OneOf<{typeof(global::OpenAI.AssistantsApiResponseFormatOptionVariant1).Name}, {typeof(global::OpenAI.ResponseFormatText).Name}, {typeof(global::OpenAI.ResponseFormatJsonObject).Name}, {typeof(global::OpenAI.ResponseFormatJsonSchema).Name}> object.");
}

if (value.IsValue1)
Expand All @@ -88,10 +130,24 @@ public override void Write(

else if (value.IsValue2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.AssistantsApiResponseFormat), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.AssistantsApiResponseFormat?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.AssistantsApiResponseFormat).Name}");
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatText), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatText?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatText).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2, typeInfo);
}

else if (value.IsValue3)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatJsonObject), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatJsonObject?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatJsonObject).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value3, typeInfo);
}

else if (value.IsValue4)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::OpenAI.ResponseFormatJsonSchema), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::OpenAI.ResponseFormatJsonSchema?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::OpenAI.ResponseFormatJsonSchema).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value4, typeInfo);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
/// <inheritdoc />
public sealed class AuditLogActorApiKeyTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AuditLogActorApiKeyType>
{
/// <inheritdoc />
public override global::OpenAI.AuditLogActorApiKeyType 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::OpenAI.AuditLogActorApiKeyTypeExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

writer.WriteStringValue(global::OpenAI.AuditLogActorApiKeyTypeExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace OpenApiGenerator.JsonConverters
{
/// <inheritdoc />
public sealed class CreateChatCompletionRequestResponseFormatTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.CreateChatCompletionRequestResponseFormatType?>
public sealed class AuditLogActorApiKeyTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AuditLogActorApiKeyType?>
{
/// <inheritdoc />
public override global::OpenAI.CreateChatCompletionRequestResponseFormatType? Read(
public override global::OpenAI.AuditLogActorApiKeyType? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
Expand All @@ -18,15 +18,15 @@ public sealed class CreateChatCompletionRequestResponseFormatTypeNullableJsonCon
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::OpenAI.CreateChatCompletionRequestResponseFormatTypeExtensions.ToEnum(stringValue);
return global::OpenAI.AuditLogActorApiKeyTypeExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::OpenAI.CreateChatCompletionRequestResponseFormatType)numValue;
return (global::OpenAI.AuditLogActorApiKeyType)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
Expand All @@ -38,7 +38,7 @@ public sealed class CreateChatCompletionRequestResponseFormatTypeNullableJsonCon
/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenAI.CreateChatCompletionRequestResponseFormatType? value,
global::OpenAI.AuditLogActorApiKeyType? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
Expand All @@ -49,7 +49,7 @@ public override void Write(
}
else
{
writer.WriteStringValue(global::OpenAI.CreateChatCompletionRequestResponseFormatTypeExtensions.ToValueString(value.Value));
writer.WriteStringValue(global::OpenAI.AuditLogActorApiKeyTypeExtensions.ToValueString(value.Value));
}
}
}
Expand Down
49 changes: 49 additions & 0 deletions src/libs/OpenAI/Generated/JsonConverters.AuditLogActorType.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
/// <inheritdoc />
public sealed class AuditLogActorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AuditLogActorType>
{
/// <inheritdoc />
public override global::OpenAI.AuditLogActorType 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::OpenAI.AuditLogActorTypeExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

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

namespace OpenApiGenerator.JsonConverters
{
/// <inheritdoc />
public sealed class AuditLogActorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AuditLogActorType?>
{
/// <inheritdoc />
public override global::OpenAI.AuditLogActorType? 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::OpenAI.AuditLogActorTypeExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenAI.AuditLogActorType? 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::OpenAI.AuditLogActorTypeExtensions.ToValueString(value.Value));
}
}
}
}
49 changes: 49 additions & 0 deletions src/libs/OpenAI/Generated/JsonConverters.AuditLogEventType.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
{
/// <inheritdoc />
public sealed class AuditLogEventTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AuditLogEventType>
{
/// <inheritdoc />
public override global::OpenAI.AuditLogEventType 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::OpenAI.AuditLogEventTypeExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

writer.WriteStringValue(global::OpenAI.AuditLogEventTypeExtensions.ToValueString(value));
}
}
}
Loading

0 comments on commit e536135

Please sign in to comment.