Skip to content

Commit

Permalink
fix: Fixed update issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Sep 28, 2024
1 parent fc09ff5 commit 865335e
Show file tree
Hide file tree
Showing 65 changed files with 3,555 additions and 649 deletions.
3 changes: 3 additions & 0 deletions src/helpers/FixOpenApiSpec/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
text = text.Replace("description: *run_top_p_description", "description: empty");
text = text.Replace("description: &run_top_p_description ", "description: ");

text = text.Replace("example: *moderation_example", "example: empty");
text = text.Replace("response: &moderation_example |", "response: |");

var openApiDocument = new OpenApiStringReader().Read(text, out var diagnostics);
openApiDocument.Components.Schemas["ParallelToolCalls"]!.Default = null;
openApiDocument.Components.Schemas["ParallelToolCalls"]!.Nullable = true;
Expand Down
8 changes: 8 additions & 0 deletions src/helpers/FixOpenApiSpec/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"FixOpenApiSpec": {
"commandName": "Project",
"commandLineArgs": "../../../../../../src/libs/OpenAI/openapi.yaml"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

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

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

return default;
}

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

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

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

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenAI.CreateModerationRequestInputVariant3ItemVariant1Type? 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.CreateModerationRequestInputVariant3ItemVariant1TypeExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

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

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

return default;
}

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

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

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

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenAI.CreateModerationRequestInputVariant3ItemVariant2Type? 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.CreateModerationRequestInputVariant3ItemVariant2TypeExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

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

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

return default;
}

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

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

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

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenAI.CreateModerationResponseResultCategoryAppliedInputTypesHarassmentItem? 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.CreateModerationResponseResultCategoryAppliedInputTypesHarassmentItemExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

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

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

return default;
}

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

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

0 comments on commit 865335e

Please sign in to comment.