Skip to content

Commit

Permalink
feat: Use AutoSDK.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Sep 15, 2024
1 parent a9d6497 commit 264a00d
Show file tree
Hide file tree
Showing 968 changed files with 5,535 additions and 1,761 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Discord](https://img.shields.io/discord/1115206893015662663?label=Discord&logo=discord&logoColor=white&color=d82679)](https://discord.gg/Ca2xhfBf3v)

## Features 🔥
- Fully generated C# SDK based on [official OpenAI OpenAPI specification](https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml) using [OpenApiGenerator](https://github.com/HavenDV/OpenApiGenerator)
- Fully generated C# SDK based on [official OpenAI OpenAPI specification](https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml) using [AutoSDK](https://github.com/tryAGI/AutoSDK)
- Same day update to support new features
- Updated and supported automatically if there are no breaking changes
- Contains a supported list of constants such as current prices, models, and other
Expand Down
4 changes: 2 additions & 2 deletions src/libs/OpenAI/AssistantClient.CreateRun.AsStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ public partial class AssistantsClient
string threadId,
string assistantId,
global::System.Collections.Generic.IList<global::OpenAI.CreateRunIncludeItem>? include = default,
global::System.AnyOf<string, global::OpenAI.CreateRunRequestModel?>? model = default,
global::OpenAI.AnyOf<string, global::OpenAI.CreateRunRequestModel?>? model = default,
string? instructions = default,
string? additionalInstructions = default,
global::System.Collections.Generic.IList<global::OpenAI.CreateMessageRequest>? additionalMessages = default,
global::System.Collections.Generic.IList<global::System.OneOf<global::OpenAI.AssistantToolsCode, global::OpenAI.AssistantToolsFileSearch, global::OpenAI.AssistantToolsFunction>>? tools = default,
global::System.Collections.Generic.IList<global::OpenAI.OneOf<global::OpenAI.AssistantToolsCode, global::OpenAI.AssistantToolsFileSearch, global::OpenAI.AssistantToolsFunction>>? tools = default,
global::OpenAI.CreateRunRequestMetadata? metadata = default,
double? temperature = 1,
double? topP = 1,
Expand Down
16 changes: 8 additions & 8 deletions src/libs/OpenAI/ChatClient.CreateChatCompletion.As.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ namespace OpenAI
{
public partial class ChatClient
{
/// <inheritdoc cref="CreateChatCompletionAsync(System.Collections.Generic.IList{ChatCompletionRequestMessage},System.AnyOf{string?,CreateChatCompletionRequestModel?},double?,CreateChatCompletionRequestLogitBias?,bool?,int?,int?,int?,double?,System.OneOf{ResponseFormatText,ResponseFormatJsonObject,ResponseFormatJsonSchema}?,int?,CreateChatCompletionRequestServiceTier?,System.OneOf{string?,System.Collections.Generic.IList{string}}?,bool?,ChatCompletionStreamOptions?,double?,double?,System.Collections.Generic.IList{ChatCompletionTool}?,ChatCompletionToolChoiceOption?,bool?,string?,System.Threading.CancellationToken)"/>
/// <inheritdoc cref="CreateChatCompletionAsync(System.Collections.Generic.IList{ChatCompletionRequestMessage},OpenAI.AnyOf{string?,CreateChatCompletionRequestModel?},double?,CreateChatCompletionRequestLogitBias?,bool?,int?,int?,int?,double?,OpenAI.OneOf{ResponseFormatText,ResponseFormatJsonObject,ResponseFormatJsonSchema}?,int?,CreateChatCompletionRequestServiceTier?,OpenAI.OneOf{string?,System.Collections.Generic.IList{string}}?,bool?,ChatCompletionStreamOptions?,double?,double?,System.Collections.Generic.IList{ChatCompletionTool}?,ChatCompletionToolChoiceOption?,bool?,string?,System.Threading.CancellationToken)"/>
#if NET6_0_OR_GREATER
[RequiresUnreferencedCode(
"This method uses reflection to generate a JSON schema. Use overload with JsonTypeInfo parameter to avoid this.")]
#endif
#if NET8_0_OR_GREATER
[RequiresDynamicCode("This method uses reflection to generate a JSON schema. Use overload with JsonTypeInfo parameter to avoid this.")]
#endif
public async global::System.Threading.Tasks.Task<System.AnyOf<T, global::OpenAI.CreateChatCompletionResponse>>
public async global::System.Threading.Tasks.Task<OpenAI.AnyOf<T, global::OpenAI.CreateChatCompletionResponse>>
CreateChatCompletionAsAsync<T>(
global::System.Collections.Generic.IList<global::OpenAI.ChatCompletionRequestMessage> messages,
global::System.AnyOf<string, global::OpenAI.CreateChatCompletionRequestModel?> model,
global::OpenAI.AnyOf<string, global::OpenAI.CreateChatCompletionRequestModel?> model,
double? frequencyPenalty = 0,
global::OpenAI.CreateChatCompletionRequestLogitBias? logitBias = default,
bool? logprobs = false,
Expand All @@ -28,7 +28,7 @@ public partial class ChatClient
double? presencePenalty = 0,
int? seed = default,
global::OpenAI.CreateChatCompletionRequestServiceTier? serviceTier = default,
global::System.OneOf<string, global::System.Collections.Generic.IList<string>>? stop = default,
global::OpenAI.OneOf<string, global::System.Collections.Generic.IList<string>>? stop = default,
bool? stream = false,
bool? strict = true,
global::OpenAI.ChatCompletionStreamOptions? streamOptions = default,
Expand Down Expand Up @@ -82,12 +82,12 @@ public partial class ChatClient
response);
}

/// <inheritdoc cref="CreateChatCompletionAsync(System.Collections.Generic.IList{ChatCompletionRequestMessage},System.AnyOf{string?,CreateChatCompletionRequestModel?},double?,CreateChatCompletionRequestLogitBias?,bool?,int?,int?,int?,double?,System.OneOf{ResponseFormatText,ResponseFormatJsonObject,ResponseFormatJsonSchema}?,int?,CreateChatCompletionRequestServiceTier?,System.OneOf{string?,System.Collections.Generic.IList{string}}?,bool?,ChatCompletionStreamOptions?,double?,double?,System.Collections.Generic.IList{ChatCompletionTool}?,ChatCompletionToolChoiceOption?,bool?,string?,System.Threading.CancellationToken)"/>
public async global::System.Threading.Tasks.Task<System.AnyOf<T, global::OpenAI.CreateChatCompletionResponse>>
/// <inheritdoc cref="CreateChatCompletionAsync(System.Collections.Generic.IList{ChatCompletionRequestMessage},OpenAI.AnyOf{string?,CreateChatCompletionRequestModel?},double?,CreateChatCompletionRequestLogitBias?,bool?,int?,int?,int?,double?,OpenAI.OneOf{ResponseFormatText,ResponseFormatJsonObject,ResponseFormatJsonSchema}?,int?,CreateChatCompletionRequestServiceTier?,OpenAI.OneOf{string?,System.Collections.Generic.IList{string}}?,bool?,ChatCompletionStreamOptions?,double?,double?,System.Collections.Generic.IList{ChatCompletionTool}?,ChatCompletionToolChoiceOption?,bool?,string?,System.Threading.CancellationToken)"/>
public async global::System.Threading.Tasks.Task<OpenAI.AnyOf<T, global::OpenAI.CreateChatCompletionResponse>>
CreateChatCompletionAsAsync<T>(
JsonTypeInfo<T> jsonTypeInfo,
global::System.Collections.Generic.IList<global::OpenAI.ChatCompletionRequestMessage> messages,
global::System.AnyOf<string, global::OpenAI.CreateChatCompletionRequestModel?> model,
global::OpenAI.AnyOf<string, global::OpenAI.CreateChatCompletionRequestModel?> model,
double? frequencyPenalty = 0,
global::OpenAI.CreateChatCompletionRequestLogitBias? logitBias = default,
bool? logprobs = false,
Expand All @@ -97,7 +97,7 @@ public partial class ChatClient
double? presencePenalty = 0,
int? seed = default,
global::OpenAI.CreateChatCompletionRequestServiceTier? serviceTier = default,
global::System.OneOf<string, global::System.Collections.Generic.IList<string>>? stop = default,
global::OpenAI.OneOf<string, global::System.Collections.Generic.IList<string>>? stop = default,
bool? stream = false,
bool? strict = true,
global::OpenAI.ChatCompletionStreamOptions? streamOptions = default,
Expand Down
6 changes: 3 additions & 3 deletions src/libs/OpenAI/ChatClient.CreateChatCompletion.AsStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,18 @@ public partial class ChatClient
/// <exception cref="global::System.InvalidOperationException"></exception>
public async IAsyncEnumerable<global::OpenAI.CreateChatCompletionStreamResponse> CreateChatCompletionAsStreamAsync(
global::System.Collections.Generic.IList<global::OpenAI.ChatCompletionRequestMessage> messages,
global::System.AnyOf<string, global::OpenAI.CreateChatCompletionRequestModel?> model,
global::OpenAI.AnyOf<string, global::OpenAI.CreateChatCompletionRequestModel?> model,
double? frequencyPenalty = 0,
global::OpenAI.CreateChatCompletionRequestLogitBias? logitBias = default,
bool? logprobs = false,
int? topLogprobs = default,
int? maxCompletionTokens = default,
int? n = 1,
double? presencePenalty = 0,
global::System.OneOf<global::OpenAI.ResponseFormatText, global::OpenAI.ResponseFormatJsonObject, global::OpenAI.ResponseFormatJsonSchema>? responseFormat = default,
global::OpenAI.OneOf<global::OpenAI.ResponseFormatText, global::OpenAI.ResponseFormatJsonObject, global::OpenAI.ResponseFormatJsonSchema>? responseFormat = default,
int? seed = default,
global::OpenAI.CreateChatCompletionRequestServiceTier? serviceTier = default,
global::System.OneOf<string, global::System.Collections.Generic.IList<string>>? stop = default,
global::OpenAI.OneOf<string, global::System.Collections.Generic.IList<string>>? stop = default,
bool? stream = false,
global::OpenAI.ChatCompletionStreamOptions? streamOptions = default,
double? temperature = 1,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/OpenAI/Generated/AnyOf.1.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#nullable enable

namespace System
namespace OpenAI
{
/// <summary>
///
Expand Down
2 changes: 1 addition & 1 deletion src/libs/OpenAI/Generated/AnyOf.2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#nullable enable

namespace System
namespace OpenAI
{
/// <summary>
///
Expand Down
10 changes: 5 additions & 5 deletions src/libs/OpenAI/Generated/JsonConverters.AnyOf1.g.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public class AnyOfJsonConverter<T1> : global::System.Text.Json.Serialization.JsonConverter<global::System.AnyOf<T1>>
public class AnyOfJsonConverter<T1> : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AnyOf<T1>>
{
/// <inheritdoc />
public override global::System.AnyOf<T1> Read(
public override global::OpenAI.AnyOf<T1> Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
Expand All @@ -27,7 +27,7 @@ public class AnyOfJsonConverter<T1> : global::System.Text.Json.Serialization.Jso
{
}

var result = new global::System.AnyOf<T1>(
var result = new global::OpenAI.AnyOf<T1>(
value1
);

Expand All @@ -44,7 +44,7 @@ public class AnyOfJsonConverter<T1> : global::System.Text.Json.Serialization.Jso
/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::System.AnyOf<T1> value,
global::OpenAI.AnyOf<T1> value,
global::System.Text.Json.JsonSerializerOptions options)
{
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
Expand Down
10 changes: 5 additions & 5 deletions src/libs/OpenAI/Generated/JsonConverters.AnyOf2.g.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public class AnyOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization.JsonConverter<global::System.AnyOf<T1, T2>>
public class AnyOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AnyOf<T1, T2>>
{
/// <inheritdoc />
public override global::System.AnyOf<T1, T2> Read(
public override global::OpenAI.AnyOf<T1, T2> Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
Expand Down Expand Up @@ -39,7 +39,7 @@ public class AnyOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization
{
}

var result = new global::System.AnyOf<T1, T2>(
var result = new global::OpenAI.AnyOf<T1, T2>(
value1,
value2
);
Expand All @@ -63,7 +63,7 @@ public class AnyOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization
/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::System.AnyOf<T1, T2> value,
global::OpenAI.AnyOf<T1, T2> value,
global::System.Text.Json.JsonSerializerOptions options)
{
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
Expand Down
4 changes: 2 additions & 2 deletions src/libs/OpenAI/Generated/JsonConverters.AnyOfFactory1.g.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AnyOfJsonConverterFactory1 : global::System.Text.Json.Serialization.JsonConverterFactory
{
/// <inheritdoc />
public override bool CanConvert(global::System.Type? typeToConvert)
{
return typeToConvert is { IsGenericType: true } && typeToConvert.GetGenericTypeDefinition() == typeof(global::System.AnyOf<>);
return typeToConvert is { IsGenericType: true } && typeToConvert.GetGenericTypeDefinition() == typeof(global::OpenAI.AnyOf<>);
}

/// <inheritdoc />
Expand Down
4 changes: 2 additions & 2 deletions src/libs/OpenAI/Generated/JsonConverters.AnyOfFactory2.g.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AnyOfJsonConverterFactory2 : global::System.Text.Json.Serialization.JsonConverterFactory
{
/// <inheritdoc />
public override bool CanConvert(global::System.Type? typeToConvert)
{
return typeToConvert is { IsGenericType: true } && typeToConvert.GetGenericTypeDefinition() == typeof(global::System.AnyOf<,>);
return typeToConvert is { IsGenericType: true } && typeToConvert.GetGenericTypeDefinition() == typeof(global::OpenAI.AnyOf<,>);
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantObjectObjectJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantObjectObject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantObjectObjectNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantObjectObject?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public class AssistantStreamEventJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantStreamEvent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsCodeTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsCodeType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsCodeTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsCodeType?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsFileSearchTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsFileSearchType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsFileSearchTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsFileSearchType?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsFileSearchTypeOnlyTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsFileSearchTypeOnlyType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsFileSearchTypeOnlyTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsFileSearchTypeOnlyType?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsFunctionTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsFunctionType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantToolsFunctionTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantToolsFunctionType?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public class AssistantsApiResponseFormatOptionJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsApiResponseFormatOption>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantsApiResponseFormatOptionEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsApiResponseFormatOptionEnum>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantsApiResponseFormatOptionEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsApiResponseFormatOptionEnum?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public class AssistantsApiToolChoiceOptionJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsApiToolChoiceOption>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantsApiToolChoiceOptionEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsApiToolChoiceOptionEnum>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantsApiToolChoiceOptionEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsApiToolChoiceOptionEnum?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantsNamedToolChoiceTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsNamedToolChoiceType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable enable

namespace OpenApiGenerator.JsonConverters
namespace OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantsNamedToolChoiceTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenAI.AssistantsNamedToolChoiceType?>
Expand Down
Loading

0 comments on commit 264a00d

Please sign in to comment.