├── src ├── key.snk ├── helpers │ ├── TrimmingHelper │ │ ├── Program.cs │ │ └── TrimmingHelper.csproj │ ├── FixOpenApiSpec │ │ ├── Properties │ │ │ └── launchSettings.json │ │ └── FixOpenApiSpec.csproj │ └── GenerateDocs │ │ └── GenerateDocs.csproj ├── tests │ └── OpenAI.IntegrationTests │ │ ├── Resources │ │ ├── audio_french.wav │ │ ├── images_dog_and_cat.png │ │ ├── images_flower_vase.png │ │ ├── audio_houseplant_care.mp3 │ │ └── images_flower_vase_mask.png │ │ ├── Examples │ │ ├── Examples.cs │ │ ├── Examples.Chat.StructuredOutputsClasses.cs │ │ ├── Examples.Chat.SimpleChat.cs │ │ ├── Examples.Audio.SimpleTranslation.cs │ │ ├── Examples.Audio.SimpleTranscription.cs │ │ ├── Examples.Assistants.ListFiles.cs │ │ ├── Examples.Chat.SimpleChatStreaming.cs │ │ ├── Examples.Chat.ChatWithVision.cs │ │ ├── Examples.Assistants.ListAssistantsWithPagination.cs │ │ ├── Examples.Chat.StructuredOutputs.cs │ │ ├── Examples.Assistants.AllToolsService.cs │ │ ├── Examples.Embeddings.SimpleEmbedding.cs │ │ ├── Examples.Embeddings.EmbeddingWithOptions.cs │ │ └── Examples.Audio.SimpleTextToSpeech.cs │ │ ├── CustomProvider.cs │ │ ├── Tests.ListModels.cs │ │ ├── Tests.Embeddings.cs │ │ ├── Tests.Moderation.cs │ │ └── Tools │ │ └── VariousTypesTools.cs ├── Directory.Build.props └── libs │ └── tryAGI.OpenAI │ ├── OpenAiApi.Headers.cs │ ├── Generated │ ├── tryAGI.OpenAI.IOpenAiClient.Authorizations.Bearer.g.cs │ ├── tryAGI.OpenAI.Models.CompoundFilterFilter.g.cs │ ├── tryAGI.OpenAI.Models.FunctionToolParameters2.g.cs │ ├── tryAGI.OpenAI.Models.RunGraderResponseSubRewards.g.cs │ ├── tryAGI.OpenAI.Models.RunGraderResponseSubRewards2.g.cs │ ├── tryAGI.OpenAI.Models.RunGraderResponseMetadataScores.g.cs │ ├── tryAGI.OpenAI.Models.RunGraderResponseMetadataScores2.g.cs │ ├── tryAGI.OpenAI.Models.ListPaginatedFineTuningJobsMetadata.g.cs │ ├── tryAGI.OpenAI.Models.FineTuningJobEventData.g.cs │ ├── tryAGI.OpenAI.Models.EvalJsonlFileContentSourceContentItemItem.g.cs │ ├── tryAGI.OpenAI.Models.BatchRequestOutputResponseBody.g.cs │ ├── tryAGI.OpenAI.Models.EvalJsonlFileContentSourceContentItemSample.g.cs │ ├── tryAGI.OpenAI.Models.LocalShellExecActionEnv.g.cs │ ├── tryAGI.OpenAI.Models.MCPListToolsToolAnnotations.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeResponseStatusDetails.g.cs │ ├── tryAGI.OpenAI.Models.RunGraderResponseModelGraderTokenUsagePerModel.g.cs │ ├── tryAGI.OpenAI.Models.RunGraderResponseModelGraderTokenUsagePerModel2.g.cs │ ├── tryAGI.OpenAI.Models.CreateCompletionResponseChoiceLogprobsTopLogprob.g.cs │ ├── tryAGI.OpenAI.Models.MCPListToolsToolInputSchema.g.cs │ ├── tryAGI.OpenAI.Models.CreateThreadRequestToolResourcesFileSearchVariant1.g.cs │ ├── tryAGI.OpenAI.Models.CreateThreadRequestToolResourcesFileSearchVariant2.g.cs │ ├── tryAGI.OpenAI.Models.EvalRunOutputItemDatasourceItem.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeFunctionToolParameters.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeSessionToolParameters.g.cs │ ├── tryAGI.OpenAI.Models.ToolChoiceAllowedTool.g.cs │ ├── tryAGI.OpenAI.Models.CreateAssistantRequestToolResourcesFileSearchVariant1.g.cs │ ├── tryAGI.OpenAI.Models.CreateAssistantRequestToolResourcesFileSearchVariant2.g.cs │ ├── tryAGI.OpenAI.Models.FunctionToolParameters.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.GetEval.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.DeleteContainer.g.cs │ ├── tryAGI.OpenAI.Models.ChatCompletionAllowedToolsTool.g.cs │ ├── tryAGI.OpenAI.Models.CreateEvalLogsDataSourceConfigMetadata.g.cs │ ├── tryAGI.OpenAI.Models.EvalRunOutputItemResultSample.g.cs │ ├── tryAGI.OpenAI.IFilesClient.DeleteFile.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeSessionCreateRequestToolParameters.g.cs │ ├── tryAGI.OpenAI.IBatchClient.RetrieveBatch.g.cs │ ├── tryAGI.OpenAI.Models.CreateEvalCustomDataSourceConfigItemSchema.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeBetaResponseCreateParamsToolParameters.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeResponseCreateResponseToolParameters.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.DeleteEval.g.cs │ ├── tryAGI.OpenAI.IFilesClient.DownloadFile.g.cs │ ├── tryAGI.OpenAI.Models.MCPToolHeaders.g.cs │ ├── tryAGI.OpenAI.OpenAiClient.Authorizations.Bearer.g.cs │ ├── tryAGI.OpenAI.IInvitesClient.RetrieveInvite.g.cs │ ├── tryAGI.OpenAI.IUsersClient.RetrieveUser.g.cs │ ├── tryAGI.OpenAI.Models.EvalResponsesSourceMetadata.g.cs │ ├── tryAGI.OpenAI.IFilesClient.RetrieveFile.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.RetrieveProject.g.cs │ ├── tryAGI.OpenAI.IUsersClient.DeleteUser.g.cs │ ├── tryAGI.OpenAI.IModelsClient.ListModels.g.cs │ ├── tryAGI.OpenAI.Models.CreateEvalStoredCompletionsDataSourceConfigMetadata.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.RetrieveContainer.g.cs │ ├── tryAGI.OpenAI.Models.ResponseOutputTextAnnotationAddedEventAnnotation.g.cs │ ├── tryAGI.OpenAI.Models.RunStepDeltaStepDetailsToolCallsFileSearchObjectFileSearch.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.GetVectorStore.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeSessionCreateRequestModalities.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStore.g.cs │ ├── tryAGI.OpenAI.Models.EvalCustomDataSourceConfigSchema.g.cs │ ├── tryAGI.OpenAI.Models.EvalLogsDataSourceConfigSchema.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeSessionCreateResponseOutputModalities.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeSessionCreateRequestTracingEnumMetadata.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeSessionCreateRequestGATracingEnumMetadata.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeSessionCreateResponseTracingEnumMetadata.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.GetEvalRun.g.cs │ ├── tryAGI.OpenAI.IInvitesClient.DeleteInvite.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.DeleteContainerFile.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.ArchiveProject.g.cs │ ├── tryAGI.OpenAI.Models.RealtimeTranscriptionSessionCreateResponseModalities.g.cs │ ├── tryAGI.OpenAI.Models.ResponseFormatJsonSchemaSchema.g.cs │ ├── tryAGI.OpenAI.Models.EvalStoredCompletionsDataSourceConfigSchema.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.CancelEvalRun.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.DeleteEvalRun.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.AdminApiKeysGet.g.cs │ ├── tryAGI.OpenAI.IResponsesClient.DeleteResponse.g.cs │ ├── tryAGI.OpenAI.Models.RunGraderRequestItem.g.cs │ ├── tryAGI.OpenAI.IConversationsClient.GetConversation.g.cs │ ├── tryAGI.OpenAI.IUploadsClient.CancelUpload.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.PauseFineTuningJob.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFileContent.g.cs │ ├── tryAGI.OpenAI.Models.ResponsePromptVariables.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.ResumeFineTuningJob.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.AdminApiKeysDelete.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.RetrieveProjectUser.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.CancelFineTuningJob.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFile.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.DeleteProjectUser.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.RetrieveProjectApiKey.g.cs │ ├── tryAGI.OpenAI.IModelsClient.RetrieveModel.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.DeleteProjectApiKey.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.GetThread.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.DeleteThread.g.cs │ ├── tryAGI.OpenAI.IBatchClient.ListBatches.g.cs │ ├── tryAGI.OpenAI.IBatchClient.CancelBatch.g.cs │ ├── tryAGI.OpenAI.IConversationsClient.DeleteConversation.g.cs │ ├── tryAGI.OpenAI.ICertificatesClient.DeleteCertificate.g.cs │ ├── tryAGI.OpenAI.IModelsClient.DeleteModel.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.GetAssistant.g.cs │ ├── tryAGI.OpenAI.IChatClient.DeleteChatCompletion.g.cs │ ├── tryAGI.OpenAI.IChatClient.GetChatCompletion.g.cs │ ├── tryAGI.OpenAI.IInvitesClient.ListInvites.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.DeleteAssistant.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.RetrieveProjectServiceAccount.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.DeleteProjectServiceAccount.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.GetRun.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.GetEvalRunOutputItem.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.CancelRun.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.GetMessage.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.DeleteMessage.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.RetrieveFineTuningJob.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.CancelVectorStoreFileBatch.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.GetVectorStoreFile.g.cs │ ├── tryAGI.OpenAI.Models.FunctionParameters.g.cs │ ├── tryAGI.OpenAI.IConversationsClient.DeleteConversationItem.g.cs │ ├── tryAGI.OpenAI.Models.Metadata.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.ListProjectUsers.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.GetVectorStoreFileBatch.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.ListProjectApiKeys.g.cs │ ├── tryAGI.OpenAI.Models.ConversationResourceMetadata.g.cs │ ├── tryAGI.OpenAI.IUsersClient.ListUsers.g.cs │ ├── tryAGI.OpenAI.IResponsesClient.CancelResponse.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileContent.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.ListProjects.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.ListProjectServiceAccounts.g.cs │ ├── tryAGI.OpenAI.Models.VectorStoreFileAttributes.g.cs │ ├── tryAGI.OpenAI.ICertificatesClient.GetCertificate.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.ListContainers.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStoreFile.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.ListPaginatedFineTuningJobs.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.ListFineTuningEvents.g.cs │ ├── tryAGI.OpenAI.IProjectsClient.ListProjectRateLimits.g.cs │ ├── tryAGI.OpenAI.IFilesClient.ListFiles.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.ListFineTuningJobCheckpoints.g.cs │ ├── tryAGI.OpenAI.IConversationsClient.GetConversationItem.g.cs │ ├── tryAGI.OpenAI.ICertificatesClient.ListOrganizationCertificates.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.ListContainerFiles.g.cs │ ├── tryAGI.OpenAI.IVectorStoresClient.ListVectorStores.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.GetRunStep.g.cs │ ├── tryAGI.OpenAI.OpenAiClient.Constructors.Bearer.g.cs │ ├── tryAGI.OpenAI.ICertificatesClient.ListProjectCertificates.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.ListEvals.g.cs │ ├── tryAGI.OpenAI.IEvalsClient.GetEvalRuns.g.cs │ ├── tryAGI.OpenAI.Models.DoneEventData.g.cs │ ├── tryAGI.OpenAI.IFineTuningClient.DeleteFineTuningCheckpointPermission.g.cs │ ├── tryAGI.OpenAI.IResponsesClient.ListInputItems.g.cs │ ├── tryAGI.OpenAI.Models.CreateChatCompletionRequestVariant2LogitBias.g.cs │ ├── tryAGI.OpenAI.Models.DoneEventEvent.g.cs │ ├── tryAGI.OpenAI.Models.ErrorEventEvent.g.cs │ ├── tryAGI.OpenAI.Models.MCPToolType.g.cs │ ├── tryAGI.OpenAI.IResponsesClient.GetResponse.g.cs │ ├── tryAGI.OpenAI.Models.BatchObject.g.cs │ ├── tryAGI.OpenAI.Models.EvalObject.g.cs │ ├── tryAGI.OpenAI.Models.ModelObject.g.cs │ ├── tryAGI.OpenAI.Models.TextContentType.g.cs │ ├── tryAGI.OpenAI.IAssistantsClient.ListAssistants.g.cs │ ├── tryAGI.OpenAI.Models.UploadObject.g.cs │ ├── tryAGI.OpenAI.Models.UsageResponseObject.g.cs │ ├── tryAGI.OpenAI.IOpenAiClient.AdminApiKeysList.g.cs │ ├── tryAGI.OpenAI.Models.EvalItemType.g.cs │ ├── tryAGI.OpenAI.Models.CustomToolType.g.cs │ ├── tryAGI.OpenAI.Models.FilePathType.g.cs │ ├── tryAGI.OpenAI.Models.OpenAIFileObject.g.cs │ ├── tryAGI.OpenAI.Models.ToolChoiceMCPType.g.cs │ ├── tryAGI.OpenAI.Models.UserListResponseObject.g.cs │ ├── tryAGI.OpenAI.Models.TranscriptionInclude.g.cs │ └── tryAGI.OpenAI.Models.UsageCostsBucketWidth.g.cs │ ├── Client │ ├── Extensions │ │ └── SnakeCaseNamingPolicy.cs │ └── Authentication │ │ └── AuthInfo.cs │ ├── Image.Bytes.cs │ ├── generate.sh │ ├── asyncapi.yml │ ├── JsonSerializerContextTypes.AdditionalTypes.cs │ ├── Metadata │ └── Metadata.cs │ └── Conversions │ ├── CreateChatCompletionResponse.cs │ ├── CreateChatCompletionStreamResponse.cs │ ├── ChatCompletionRequestUserMessage.cs │ ├── MessageContentImageUrlObject.cs │ └── MessageContentImageFileObject.cs ├── assets ├── orange.png └── nuget_icon.png ├── docs ├── media │ └── icon128.png └── samples │ ├── Chat.SimpleChat.md │ ├── Chat.StructuredOutputsClasses.md │ ├── Audio.SimpleTranslation.md │ ├── Audio.SimpleTranscription.md │ ├── Assistants.ListFiles.md │ ├── Chat.SimpleChatStreaming.md │ ├── Assistants.ListAssistantsWithPagination.md │ ├── Chat.ChatWithVision.md │ ├── Chat.StructuredOutputs.md │ ├── Embeddings.SimpleEmbedding.md │ ├── Embeddings.EmbeddingWithOptions.md │ ├── Assistants.AllToolsService.md │ ├── Audio.SimpleTextToSpeech.md │ ├── Images.SimpleImageVariation.md │ ├── Embeddings.MultipleEmbeddings.md │ └── Audio.VerboseTranscription.md ├── global.json ├── .github ├── workflows │ └── pull-request.yml └── dependabot.yml ├── OpenAI.sln.DotSettings └── LICENSE /src/key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/src/key.snk -------------------------------------------------------------------------------- /assets/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/assets/orange.png -------------------------------------------------------------------------------- /assets/nuget_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/assets/nuget_icon.png -------------------------------------------------------------------------------- /docs/media/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/docs/media/icon128.png -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "rollForward": "latestMajor", 4 | "allowPrerelease": false 5 | } 6 | } -------------------------------------------------------------------------------- /src/helpers/TrimmingHelper/Program.cs: -------------------------------------------------------------------------------- 1 | Console.WriteLine("Build, rebuild or publish this app to see trimming warnings."); -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Resources/audio_french.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/src/tests/OpenAI.IntegrationTests/Resources/audio_french.wav -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Resources/images_dog_and_cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/src/tests/OpenAI.IntegrationTests/Resources/images_dog_and_cat.png -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Resources/images_flower_vase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/src/tests/OpenAI.IntegrationTests/Resources/images_flower_vase.png -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Resources/audio_houseplant_care.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/src/tests/OpenAI.IntegrationTests/Resources/audio_houseplant_care.mp3 -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Resources/images_flower_vase_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tryAGI/OpenAI/HEAD/src/tests/OpenAI.IntegrationTests/Resources/images_flower_vase_mask.png -------------------------------------------------------------------------------- /src/helpers/FixOpenApiSpec/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "FixOpenApiSpec": { 4 | "commandName": "Project", 5 | "commandLineArgs": "../../../../../../src/libs/tryAGI.OpenAI/openapi.yaml" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | preview 5 | enable 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/helpers/GenerateDocs/GenerateDocs.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/OpenAiApi.Headers.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | 3 | namespace tryAGI.OpenAI; 4 | 5 | public partial class OpenAiClient 6 | { 7 | partial void Initialized(HttpClient client) 8 | { 9 | client.DefaultRequestHeaders.Add("OpenAI-Beta", "assistants=v2"); 10 | } 11 | } -------------------------------------------------------------------------------- /docs/samples/Chat.SimpleChat.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | CreateChatCompletionResponse response = await api.Chat.CreateChatCompletionAsync( 5 | messages: ["Say 'this is a test.'"], 6 | model: ModelIdsEnum.Gpt4o); 7 | 8 | Console.WriteLine("[ASSISTANT]:"); 9 | Console.WriteLine($"{response.Choices[0].Message.Content}"); 10 | ``` -------------------------------------------------------------------------------- /docs/samples/Chat.StructuredOutputsClasses.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | public class MathReasoning 3 | { 4 | public MathReasoningStep[] Steps { get; set; } = []; 5 | public string FinalAnswer { get; set; } = string.Empty; 6 | } 7 | 8 | public class MathReasoningStep 9 | { 10 | public string Explanation { get; set; } = string.Empty; 11 | public string Output { get; set; } = string.Empty; 12 | } 13 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.Authorizations.Bearer.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | public partial interface IOpenAiClient 7 | { 8 | /// 9 | /// Authorize using bearer authentication. 10 | /// 11 | /// 12 | public void AuthorizeUsingBearer( 13 | string apiKey); 14 | } 15 | } -------------------------------------------------------------------------------- /docs/samples/Audio.SimpleTranslation.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | OneOf response = await api.Audio.CreateTranslationAsync( 5 | file: H.Resources.audio_french_wav.AsBytes(), 6 | filename: H.Resources.audio_french_wav.FileName, 7 | model: CreateTranslationRequestModel.Whisper1); 8 | 9 | Console.WriteLine($"{response.Value1?.Text}"); 10 | ``` -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | public partial class Examples 4 | { 5 | public static OpenAiClient GetAuthenticatedClient() 6 | { 7 | return new OpenAiClient(apiKey: 8 | Environment.GetEnvironmentVariable("OPENAI_API_KEY") ?? 9 | throw new AssertInconclusiveException("OPENAI_API_KEY environment variable is not found.")); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /docs/samples/Audio.SimpleTranscription.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | OneOf response = await api.Audio.CreateTranscriptionAsync( 5 | file: H.Resources.audio_houseplant_care_mp3.AsBytes(), 6 | filename: H.Resources.audio_houseplant_care_mp3.FileName, 7 | model: CreateTranscriptionRequestModel.Whisper1); 8 | 9 | Console.WriteLine($"{response.Value1?.Text}"); 10 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Client/Extensions/SnakeCaseNamingPolicy.cs: -------------------------------------------------------------------------------- 1 | // // Licensed under the MIT License. See LICENSE in the project root for license information. 2 | // 3 | // using System.Text.Json; 4 | // 5 | // namespace tryAGI.OpenAI.Extensions 6 | // { 7 | // internal sealed class SnakeCaseNamingPolicy : JsonNamingPolicy 8 | // { 9 | // public override string ConvertName(string name) 10 | // => StringExtensions.ToSnakeCase(name); 11 | // } 12 | // } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/CustomProvider.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests; 2 | 3 | public enum CustomProvider 4 | { 5 | OpenAi, 6 | Azure, 7 | Together, 8 | Fireworks, 9 | DeepInfra, 10 | DeepSeek, 11 | OpenRouter, 12 | GitHub, 13 | Perplexity, 14 | SambaNova, 15 | Ollama, 16 | LmStudio, 17 | Groq, 18 | XAi, 19 | Mistral, 20 | Codestral, 21 | Hyperbolic, 22 | Cerebras, 23 | Cohere, 24 | } -------------------------------------------------------------------------------- /docs/samples/Assistants.ListFiles.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | int count = 0; 5 | 6 | ListFilesResponse files = await api.Files.ListFilesAsync(purpose: CreateFileRequestPurpose.Assistants.ToValueString()); 7 | foreach (OpenAIFile file in files.Data) 8 | { 9 | Console.WriteLine($"[{count,3}] {file.Id} {file.CreatedAt:s} {file.Filename}"); 10 | 11 | count++; 12 | 13 | //_ = await api.Files.DeleteFileAsync(file.Id); 14 | } 15 | ``` -------------------------------------------------------------------------------- /.github/workflows/pull-request.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | pull_request: 4 | branches: 5 | - main 6 | 7 | jobs: 8 | test: 9 | name: Test 10 | if: github.event.pull_request.draft == false 11 | uses: HavenDV/workflows/.github/workflows/dotnet_build-test-publish.yml@main 12 | with: 13 | generate-build-number: false 14 | conventional-commits-publish-conditions: false 15 | enable-caching: false 16 | additional-test-arguments: '--logger GitHubActions' -------------------------------------------------------------------------------- /docs/samples/Chat.SimpleChatStreaming.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | IAsyncEnumerable enumerable = api.Chat.CreateChatCompletionAsStreamAsync( 5 | messages: ["Say 'this is a test.'"], 6 | model: ModelIdsEnum.Gpt4o); 7 | 8 | Console.WriteLine("[ASSISTANT]:"); 9 | await foreach (CreateChatCompletionStreamResponse chatUpdate in enumerable) 10 | { 11 | Console.Write(chatUpdate.Choices[0].Delta.Content); 12 | } 13 | ``` -------------------------------------------------------------------------------- /docs/samples/Assistants.ListAssistantsWithPagination.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | int count = 0; 5 | 6 | ListAssistantsResponse response = await api.Assistants.ListAssistantsAsync(); 7 | foreach (AssistantObject assistant in response.Data) 8 | { 9 | Console.WriteLine($"[{count,3}] {assistant.Id} {assistant.CreatedAt:s} {assistant.Name}"); 10 | 11 | count++; 12 | 13 | //_ = await api.Assistants.DeleteAssistantAsync(assistant.Id); 14 | } 15 | ``` -------------------------------------------------------------------------------- /docs/samples/Chat.ChatWithVision.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | CreateChatCompletionResponse response = await api.Chat.CreateChatCompletionAsync( 5 | messages: [ 6 | "Please describe the following image.", 7 | H.Resources.images_dog_and_cat_png.AsBytes().AsUserMessage(mimeType: "image/png"), 8 | ], 9 | model: ModelIdsEnum.Gpt4o); 10 | 11 | Console.WriteLine("[ASSISTANT]:"); 12 | Console.WriteLine($"{response.Choices[0].Message.Content}"); 13 | ``` -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Chat.StructuredOutputsClasses.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | // # START EXAMPLE # 4 | 5 | public class MathReasoning 6 | { 7 | public MathReasoningStep[] Steps { get; set; } = []; 8 | public string FinalAnswer { get; set; } = string.Empty; 9 | } 10 | 11 | public class MathReasoningStep 12 | { 13 | public string Explanation { get; set; } = string.Empty; 14 | public string Output { get; set; } = string.Empty; 15 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Tests.ListModels.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests; 2 | 3 | public partial class Tests 4 | { 5 | [TestMethod] 6 | public async Task ListModels() 7 | { 8 | var api = GetAuthorizedApi(); 9 | var models = await api.Models.ListModelsAsync(); 10 | models.Data.Should().NotBeEmpty(); 11 | 12 | foreach (var model in models.Data) 13 | { 14 | Console.WriteLine($"{model.Id}"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Image.Bytes.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI; 2 | 3 | public partial class Image2 4 | { 5 | /// 6 | /// Returns bytes of base64-encoded JSON of the generated image. 7 | /// 8 | /// 9 | public byte[] Bytes => B64Json == null || string.IsNullOrWhiteSpace(B64Json) 10 | ? throw new InvalidOperationException("The image is not available in base64 format.") 11 | : Convert.FromBase64String(B64Json); 12 | } -------------------------------------------------------------------------------- /src/helpers/FixOpenApiSpec/FixOpenApiSpec.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | Exe 6 | preview 7 | enable 8 | enable 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/generate.sh: -------------------------------------------------------------------------------- 1 | dotnet tool install --global autosdk.cli --prerelease 2 | curl -o openapi.yaml https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml 3 | dotnet run --project ../../helpers/FixOpenApiSpec openapi.yaml 4 | if [ $? -ne 0 ]; then 5 | echo "Failed, exiting..." 6 | exit 1 7 | fi 8 | rm -rf Generated 9 | autosdk generate openapi.yaml \ 10 | --namespace tryAGI.OpenAI \ 11 | --clientClassName OpenAiClient \ 12 | --targetFramework net8.0 \ 13 | --output Generated \ 14 | --exclude-deprecated-operations \ 15 | --ignore-openapi-errors -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/asyncapi.yml: -------------------------------------------------------------------------------- 1 | asyncapi: '3.0.0' 2 | info: 3 | title: an AsyncAPI document for OpenAI 4 | version: '1.0.0' 5 | 6 | servers: 7 | production: 8 | host: api.openai.com 9 | pathname: v1/realtime?model=gpt-4o-realtime-preview-2024-10-01 10 | protocol: wss 11 | description: Slack's server in Socket Mode for real-time communication 12 | security: 13 | - $ref: '#/components/securitySchemes/bearer' 14 | 15 | components: 16 | securitySchemes: 17 | bearerAuth: 18 | type: http 19 | scheme: bearer 20 | bearerFormat: JWT 21 | -------------------------------------------------------------------------------- /OpenAI.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True 3 | True 4 | True -------------------------------------------------------------------------------- /docs/samples/Chat.StructuredOutputs.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | MathReasoning? mathReasoning = await api.Chat.CreateChatCompletionAsAsync( 5 | messages: ["How can I solve 8x + 7 = -23?"], 6 | model: ModelIdsEnum.Gpt4o20240806, 7 | strict: true); 8 | 9 | Console.WriteLine($"Final answer: {mathReasoning?.FinalAnswer}"); 10 | Console.WriteLine("Reasoning steps:"); 11 | 12 | foreach (MathReasoningStep step in mathReasoning?.Steps ?? []) 13 | { 14 | Console.WriteLine($" - Explanation: {step.Explanation}"); 15 | Console.WriteLine($" Output: {step.Output}"); 16 | } 17 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/JsonSerializerContextTypes.AdditionalTypes.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI; 2 | 3 | public sealed partial class JsonSerializerContextTypes 4 | { 5 | /// 6 | /// To fix issue with LogitBias. 7 | /// 8 | public Dictionary? StringDoubleDictionary { get; set; } 9 | 10 | /// 11 | /// 12 | /// 13 | public CreateChatCompletionStreamResponse? CreateChatCompletionStreamResponse { get; set; } 14 | 15 | /// 16 | /// 17 | /// 18 | public CSharpToJsonSchema.OpenApiSchema? OpenApiSchema { get; set; } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CompoundFilterFilter.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class CompoundFilterFilter 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.FunctionToolParameters2.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class FunctionToolParameters2 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunGraderResponseSubRewards.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class RunGraderResponseSubRewards 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunGraderResponseSubRewards2.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class RunGraderResponseSubRewards2 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunGraderResponseMetadataScores.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class RunGraderResponseMetadataScores 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunGraderResponseMetadataScores2.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class RunGraderResponseMetadataScores2 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Metadata/Metadata.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace tryAGI.OpenAI; 3 | 4 | /// 5 | /// According https://openai.com/pricing/ 6 | /// 7 | public static partial class MetadataExtensions 8 | { 9 | /// 10 | /// Just a constant for 1e-3. 11 | /// 12 | public const double UsdPerThousandTokens = 1e-3; 13 | 14 | /// 15 | /// Just a constant for 1e-6. 16 | /// 17 | public const double UsdPerMillionTokens = 1e-6; 18 | 19 | /// 20 | /// Just a constant for 1e-9. 21 | /// 22 | public const double UsdPerBillionTokens = 1e-9; 23 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Chat.SimpleChat.cs: -------------------------------------------------------------------------------- 1 | // namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | // 3 | // public partial class Examples 4 | // { 5 | // [Test] 6 | // [Explicit] 7 | // public async Task SimpleChat() 8 | // { 9 | // using var api = GetAuthenticatedClient(); 10 | // 11 | // CreateChatCompletionResponse response = await api.Chat.CreateChatCompletionAsync( 12 | // messages: ["Say 'this is a test.'"], 13 | // model: ModelIdsEnum.Gpt4o); 14 | // 15 | // Console.WriteLine("[ASSISTANT]:"); 16 | // Console.WriteLine($"{response.Choices[0].Message.Content}"); 17 | // } 18 | // } 19 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ListPaginatedFineTuningJobsMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class ListPaginatedFineTuningJobsMetadata 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | groups: 13 | all: 14 | patterns: 15 | - "*" 16 | ignore: 17 | - dependency-name: Microsoft.CodeAnalysis.CSharp 18 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.FineTuningJobEventData.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The data associated with the event. 8 | /// 9 | public sealed partial class FineTuningJobEventData 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalJsonlFileContentSourceContentItemItem.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class EvalJsonlFileContentSourceContentItemItem 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.BatchRequestOutputResponseBody.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The JSON body of the response 8 | /// 9 | public sealed partial class BatchRequestOutputResponseBody 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalJsonlFileContentSourceContentItemSample.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class EvalJsonlFileContentSourceContentItemSample 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.LocalShellExecActionEnv.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Environment variables to set for the command. 8 | /// 9 | public sealed partial class LocalShellExecActionEnv 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.MCPListToolsToolAnnotations.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Additional annotations about the tool. 8 | /// 9 | public sealed partial class MCPListToolsToolAnnotations 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeResponseStatusDetails.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Additional details about the status. 8 | /// 9 | public sealed partial class RealtimeResponseStatusDetails 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunGraderResponseModelGraderTokenUsagePerModel.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class RunGraderResponseModelGraderTokenUsagePerModel 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunGraderResponseModelGraderTokenUsagePerModel2.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class RunGraderResponseModelGraderTokenUsagePerModel2 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateCompletionResponseChoiceLogprobsTopLogprob.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class CreateCompletionResponseChoiceLogprobsTopLogprob 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.MCPListToolsToolInputSchema.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The JSON schema describing the tool's input. 8 | /// 9 | public sealed partial class MCPListToolsToolInputSchema 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateThreadRequestToolResourcesFileSearchVariant1.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class CreateThreadRequestToolResourcesFileSearchVariant1 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateThreadRequestToolResourcesFileSearchVariant2.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class CreateThreadRequestToolResourcesFileSearchVariant2 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalRunOutputItemDatasourceItem.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Details of the input data source item. 8 | /// 9 | public sealed partial class EvalRunOutputItemDatasourceItem 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeFunctionToolParameters.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Parameters of the function in JSON Schema. 8 | /// 9 | public sealed partial class RealtimeFunctionToolParameters 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeSessionToolParameters.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Parameters of the function in JSON Schema. 8 | /// 9 | public sealed partial class RealtimeSessionToolParameters 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ToolChoiceAllowedTool.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// A tool definition that the model should be allowed to call. 8 | /// 9 | public sealed partial class ToolChoiceAllowedTool 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Audio.SimpleTranslation.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | public partial class Examples 4 | { 5 | [Test] 6 | [Explicit] 7 | public async Task SimpleTranslation() 8 | { 9 | using var api = GetAuthenticatedClient(); 10 | 11 | OneOf response = await api.Audio.CreateTranslationAsync( 12 | file: H.Resources.audio_french_wav.AsBytes(), 13 | filename: H.Resources.audio_french_wav.FileName, 14 | model: CreateTranslationRequestModel.Whisper1); 15 | 16 | Console.WriteLine($"{response.Value1?.Text}"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateAssistantRequestToolResourcesFileSearchVariant1.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class CreateAssistantRequestToolResourcesFileSearchVariant1 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateAssistantRequestToolResourcesFileSearchVariant2.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public sealed partial class CreateAssistantRequestToolResourcesFileSearchVariant2 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.FunctionToolParameters.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// A JSON schema object describing the parameters of the function. 8 | /// 9 | public sealed partial class FunctionToolParameters 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEval.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// Get an eval
9 | /// Get an evaluation by ID. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task GetEvalAsync( 15 | string evalId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteContainer.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// Delete a container
9 | /// Delete Container 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task DeleteContainerAsync( 15 | string containerId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ChatCompletionAllowedToolsTool.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// A tool definition that the model should be allowed to call. 8 | /// 9 | public sealed partial class ChatCompletionAllowedToolsTool 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateEvalLogsDataSourceConfigMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Metadata filters for the logs data source. 8 | /// 9 | public sealed partial class CreateEvalLogsDataSourceConfigMetadata 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalRunOutputItemResultSample.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Optional sample or intermediate data produced by the grader. 8 | /// 9 | public sealed partial class EvalRunOutputItemResultSample 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Tests.Embeddings.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests; 2 | 3 | public partial class Tests 4 | { 5 | [TestMethod] 6 | public async Task CreateEmbedding() 7 | { 8 | var api = GetAuthorizedApi(); 9 | var response = await api.Embeddings.CreateEmbeddingAsync( 10 | input: "Hello, world", 11 | model: CreateEmbeddingRequestModel.TextEmbedding3Small, 12 | user: "tryAGI.OpenAI.IntegrationTests.Tests.CreateEmbedding"); 13 | response.Data.ElementAt(0).Embedding1.Should().NotBeEmpty(); 14 | 15 | foreach (var data in response.Data.ElementAt(0).Embedding1) 16 | { 17 | Console.WriteLine($"{data}"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.DeleteFile.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFilesClient 6 | { 7 | /// 8 | /// Delete file
9 | /// Delete a file. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task DeleteFileAsync( 15 | string fileId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeSessionCreateRequestToolParameters.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Parameters of the function in JSON Schema. 8 | /// 9 | public sealed partial class RealtimeSessionCreateRequestToolParameters 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.RetrieveBatch.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IBatchClient 6 | { 7 | /// 8 | /// Retrieve batch
9 | /// Retrieves a batch. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task RetrieveBatchAsync( 15 | string batchId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateEvalCustomDataSourceConfigItemSchema.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The json schema for each row in the data source. 8 | /// 9 | public sealed partial class CreateEvalCustomDataSourceConfigItemSchema 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeBetaResponseCreateParamsToolParameters.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Parameters of the function in JSON Schema. 8 | /// 9 | public sealed partial class RealtimeBetaResponseCreateParamsToolParameters 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeResponseCreateResponseToolParameters.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Parameters of the function in JSON Schema. 8 | /// 9 | public sealed partial class RealtimeResponseCreateResponseToolParameters 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Audio.SimpleTranscription.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | public partial class Examples 4 | { 5 | [Test] 6 | [Explicit] 7 | public async Task SimpleTranscription() 8 | { 9 | using var api = GetAuthenticatedClient(); 10 | 11 | OneOf response = await api.Audio.CreateTranscriptionAsync( 12 | file: H.Resources.audio_houseplant_care_mp3.AsBytes(), 13 | filename: H.Resources.audio_houseplant_care_mp3.FileName, 14 | model: CreateTranscriptionRequestModel.Whisper1); 15 | 16 | Console.WriteLine($"{response.Value1?.Text}"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteEval.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// Delete an eval
9 | /// Delete an evaluation. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task DeleteEvalAsync( 15 | string evalId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.DownloadFile.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFilesClient 6 | { 7 | /// 8 | /// Retrieve file content
9 | /// Returns the contents of the specified file. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task DownloadFileAsync( 15 | string fileId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.MCPToolHeaders.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Optional HTTP headers to send to the MCP server. Use for authentication
8 | /// or other purposes. 9 | ///
10 | public sealed partial class MCPToolHeaders 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.Authorizations.Bearer.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | public sealed partial class OpenAiClient 7 | { 8 | /// 9 | public void AuthorizeUsingBearer( 10 | string apiKey) 11 | { 12 | apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey)); 13 | 14 | Authorizations.Clear(); 15 | Authorizations.Add(new global::tryAGI.OpenAI.EndPointAuthorization 16 | { 17 | Type = "Http", 18 | Location = "Header", 19 | Name = "Bearer", 20 | Value = apiKey, 21 | }); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.RetrieveInvite.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IInvitesClient 6 | { 7 | /// 8 | /// Retrieve invite
9 | /// Retrieves an invite. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task RetrieveInviteAsync( 15 | string inviteId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.RetrieveUser.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IUsersClient 6 | { 7 | /// 8 | /// Retrieve user
9 | /// Retrieves a user by their identifier. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task RetrieveUserAsync( 15 | string userId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalResponsesSourceMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Metadata filter for the responses. This is a query parameter used to select responses. 8 | /// 9 | public sealed partial class EvalResponsesSourceMetadata 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFile.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFilesClient 6 | { 7 | /// 8 | /// Retrieve file
9 | /// Returns information about a specific file. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task RetrieveFileAsync( 15 | string fileId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProject.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Retrieve project
9 | /// Retrieves a project. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task RetrieveProjectAsync( 15 | string projectId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.DeleteUser.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IUsersClient 6 | { 7 | /// 8 | /// Delete user
9 | /// Deletes a user from the organization. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task DeleteUserAsync( 15 | string userId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.ListModels.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IModelsClient 6 | { 7 | /// 8 | /// List models
9 | /// Lists the currently available models, and provides basic information about each one such as the owner and availability. 10 | ///
11 | /// The token to cancel the operation with 12 | /// 13 | global::System.Threading.Tasks.Task ListModelsAsync( 14 | global::System.Threading.CancellationToken cancellationToken = default); 15 | } 16 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateEvalStoredCompletionsDataSourceConfigMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Metadata filters for the stored completions data source. 8 | /// 9 | public sealed partial class CreateEvalStoredCompletionsDataSourceConfigMetadata 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainer.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// Retrieve container
9 | /// Retrieve Container 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task RetrieveContainerAsync( 15 | string containerId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /docs/samples/Embeddings.SimpleEmbedding.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | CreateEmbeddingResponse embedding = await api.Embeddings.CreateEmbeddingAsync( 5 | input: "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa," 6 | + " and a really helpful concierge. The location is perfect -- right downtown, close to all the tourist" 7 | + " attractions. We highly recommend this hotel.", 8 | model: CreateEmbeddingRequestModel.TextEmbedding3Small); 9 | IList vector = embedding.Data[0].Embedding1; 10 | 11 | Console.WriteLine($"Dimension: {vector.Count}"); 12 | Console.WriteLine("Floats: "); 13 | for (int i = 0; i < vector.Count; i++) 14 | { 15 | Console.WriteLine($" [{i,4}] = {vector[i]}"); 16 | } 17 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseOutputTextAnnotationAddedEventAnnotation.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The annotation object being added. (See annotation schema for details.) 8 | /// 9 | public sealed partial class ResponseOutputTextAnnotationAddedEventAnnotation 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunStepDeltaStepDetailsToolCallsFileSearchObjectFileSearch.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// For now, this is always going to be an empty object. 8 | /// 9 | public sealed partial class RunStepDeltaStepDetailsToolCallsFileSearchObjectFileSearch 10 | { 11 | 12 | /// 13 | /// Additional properties that are not explicitly defined in the schema 14 | /// 15 | [global::System.Text.Json.Serialization.JsonExtensionData] 16 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Assistants.ListFiles.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | public partial class Examples 4 | { 5 | [Test] 6 | [Explicit] 7 | public async Task ListFiles() 8 | { 9 | using var api = GetAuthenticatedClient(); 10 | 11 | int count = 0; 12 | 13 | ListFilesResponse files = await api.Files.ListFilesAsync(purpose: CreateFileRequestPurpose.Assistants.ToValueString()); 14 | foreach (OpenAIFile file in files.Data) 15 | { 16 | Console.WriteLine($"[{count,3}] {file.Id} {file.CreatedAt:s} {file.Filename}"); 17 | 18 | count++; 19 | 20 | //_ = await api.Files.DeleteFileAsync(file.Id); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Conversions/CreateChatCompletionResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace tryAGI.OpenAI; 4 | 5 | public partial class CreateChatCompletionResponse 6 | { 7 | /// 8 | public override string ToString() 9 | { 10 | return Choices.ElementAtOrDefault(0)?.Message.Content ?? string.Empty; 11 | } 12 | 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | [SuppressMessage("Design", "CA1062:Validate arguments of public methods", 19 | Justification = "This is a conversion operator.")] 20 | public static implicit operator string(CreateChatCompletionResponse response) 21 | { 22 | return response.ToString(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.GetVectorStore.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// Retrieve vector store
9 | /// Retrieves a vector store. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task GetVectorStoreAsync( 15 | string vectorStoreId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeSessionCreateRequestModalities.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The set of modalities the model can respond with. To disable audio,
8 | /// set this to ["text"]. 9 | ///
10 | public sealed partial class RealtimeSessionCreateRequestModalities 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStore.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// Delete vector store
9 | /// Delete a vector store. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task DeleteVectorStoreAsync( 15 | string vectorStoreId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalCustomDataSourceConfigSchema.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The json schema for the run data source items.
8 | /// Learn how to build JSON schemas [here](https://json-schema.org/). 9 | ///
10 | public sealed partial class EvalCustomDataSourceConfigSchema 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalLogsDataSourceConfigSchema.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The json schema for the run data source items.
8 | /// Learn how to build JSON schemas [here](https://json-schema.org/). 9 | ///
10 | public sealed partial class EvalLogsDataSourceConfigSchema 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /docs/samples/Embeddings.EmbeddingWithOptions.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | CreateEmbeddingResponse embedding = await api.Embeddings.CreateEmbeddingAsync( 5 | input: "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa," 6 | + " and a really helpful concierge. The location is perfect -- right downtown, close to all the tourist" 7 | + " attractions. We highly recommend this hotel.", 8 | model: CreateEmbeddingRequestModel.TextEmbedding3Small, 9 | dimensions: 512); 10 | IList vector = embedding.Data[0].Embedding1; 11 | 12 | Console.WriteLine($"Dimension: {vector.Count}"); 13 | Console.WriteLine("Floats: "); 14 | for (int i = 0; i < vector.Count; i++) 15 | { 16 | Console.WriteLine($" [{i,3}] = {vector[i]}"); 17 | } 18 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Conversions/CreateChatCompletionStreamResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace tryAGI.OpenAI; 4 | 5 | public partial class CreateChatCompletionStreamResponse 6 | { 7 | /// 8 | public override string ToString() 9 | { 10 | return Choices.ElementAtOrDefault(0)?.Delta.Content ?? string.Empty; 11 | } 12 | 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | [SuppressMessage("Design", "CA1062:Validate arguments of public methods", 19 | Justification = "This is a conversion operator.")] 20 | public static implicit operator string(CreateChatCompletionStreamResponse response) 21 | { 22 | return response.ToString(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeSessionCreateResponseOutputModalities.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The set of modalities the model can respond with. To disable audio,
8 | /// set this to ["text"]. 9 | ///
10 | public sealed partial class RealtimeSessionCreateResponseOutputModalities 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeSessionCreateRequestTracingEnumMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The arbitrary metadata to attach to this trace to enable
8 | /// filtering in the traces dashboard. 9 | ///
10 | public sealed partial class RealtimeSessionCreateRequestTracingEnumMetadata 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeSessionCreateRequestGATracingEnumMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The arbitrary metadata to attach to this trace to enable
8 | /// filtering in the Traces Dashboard. 9 | ///
10 | public sealed partial class RealtimeSessionCreateRequestGATracingEnumMetadata 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeSessionCreateResponseTracingEnumMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The arbitrary metadata to attach to this trace to enable
8 | /// filtering in the traces dashboard. 9 | ///
10 | public sealed partial class RealtimeSessionCreateResponseTracingEnumMetadata 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRun.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// Get an eval run
9 | /// Get an evaluation run by ID. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task GetEvalRunAsync( 16 | string evalId, 17 | string runId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.DeleteInvite.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IInvitesClient 6 | { 7 | /// 8 | /// Delete invite
9 | /// Delete an invite. If the invite has already been accepted, it cannot be deleted. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task DeleteInviteAsync( 15 | string inviteId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteContainerFile.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// Delete a container file
9 | /// Delete Container File 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteContainerFileAsync( 16 | string containerId, 17 | string fileId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ArchiveProject.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Archive project
9 | /// Archives a project in the organization. Archived projects cannot be used or updated. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task ArchiveProjectAsync( 15 | string projectId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeTranscriptionSessionCreateResponseModalities.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The set of modalities the model can respond with. To disable audio,
8 | /// set this to ["text"]. 9 | ///
10 | public sealed partial class RealtimeTranscriptionSessionCreateResponseModalities 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseFormatJsonSchemaSchema.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The schema for the response format, described as a JSON Schema object.
8 | /// Learn how to build JSON schemas [here](https://json-schema.org/). 9 | ///
10 | public sealed partial class ResponseFormatJsonSchemaSchema 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalStoredCompletionsDataSourceConfigSchema.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The json schema for the run data source items.
8 | /// Learn how to build JSON schemas [here](https://json-schema.org/). 9 | ///
10 | public sealed partial class EvalStoredCompletionsDataSourceConfigSchema 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CancelEvalRun.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// Cancel eval run
9 | /// Cancel an ongoing evaluation run. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task CancelEvalRunAsync( 16 | string evalId, 17 | string runId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteEvalRun.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// Delete eval run
9 | /// Delete an eval run. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteEvalRunAsync( 16 | string evalId, 17 | string runId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.AdminApiKeysGet.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// Retrieve admin API key
9 | /// Retrieve a single organization API key 10 | ///
11 | /// 12 | /// The ID of the API key. 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task AdminApiKeysGetAsync( 17 | string keyId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.DeleteResponse.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IResponsesClient 6 | { 7 | /// 8 | /// Delete a model response
9 | /// Deletes a model response with the given ID. 10 | ///
11 | /// 12 | /// Example: resp_677efb5139a88190b512bc3fef8e535d 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task DeleteResponseAsync( 17 | string responseId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunGraderRequestItem.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The dataset item provided to the grader. This will be used to populate
8 | /// the `item` namespace. See [the guide](https://platform.openai.com/docs/guides/graders) for more details. 9 | ///
10 | public sealed partial class RunGraderRequestItem 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Chat.SimpleChatStreaming.cs: -------------------------------------------------------------------------------- 1 | // namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | // 3 | // public partial class Examples 4 | // { 5 | // [Test] 6 | // [Explicit] 7 | // public async Task SimpleChatStreaming() 8 | // { 9 | // using var api = GetAuthenticatedClient(); 10 | // 11 | // IAsyncEnumerable enumerable = api.Chat.CreateChatCompletionAsStreamAsync( 12 | // messages: ["Say 'this is a test.'"], 13 | // model: ModelIdsSharedEnum.Gpt4o); 14 | // 15 | // Console.WriteLine("[ASSISTANT]:"); 16 | // await foreach (CreateChatCompletionStreamResponse chatUpdate in enumerable) 17 | // { 18 | // Console.Write(chatUpdate.Choices[0].Delta.Content); 19 | // } 20 | // } 21 | // } 22 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.GetConversation.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IConversationsClient 6 | { 7 | /// 8 | /// Retrieve a conversation
9 | /// Get a conversation 10 | ///
11 | /// 12 | /// Example: conv_123 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task GetConversationAsync( 17 | string conversationId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Chat.ChatWithVision.cs: -------------------------------------------------------------------------------- 1 | // namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | // 3 | // public partial class Examples 4 | // { 5 | // [Test] 6 | // [Explicit] 7 | // public async Task ChatWithVision() 8 | // { 9 | // using var api = GetAuthenticatedClient(); 10 | // 11 | // CreateChatCompletionResponse response = await api.Chat.CreateChatCompletionAsync( 12 | // messages: [ 13 | // "Please describe the following image.", 14 | // H.Resources.images_dog_and_cat_png.AsBytes().AsUserMessage(mimeType: "image/png"), 15 | // ], 16 | // model: ModelIdsEnum.Gpt4o); 17 | // 18 | // Console.WriteLine("[ASSISTANT]:"); 19 | // Console.WriteLine($"{response.Choices[0].Message.Content}"); 20 | // } 21 | // } 22 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CancelUpload.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IUploadsClient 6 | { 7 | /// 8 | /// Cancel upload
9 | /// Cancels the Upload. No Parts may be added after an Upload is cancelled. 10 | ///
11 | /// 12 | /// Example: upload_abc123 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task CancelUploadAsync( 17 | string uploadId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.PauseFineTuningJob.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// Pause fine-tuning
9 | /// Pause a fine-tune job. 10 | ///
11 | /// 12 | /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task PauseFineTuningJobAsync( 17 | string fineTuningJobId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFileContent.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// Retrieve container file content
9 | /// Retrieve Container File Content 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task RetrieveContainerFileContentAsync( 16 | string containerId, 17 | string fileId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponsePromptVariables.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Optional map of values to substitute in for variables in your
8 | /// prompt. The substitution values can either be strings, or other
9 | /// Response input types like images or files. 10 | ///
11 | public sealed partial class ResponsePromptVariables 12 | { 13 | 14 | /// 15 | /// Additional properties that are not explicitly defined in the schema 16 | /// 17 | [global::System.Text.Json.Serialization.JsonExtensionData] 18 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ResumeFineTuningJob.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// Resume fine-tuning
9 | /// Resume a fine-tune job. 10 | ///
11 | /// 12 | /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task ResumeFineTuningJobAsync( 17 | string fineTuningJobId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.AdminApiKeysDelete.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// Delete admin API key
9 | /// Delete an organization admin API key 10 | ///
11 | /// 12 | /// The ID of the API key to be deleted. 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task AdminApiKeysDeleteAsync( 17 | string keyId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectUser.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Retrieve project user
9 | /// Retrieves a user in the project. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task RetrieveProjectUserAsync( 16 | string projectId, 17 | string userId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CancelFineTuningJob.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// Cancel fine-tuning
9 | /// Immediately cancel a fine-tune job. 10 | ///
11 | /// 12 | /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task CancelFineTuningJobAsync( 17 | string fineTuningJobId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFile.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// Retrieve container file
9 | /// Retrieve Container File 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task RetrieveContainerFileAsync( 16 | string containerId, 17 | string fileId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectUser.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Delete project user
9 | /// Deletes a user from the project. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteProjectUserAsync( 16 | string projectId, 17 | string userId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectApiKey.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Retrieve project API key
9 | /// Retrieves an API key in the project. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task RetrieveProjectApiKeyAsync( 16 | string projectId, 17 | string keyId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /docs/samples/Assistants.AllToolsService.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | [GenerateJsonSchema(Strict = false)] 3 | public interface IAllToolsService 4 | { 5 | [Description("Provided a family relation type like 'father' or 'mother', " 6 | + "gets the name of the related person from the user.")] 7 | public string GetNameOfFamilyMember( 8 | [Description("The relation to the user to query, e.g. 'mother' or 'father'")] 9 | string relation); 10 | } 11 | 12 | public class AllToolsService : IAllToolsService 13 | { 14 | public string GetNameOfFamilyMember(string relation) 15 | { 16 | return relation switch 17 | { 18 | not null when relation.Contains("father") => "John Doe", 19 | not null when relation.Contains("mother") => "Jane Doe", 20 | _ => throw new ArgumentException(relation, nameof(relation)) 21 | }; 22 | } 23 | } 24 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.RetrieveModel.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IModelsClient 6 | { 7 | /// 8 | /// Retrieve model
9 | /// Retrieves a model instance, providing basic information about the model such as the owner and permissioning. 10 | ///
11 | /// 12 | /// Example: gpt-4o-mini 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task RetrieveModelAsync( 17 | string model, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectApiKey.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Delete project API key
9 | /// Deletes an API key from the project. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteProjectApiKeyAsync( 16 | string projectId, 17 | string keyId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Assistants.ListAssistantsWithPagination.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 4 | 5 | public partial class Examples 6 | { 7 | [Test] 8 | [Explicit] 9 | [Experimental("OPENAI_BETA_001")] 10 | public async Task ListAssistantsWithPagination() 11 | { 12 | using var api = GetAuthenticatedClient(); 13 | 14 | int count = 0; 15 | 16 | ListAssistantsResponse response = await api.Assistants.ListAssistantsAsync(); 17 | foreach (AssistantObject assistant in response.Data) 18 | { 19 | Console.WriteLine($"[{count,3}] {assistant.Id} {assistant.CreatedAt:s} {assistant.Name}"); 20 | 21 | count++; 22 | 23 | //_ = await api.Assistants.DeleteAssistantAsync(assistant.Id); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.GetThread.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Retrieve thread
9 | /// Retrieves a thread. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | #if NET8_0_OR_GREATER 15 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 16 | #endif 17 | global::System.Threading.Tasks.Task GetThreadAsync( 18 | string threadId, 19 | global::System.Threading.CancellationToken cancellationToken = default); 20 | } 21 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteThread.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Delete thread
9 | /// Delete a thread. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | #if NET8_0_OR_GREATER 15 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 16 | #endif 17 | global::System.Threading.Tasks.Task DeleteThreadAsync( 18 | string threadId, 19 | global::System.Threading.CancellationToken cancellationToken = default); 20 | } 21 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.ListBatches.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IBatchClient 6 | { 7 | /// 8 | /// List batch
9 | /// List your organization's batches. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// The token to cancel the operation with 16 | /// 17 | global::System.Threading.Tasks.Task ListBatchesAsync( 18 | string? after = default, 19 | int? limit = default, 20 | global::System.Threading.CancellationToken cancellationToken = default); 21 | } 22 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Tests.Moderation.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests; 2 | 3 | public partial class Tests 4 | { 5 | [TestMethod] 6 | public async Task CreateModeration() 7 | { 8 | var api = GetAuthorizedApi(); 9 | var response = await api.Moderations.CreateModerationAsync( 10 | input: "Hello, world", 11 | model: CreateModerationRequestModel.OmniModerationLatest); 12 | 13 | response.Results.First().Flagged.Should().BeFalse(); 14 | } 15 | 16 | [TestMethod] 17 | public async Task CreateModeration_Flagged() 18 | { 19 | var api = GetAuthorizedApi(); 20 | var response = await api.Moderations.CreateModerationAsync( 21 | input: "Fuck you", 22 | model: CreateModerationRequestModel.OmniModerationLatest); 23 | response.Results.First().Flagged.Should().BeTrue(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CancelBatch.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IBatchClient 6 | { 7 | /// 8 | /// Cancel batch
9 | /// Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | global::System.Threading.Tasks.Task CancelBatchAsync( 15 | string batchId, 16 | global::System.Threading.CancellationToken cancellationToken = default); 17 | } 18 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteConversation.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IConversationsClient 6 | { 7 | /// 8 | /// Delete a conversation
9 | /// Delete a conversation. Items in the conversation will not be deleted. 10 | ///
11 | /// 12 | /// Example: conv_123 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task DeleteConversationAsync( 17 | string conversationId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeleteCertificate.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface ICertificatesClient 6 | { 7 | /// 8 | /// Delete certificate
9 | /// Delete a certificate from the organization.
10 | /// The certificate must be inactive for the organization and all projects. 11 | ///
12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteCertificateAsync( 16 | string certificateId, 17 | global::System.Threading.CancellationToken cancellationToken = default); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.DeleteModel.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IModelsClient 6 | { 7 | /// 8 | /// Delete a fine-tuned model
9 | /// Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. 10 | ///
11 | /// 12 | /// Example: ft:gpt-4o-mini:acemeco:suffix:abc123 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task DeleteModelAsync( 17 | string model, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.GetAssistant.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Retrieve assistant
9 | /// Retrieves an assistant. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | #if NET8_0_OR_GREATER 15 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 16 | #endif 17 | global::System.Threading.Tasks.Task GetAssistantAsync( 18 | string assistantId, 19 | global::System.Threading.CancellationToken cancellationToken = default); 20 | } 21 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.DeleteChatCompletion.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IChatClient 6 | { 7 | /// 8 | /// Delete chat completion
9 | /// Delete a stored chat completion. Only Chat Completions that have been
10 | /// created with the `store` parameter set to `true` can be deleted. 11 | ///
12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteChatCompletionAsync( 16 | string completionId, 17 | global::System.Threading.CancellationToken cancellationToken = default); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatCompletion.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IChatClient 6 | { 7 | /// 8 | /// Get chat completion
9 | /// Get a stored chat completion. Only Chat Completions that have been created
10 | /// with the `store` parameter set to `true` will be returned. 11 | ///
12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task GetChatCompletionAsync( 16 | string completionId, 17 | global::System.Threading.CancellationToken cancellationToken = default); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.ListInvites.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IInvitesClient 6 | { 7 | /// 8 | /// List invites
9 | /// Returns a list of invites in the organization. 10 | ///
11 | /// 12 | /// Default Value: 20 13 | /// 14 | /// 15 | /// The token to cancel the operation with 16 | /// 17 | global::System.Threading.Tasks.Task ListInvitesAsync( 18 | int? limit = default, 19 | string? after = default, 20 | global::System.Threading.CancellationToken cancellationToken = default); 21 | } 22 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Conversions/ChatCompletionRequestUserMessage.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI; 2 | 3 | public partial class ChatCompletionRequestUserMessage 4 | { 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | public static implicit operator ChatCompletionRequestUserMessage(Uri uri) 11 | { 12 | return FromUri(uri); 13 | } 14 | 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | public static ChatCompletionRequestUserMessage FromUri(Uri uri) 21 | { 22 | return new ChatCompletionRequestUserMessage 23 | { 24 | Role = ChatCompletionRequestUserMessageRole.User, 25 | Content = new ChatCompletionRequestUserMessageContentPart[] 26 | { 27 | uri, 28 | }, 29 | }; 30 | } 31 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteAssistant.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Delete assistant
9 | /// Delete an assistant. 10 | ///
11 | /// 12 | /// The token to cancel the operation with 13 | /// 14 | #if NET8_0_OR_GREATER 15 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 16 | #endif 17 | global::System.Threading.Tasks.Task DeleteAssistantAsync( 18 | string assistantId, 19 | global::System.Threading.CancellationToken cancellationToken = default); 20 | } 21 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectServiceAccount.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Retrieve project service account
9 | /// Retrieves a service account in the project. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task RetrieveProjectServiceAccountAsync( 16 | string projectId, 17 | string serviceAccountId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectServiceAccount.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// Delete project service account
9 | /// Deletes a service account from the project. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteProjectServiceAccountAsync( 16 | string projectId, 17 | string serviceAccountId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.GetRun.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Retrieve run
9 | /// Retrieves a run. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | #if NET8_0_OR_GREATER 16 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 17 | #endif 18 | global::System.Threading.Tasks.Task GetRunAsync( 19 | string threadId, 20 | string runId, 21 | global::System.Threading.CancellationToken cancellationToken = default); 22 | } 23 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRunOutputItem.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// Get an output item of an eval run
9 | /// Get an evaluation run output item by ID. 10 | ///
11 | /// 12 | /// 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task GetEvalRunOutputItemAsync( 17 | string evalId, 18 | string runId, 19 | string outputItemId, 20 | global::System.Threading.CancellationToken cancellationToken = default); 21 | } 22 | } -------------------------------------------------------------------------------- /docs/samples/Audio.SimpleTextToSpeech.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | byte[] bytes = await api.Audio.CreateSpeechAsync( 5 | model: CreateSpeechRequestModel.Tts1, 6 | input: "Overwatering is a common issue for those taking care of houseplants. To prevent it, it is" 7 | + " crucial to allow the soil to dry out between waterings. Instead of watering on a fixed schedule," 8 | + " consider using a moisture meter to accurately gauge the soil’s wetness. Should the soil retain" 9 | + " moisture, it is wise to postpone watering for a couple more days. When in doubt, it is often safer" 10 | + " to water sparingly and maintain a less-is-more approach.", 11 | voice: CreateSpeechRequestVoice.Alloy); 12 | 13 | FileInfo fileInfo = new($"{Guid.NewGuid()}.mp3"); 14 | 15 | await File.WriteAllBytesAsync(fileInfo.FullName, bytes); 16 | 17 | Console.WriteLine($"Audio available at:\n{new Uri(fileInfo.FullName).AbsoluteUri}"); 18 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CancelRun.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Cancel a run
9 | /// Cancels a run that is `in_progress`. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | #if NET8_0_OR_GREATER 16 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 17 | #endif 18 | global::System.Threading.Tasks.Task CancelRunAsync( 19 | string threadId, 20 | string runId, 21 | global::System.Threading.CancellationToken cancellationToken = default); 22 | } 23 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.GetMessage.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Retrieve message
9 | /// Retrieve a message. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | #if NET8_0_OR_GREATER 16 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 17 | #endif 18 | global::System.Threading.Tasks.Task GetMessageAsync( 19 | string threadId, 20 | string messageId, 21 | global::System.Threading.CancellationToken cancellationToken = default); 22 | } 23 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteMessage.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Delete message
9 | /// Deletes a message. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | #if NET8_0_OR_GREATER 16 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 17 | #endif 18 | global::System.Threading.Tasks.Task DeleteMessageAsync( 19 | string threadId, 20 | string messageId, 21 | global::System.Threading.CancellationToken cancellationToken = default); 22 | } 23 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RetrieveFineTuningJob.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// Retrieve fine-tuning job
9 | /// Get info about a fine-tuning job.
10 | /// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization) 11 | ///
12 | /// 13 | /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F 14 | /// 15 | /// The token to cancel the operation with 16 | /// 17 | global::System.Threading.Tasks.Task RetrieveFineTuningJobAsync( 18 | string fineTuningJobId, 19 | global::System.Threading.CancellationToken cancellationToken = default); 20 | } 21 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CancelVectorStoreFileBatch.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// Cancel vector store file batch
9 | /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task CancelVectorStoreFileBatchAsync( 16 | string vectorStoreId, 17 | string batchId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.GetVectorStoreFile.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// Retrieve vector store file
9 | /// Retrieves a vector store file. 10 | ///
11 | /// 12 | /// Example: vs_abc123 13 | /// 14 | /// 15 | /// Example: file-abc123 16 | /// 17 | /// The token to cancel the operation with 18 | /// 19 | global::System.Threading.Tasks.Task GetVectorStoreFileAsync( 20 | string vectorStoreId, 21 | string fileId, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /docs/samples/Images.SimpleImageVariation.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | FileInfo originalFileInfo = new($"{Guid.NewGuid()}.png"); 5 | 6 | await File.WriteAllBytesAsync(originalFileInfo.FullName, H.Resources.images_dog_and_cat_png.AsBytes()); 7 | 8 | Console.WriteLine($"Original Image available at:\n{new Uri(originalFileInfo.FullName).AbsoluteUri}"); 9 | 10 | ImagesResponse image = await api.Images.CreateImageVariationAsync( 11 | image: H.Resources.images_dog_and_cat_png.AsBytes(), 12 | imagename: H.Resources.images_dog_and_cat_png.FileName, 13 | model: CreateImageVariationRequestModel.DallE2, 14 | size: CreateImageVariationRequestSize.x256x256, 15 | responseFormat: CreateImageVariationRequestResponseFormat.B64Json); 16 | byte[] bytes = image.Data[0].Bytes; 17 | 18 | FileInfo fileInfo = new($"{Guid.NewGuid()}.png"); 19 | 20 | await File.WriteAllBytesAsync(fileInfo.FullName, bytes); 21 | 22 | Console.WriteLine($"Image available at:\n{new Uri(fileInfo.FullName).AbsoluteUri}"); 23 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.FunctionParameters.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
8 | /// Omitting `parameters` defines a function with an empty parameter list. 9 | ///
10 | public sealed partial class FunctionParameters 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteConversationItem.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IConversationsClient 6 | { 7 | /// 8 | /// Delete an item
9 | /// Delete an item from a conversation with the given IDs. 10 | ///
11 | /// 12 | /// Example: conv_123 13 | /// 14 | /// 15 | /// Example: msg_abc 16 | /// 17 | /// The token to cancel the operation with 18 | /// 19 | global::System.Threading.Tasks.Task DeleteConversationItemAsync( 20 | string conversationId, 21 | string itemId, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.Metadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Set of 16 key-value pairs that can be attached to an object. This can be
8 | /// useful for storing additional information about the object in a structured
9 | /// format, and querying for objects via API or the dashboard.
10 | /// Keys are strings with a maximum length of 64 characters. Values are strings
11 | /// with a maximum length of 512 characters. 12 | ///
13 | public sealed partial class Metadata 14 | { 15 | 16 | /// 17 | /// Additional properties that are not explicitly defined in the schema 18 | /// 19 | [global::System.Text.Json.Serialization.JsonExtensionData] 20 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectUsers.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// List project users
9 | /// Returns a list of users in the project. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// The token to cancel the operation with 17 | /// 18 | global::System.Threading.Tasks.Task ListProjectUsersAsync( 19 | string projectId, 20 | int? limit = default, 21 | string? after = default, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Tools/VariousTypesTools.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable RedundantUsingDirective 2 | using System; 3 | using CSharpToJsonSchema; 4 | using DescriptionAttribute = System.ComponentModel.DescriptionAttribute; 5 | 6 | namespace tryAGI.OpenAI.IntegrationTests; 7 | 8 | [GenerateJsonSchema] 9 | public interface IVariousTypesTools 10 | { 11 | [Description("Get the current weather in a given location")] 12 | public bool GetCurrentWeather( 13 | long parameter1, 14 | int parameter2, 15 | double parameter3, 16 | float parameter4, 17 | bool parameter5, 18 | DateTime dateTime, 19 | DateOnly date); 20 | } 21 | 22 | public class VariousTypesService : IVariousTypesTools 23 | { 24 | public bool GetCurrentWeather( 25 | long parameter1, 26 | int parameter2, 27 | double parameter3, 28 | float parameter4, 29 | bool parameter5, 30 | DateTime dateTime, 31 | DateOnly date) 32 | { 33 | return true; 34 | } 35 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.GetVectorStoreFileBatch.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// Retrieve vector store file batch
9 | /// Retrieves a vector store file batch. 10 | ///
11 | /// 12 | /// Example: vs_abc123 13 | /// 14 | /// 15 | /// Example: vsfb_abc123 16 | /// 17 | /// The token to cancel the operation with 18 | /// 19 | global::System.Threading.Tasks.Task GetVectorStoreFileBatchAsync( 20 | string vectorStoreId, 21 | string batchId, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Chat.StructuredOutputs.cs: -------------------------------------------------------------------------------- 1 | // namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | // 3 | // public partial class Examples 4 | // { 5 | // [Test] 6 | // [Explicit] 7 | // public async Task StructuredOutputs() 8 | // { 9 | // using var api = GetAuthenticatedClient(); 10 | // 11 | // MathReasoning? mathReasoning = await api.Chat.CreateChatCompletionAsAsync( 12 | // messages: ["How can I solve 8x + 7 = -23?"], 13 | // model: ModelIdsSharedEnum.Gpt4o20240806, 14 | // strict: true); 15 | // 16 | // Console.WriteLine($"Final answer: {mathReasoning?.FinalAnswer}"); 17 | // Console.WriteLine("Reasoning steps:"); 18 | // 19 | // foreach (MathReasoningStep step in mathReasoning?.Steps ?? []) 20 | // { 21 | // Console.WriteLine($" - Explanation: {step.Explanation}"); 22 | // Console.WriteLine($" Output: {step.Output}"); 23 | // } 24 | // } 25 | // } 26 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectApiKeys.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// List project API keys
9 | /// Returns a list of API keys in the project. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// The token to cancel the operation with 17 | /// 18 | global::System.Threading.Tasks.Task ListProjectApiKeysAsync( 19 | string projectId, 20 | int? limit = default, 21 | string? after = default, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ConversationResourceMetadata.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
8 | /// Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. 9 | ///
10 | public sealed partial class ConversationResourceMetadata 11 | { 12 | 13 | /// 14 | /// Additional properties that are not explicitly defined in the schema 15 | /// 16 | [global::System.Text.Json.Serialization.JsonExtensionData] 17 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ListUsers.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IUsersClient 6 | { 7 | /// 8 | /// List users
9 | /// Lists all of the users in the organization. 10 | ///
11 | /// 12 | /// Default Value: 20 13 | /// 14 | /// 15 | /// 16 | /// The token to cancel the operation with 17 | /// 18 | global::System.Threading.Tasks.Task ListUsersAsync( 19 | int? limit = default, 20 | string? after = default, 21 | global::System.Collections.Generic.IList? emails = default, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /docs/samples/Embeddings.MultipleEmbeddings.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | string category = "Luxury"; 5 | string description = "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa," 6 | + " and a really helpful concierge. The location is perfect -- right downtown, close to all the tourist" 7 | + " attractions. We highly recommend this hotel."; 8 | List inputs = [category, description]; 9 | 10 | CreateEmbeddingResponse response = await api.Embeddings.CreateEmbeddingAsync( 11 | input: inputs, 12 | model: CreateEmbeddingRequestModel.TextEmbedding3Small); 13 | 14 | foreach (Embedding embedding in response.Data) 15 | { 16 | IList vector = embedding.Embedding1; 17 | 18 | Console.WriteLine($"Dimension: {vector.Count}"); 19 | Console.WriteLine("Floats: "); 20 | for (int i = 0; i < vector.Count; i++) 21 | { 22 | Console.WriteLine($" [{i,4}] = {vector[i]}"); 23 | } 24 | 25 | Console.WriteLine(); 26 | } 27 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CancelResponse.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IResponsesClient 6 | { 7 | /// 8 | /// Cancel a response
9 | /// Cancels a model response with the given ID. Only responses created with
10 | /// the `background` parameter set to `true` can be cancelled.
11 | /// [Learn more](https://platform.openai.com/docs/guides/background). 12 | ///
13 | /// 14 | /// Example: resp_677efb5139a88190b512bc3fef8e535d 15 | /// 16 | /// The token to cancel the operation with 17 | /// 18 | global::System.Threading.Tasks.Task CancelResponseAsync( 19 | string responseId, 20 | global::System.Threading.CancellationToken cancellationToken = default); 21 | } 22 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileContent.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// Retrieve vector store file content
9 | /// Retrieve the parsed contents of a vector store file. 10 | ///
11 | /// 12 | /// Example: vs_abc123 13 | /// 14 | /// 15 | /// Example: file-abc123 16 | /// 17 | /// The token to cancel the operation with 18 | /// 19 | global::System.Threading.Tasks.Task RetrieveVectorStoreFileContentAsync( 20 | string vectorStoreId, 21 | string fileId, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjects.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// List projects
9 | /// Returns a list of projects. 10 | ///
11 | /// 12 | /// Default Value: 20 13 | /// 14 | /// 15 | /// 16 | /// Default Value: false 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task ListProjectsAsync( 21 | int? limit = default, 22 | string? after = default, 23 | bool? includeArchived = default, 24 | global::System.Threading.CancellationToken cancellationToken = default); 25 | } 26 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectServiceAccounts.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// List project service accounts
9 | /// Returns a list of service accounts in the project. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// The token to cancel the operation with 17 | /// 18 | global::System.Threading.Tasks.Task ListProjectServiceAccountsAsync( 19 | string projectId, 20 | int? limit = default, 21 | string? after = default, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VectorStoreFileAttributes.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Set of 16 key-value pairs that can be attached to an object. This can be
8 | /// useful for storing additional information about the object in a structured
9 | /// format, and querying for objects via API or the dashboard. Keys are strings
10 | /// with a maximum length of 64 characters. Values are strings with a maximum
11 | /// length of 512 characters, booleans, or numbers. 12 | ///
13 | public sealed partial class VectorStoreFileAttributes 14 | { 15 | 16 | /// 17 | /// Additional properties that are not explicitly defined in the schema 18 | /// 19 | [global::System.Text.Json.Serialization.JsonExtensionData] 20 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.GetCertificate.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface ICertificatesClient 6 | { 7 | /// 8 | /// Get certificate
9 | /// Get a certificate that has been uploaded to the organization.
10 | /// You can get a certificate regardless of whether it is active or not. 11 | ///
12 | /// 13 | /// 14 | /// The token to cancel the operation with 15 | /// 16 | global::System.Threading.Tasks.Task GetCertificateAsync( 17 | string certificateId, 18 | global::System.Collections.Generic.IList? include = default, 19 | global::System.Threading.CancellationToken cancellationToken = default); 20 | } 21 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainers.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// List containers
9 | /// List Containers 10 | ///
11 | /// 12 | /// Default Value: 20 13 | /// 14 | /// 15 | /// Default Value: desc 16 | /// 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task ListContainersAsync( 21 | int? limit = default, 22 | global::tryAGI.OpenAI.ListContainersOrder? order = default, 23 | string? after = default, 24 | global::System.Threading.CancellationToken cancellationToken = default); 25 | } 26 | } -------------------------------------------------------------------------------- /src/helpers/TrimmingHelper/TrimmingHelper.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | win-x64 22 | osx-arm64 23 | 24 | true 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStoreFile.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// Delete vector store file
9 | /// Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](https://platform.openai.com/docs/api-reference/files/delete) endpoint. 10 | ///
11 | /// 12 | /// 13 | /// The token to cancel the operation with 14 | /// 15 | global::System.Threading.Tasks.Task DeleteVectorStoreFileAsync( 16 | string vectorStoreId, 17 | string fileId, 18 | global::System.Threading.CancellationToken cancellationToken = default); 19 | } 20 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Assistants.AllToolsService.cs: -------------------------------------------------------------------------------- 1 | using CSharpToJsonSchema; 2 | using DescriptionAttribute = System.ComponentModel.DescriptionAttribute; 3 | 4 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 5 | 6 | // # START EXAMPLE # 7 | 8 | [GenerateJsonSchema(Strict = false)] 9 | public interface IAllToolsService 10 | { 11 | [Description("Provided a family relation type like 'father' or 'mother', " 12 | + "gets the name of the related person from the user.")] 13 | public string GetNameOfFamilyMember( 14 | [Description("The relation to the user to query, e.g. 'mother' or 'father'")] 15 | string relation); 16 | } 17 | 18 | public class AllToolsService : IAllToolsService 19 | { 20 | public string GetNameOfFamilyMember(string relation) 21 | { 22 | return relation switch 23 | { 24 | not null when relation.Contains("father") => "John Doe", 25 | not null when relation.Contains("mother") => "Jane Doe", 26 | _ => throw new ArgumentException(relation, nameof(relation)) 27 | }; 28 | } 29 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Embeddings.SimpleEmbedding.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | public partial class Examples 4 | { 5 | [Test] 6 | [Explicit] 7 | public async Task SimpleEmbedding() 8 | { 9 | using var api = GetAuthenticatedClient(); 10 | 11 | CreateEmbeddingResponse embedding = await api.Embeddings.CreateEmbeddingAsync( 12 | input: "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa," 13 | + " and a really helpful concierge. The location is perfect -- right downtown, close to all the tourist" 14 | + " attractions. We highly recommend this hotel.", 15 | model: CreateEmbeddingRequestModel.TextEmbedding3Small); 16 | IList vector = embedding.Data[0].Embedding1; 17 | 18 | Console.WriteLine($"Dimension: {vector.Count}"); 19 | Console.WriteLine("Floats: "); 20 | for (int i = 0; i < vector.Count; i++) 21 | { 22 | Console.WriteLine($" [{i,4}] = {vector[i]}"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListPaginatedFineTuningJobs.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// List fine-tuning jobs
9 | /// List your organization's fine-tuning jobs 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// The token to cancel the operation with 17 | /// 18 | global::System.Threading.Tasks.Task ListPaginatedFineTuningJobsAsync( 19 | string? after = default, 20 | int? limit = default, 21 | global::System.Collections.Generic.Dictionary? metadata = default, 22 | global::System.Threading.CancellationToken cancellationToken = default); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningEvents.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// List fine-tuning events
9 | /// Get status updates for a fine-tuning job. 10 | ///
11 | /// 12 | /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F 13 | /// 14 | /// 15 | /// 16 | /// Default Value: 20 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task ListFineTuningEventsAsync( 21 | string fineTuningJobId, 22 | string? after = default, 23 | int? limit = default, 24 | global::System.Threading.CancellationToken cancellationToken = default); 25 | } 26 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 tryAGI and Stephen Hodgson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Conversions/MessageContentImageUrlObject.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI; 2 | 3 | public partial class MessageContentImageUrlObject 4 | { 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | public static implicit operator MessageContentImageUrlObject(Uri uri) 11 | { 12 | return FromUri(uri); 13 | } 14 | 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | public static MessageContentImageUrlObject FromUri( 22 | Uri uri, 23 | MessageContentImageUrlObjectImageUrlDetail detail = MessageContentImageUrlObjectImageUrlDetail.Auto) 24 | { 25 | uri = uri ?? throw new ArgumentNullException(nameof(uri)); 26 | 27 | return new MessageContentImageUrlObject 28 | { 29 | ImageUrl = new MessageContentImageUrlObjectImageUrl 30 | { 31 | Detail = detail, 32 | Url = uri.ToString(), 33 | } 34 | }; 35 | } 36 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectRateLimits.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IProjectsClient 6 | { 7 | /// 8 | /// List project rate limits
9 | /// Returns the rate limits per model for a project. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 100 14 | /// 15 | /// 16 | /// 17 | /// The token to cancel the operation with 18 | /// 19 | global::System.Threading.Tasks.Task ListProjectRateLimitsAsync( 20 | string projectId, 21 | int? limit = default, 22 | string? after = default, 23 | string? before = default, 24 | global::System.Threading.CancellationToken cancellationToken = default); 25 | } 26 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.ListFiles.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFilesClient 6 | { 7 | /// 8 | /// List files
9 | /// Returns a list of files. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 10000 14 | /// 15 | /// 16 | /// Default Value: desc 17 | /// 18 | /// 19 | /// The token to cancel the operation with 20 | /// 21 | global::System.Threading.Tasks.Task ListFilesAsync( 22 | string? purpose = default, 23 | int? limit = default, 24 | global::tryAGI.OpenAI.ListFilesOrder? order = default, 25 | string? after = default, 26 | global::System.Threading.CancellationToken cancellationToken = default); 27 | } 28 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningJobCheckpoints.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// List fine-tuning checkpoints
9 | /// List checkpoints for a fine-tuning job. 10 | ///
11 | /// 12 | /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F 13 | /// 14 | /// 15 | /// 16 | /// Default Value: 10 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task ListFineTuningJobCheckpointsAsync( 21 | string fineTuningJobId, 22 | string? after = default, 23 | int? limit = default, 24 | global::System.Threading.CancellationToken cancellationToken = default); 25 | } 26 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Embeddings.EmbeddingWithOptions.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | public partial class Examples 4 | { 5 | [Test] 6 | [Explicit] 7 | public async Task EmbeddingWithOptions() 8 | { 9 | using var api = GetAuthenticatedClient(); 10 | 11 | CreateEmbeddingResponse embedding = await api.Embeddings.CreateEmbeddingAsync( 12 | input: "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa," 13 | + " and a really helpful concierge. The location is perfect -- right downtown, close to all the tourist" 14 | + " attractions. We highly recommend this hotel.", 15 | model: CreateEmbeddingRequestModel.TextEmbedding3Small, 16 | dimensions: 512); 17 | IList vector = embedding.Data[0].Embedding1; 18 | 19 | Console.WriteLine($"Dimension: {vector.Count}"); 20 | Console.WriteLine("Floats: "); 21 | for (int i = 0; i < vector.Count; i++) 22 | { 23 | Console.WriteLine($" [{i,3}] = {vector[i]}"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.GetConversationItem.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IConversationsClient 6 | { 7 | /// 8 | /// Retrieve an item
9 | /// Get a single item from a conversation with the given IDs. 10 | ///
11 | /// 12 | /// Example: conv_123 13 | /// 14 | /// 15 | /// Example: msg_abc 16 | /// 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task GetConversationItemAsync( 21 | string conversationId, 22 | string itemId, 23 | global::System.Collections.Generic.IList? include = default, 24 | global::System.Threading.CancellationToken cancellationToken = default); 25 | } 26 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Client/Authentication/AuthInfo.cs: -------------------------------------------------------------------------------- 1 | // using System.Security.Authentication; 2 | // using System.Text.Json.Serialization; 3 | // 4 | // namespace tryAGI.OpenAI; 5 | // 6 | // internal class AuthInfo 7 | // { 8 | // internal const string SecretKeyPrefix = "sk-"; 9 | // internal const string SessionKeyPrefix = "sess-"; 10 | // internal const string OrganizationPrefix = "org-"; 11 | // 12 | // [JsonConstructor] 13 | // public AuthInfo(string apiKey, string? organizationId = null) 14 | // { 15 | // ApiKey = apiKey; 16 | // 17 | // if (organizationId != null && !string.IsNullOrWhiteSpace(organizationId)) 18 | // { 19 | // if (!organizationId.Contains(OrganizationPrefix)) 20 | // { 21 | // throw new InvalidCredentialException($"{nameof(organizationId)} must start with '{OrganizationPrefix}'"); 22 | // } 23 | // 24 | // OrganizationId = organizationId; 25 | // } 26 | // } 27 | // 28 | // [JsonPropertyName("apiKey")] 29 | // public string ApiKey { get; } 30 | // 31 | // [JsonPropertyName("organization")] 32 | // public string? OrganizationId { get; } 33 | // } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListOrganizationCertificates.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface ICertificatesClient 6 | { 7 | /// 8 | /// List organization certificates
9 | /// List uploaded certificates for this organization. 10 | ///
11 | /// 12 | /// Default Value: 20 13 | /// 14 | /// 15 | /// 16 | /// Default Value: desc 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task ListOrganizationCertificatesAsync( 21 | int? limit = default, 22 | string? after = default, 23 | global::tryAGI.OpenAI.ListOrganizationCertificatesOrder? order = default, 24 | global::System.Threading.CancellationToken cancellationToken = default); 25 | } 26 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Conversions/MessageContentImageFileObject.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI; 2 | 3 | public partial class MessageContentImageFileObject 4 | { 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | public static implicit operator MessageContentImageFileObject(OpenAIFile file) 11 | { 12 | return FromOpenAIFile(file); 13 | } 14 | 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | public static MessageContentImageFileObject FromOpenAIFile( 22 | OpenAIFile file, 23 | MessageContentImageFileObjectImageFileDetail detail = MessageContentImageFileObjectImageFileDetail.Auto) 24 | { 25 | file = file ?? throw new ArgumentNullException(nameof(file)); 26 | 27 | return new MessageContentImageFileObject 28 | { 29 | ImageFile = new MessageContentImageFileObjectImageFile 30 | { 31 | FileId = file.Id, 32 | Detail = detail, 33 | }, 34 | }; 35 | } 36 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainerFiles.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// List container files
9 | /// List Container files 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// Default Value: desc 17 | /// 18 | /// 19 | /// The token to cancel the operation with 20 | /// 21 | global::System.Threading.Tasks.Task ListContainerFilesAsync( 22 | string containerId, 23 | int? limit = default, 24 | global::tryAGI.OpenAI.ListContainerFilesOrder? order = default, 25 | string? after = default, 26 | global::System.Threading.CancellationToken cancellationToken = default); 27 | } 28 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStores.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IVectorStoresClient 6 | { 7 | /// 8 | /// List vector stores
9 | /// Returns a list of vector stores. 10 | ///
11 | /// 12 | /// Default Value: 20 13 | /// 14 | /// 15 | /// Default Value: desc 16 | /// 17 | /// 18 | /// 19 | /// The token to cancel the operation with 20 | /// 21 | global::System.Threading.Tasks.Task ListVectorStoresAsync( 22 | int? limit = default, 23 | global::tryAGI.OpenAI.ListVectorStoresOrder? order = default, 24 | string? after = default, 25 | string? before = default, 26 | global::System.Threading.CancellationToken cancellationToken = default); 27 | } 28 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.GetRunStep.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// Retrieve run step
9 | /// Retrieves a run step. 10 | ///
11 | /// 12 | /// 13 | /// 14 | /// 15 | /// The token to cancel the operation with 16 | /// 17 | #if NET8_0_OR_GREATER 18 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 19 | #endif 20 | global::System.Threading.Tasks.Task GetRunStepAsync( 21 | string threadId, 22 | string runId, 23 | string stepId, 24 | global::System.Collections.Generic.IList? include = default, 25 | global::System.Threading.CancellationToken cancellationToken = default); 26 | } 27 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.Constructors.Bearer.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | public sealed partial class OpenAiClient 7 | { 8 | /// 9 | public OpenAiClient( 10 | string apiKey, 11 | global::System.Net.Http.HttpClient? httpClient = null, 12 | global::System.Uri? baseUri = null, 13 | global::System.Collections.Generic.List? authorizations = null, 14 | bool disposeHttpClient = true) : this(httpClient, baseUri, authorizations, disposeHttpClient) 15 | { 16 | Authorizing(HttpClient, ref apiKey); 17 | 18 | AuthorizeUsingBearer(apiKey); 19 | 20 | Authorized(HttpClient); 21 | } 22 | 23 | partial void Authorizing( 24 | global::System.Net.Http.HttpClient client, 25 | ref string apiKey); 26 | partial void Authorized( 27 | global::System.Net.Http.HttpClient client); 28 | } 29 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListProjectCertificates.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface ICertificatesClient 6 | { 7 | /// 8 | /// List project certificates
9 | /// List certificates for this project. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// 17 | /// Default Value: desc 18 | /// 19 | /// The token to cancel the operation with 20 | /// 21 | global::System.Threading.Tasks.Task ListProjectCertificatesAsync( 22 | string projectId, 23 | int? limit = default, 24 | string? after = default, 25 | global::tryAGI.OpenAI.ListProjectCertificatesOrder? order = default, 26 | global::System.Threading.CancellationToken cancellationToken = default); 27 | } 28 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.ListEvals.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// List evals
9 | /// List evaluations for a project. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// Default Value: asc 17 | /// 18 | /// 19 | /// Default Value: created_at 20 | /// 21 | /// The token to cancel the operation with 22 | /// 23 | global::System.Threading.Tasks.Task ListEvalsAsync( 24 | string? after = default, 25 | int? limit = default, 26 | global::tryAGI.OpenAI.ListEvalsOrder? order = default, 27 | global::tryAGI.OpenAI.ListEvalsOrderBy? orderBy = default, 28 | global::System.Threading.CancellationToken cancellationToken = default); 29 | } 30 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRuns.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IEvalsClient 6 | { 7 | /// 8 | /// Get eval runs
9 | /// Get a list of runs for an evaluation. 10 | ///
11 | /// 12 | /// 13 | /// 14 | /// Default Value: 20 15 | /// 16 | /// 17 | /// Default Value: asc 18 | /// 19 | /// 20 | /// The token to cancel the operation with 21 | /// 22 | global::System.Threading.Tasks.Task GetEvalRunsAsync( 23 | string evalId, 24 | string? after = default, 25 | int? limit = default, 26 | global::tryAGI.OpenAI.GetEvalRunsOrder? order = default, 27 | global::tryAGI.OpenAI.GetEvalRunsStatus? status = default, 28 | global::System.Threading.CancellationToken cancellationToken = default); 29 | } 30 | } -------------------------------------------------------------------------------- /docs/samples/Audio.VerboseTranscription.md: -------------------------------------------------------------------------------- 1 | ```csharp 2 | using var api = GetAuthenticatedClient(); 3 | 4 | OneOf response = await api.Audio.CreateTranscriptionAsync( 5 | file: H.Resources.audio_houseplant_care_mp3.AsBytes(), 6 | filename: H.Resources.audio_houseplant_care_mp3.FileName, 7 | model: CreateTranscriptionRequestModel.Whisper1, 8 | responseFormat: AudioResponseFormat.VerboseJson, 9 | timestampGranularities: [ 10 | CreateTranscriptionRequestTimestampGranularitie.Word, 11 | CreateTranscriptionRequestTimestampGranularitie.Segment 12 | ]); 13 | 14 | response.Value2.Should().NotBeNull(); 15 | 16 | Console.WriteLine("Transcription:"); 17 | Console.WriteLine($"{response.Value2!.Text}"); 18 | 19 | Console.WriteLine(); 20 | Console.WriteLine($"Words:"); 21 | foreach (TranscriptionWord word in response.Value2.Words ?? []) 22 | { 23 | Console.WriteLine($" {word.Word,15} : {word.Start * 1000,5:0} - {word.End * 1000,5:0}"); 24 | } 25 | 26 | Console.WriteLine(); 27 | Console.WriteLine($"Segments:"); 28 | foreach (TranscriptionSegment segment in response.Value2.Segments ?? []) 29 | { 30 | Console.WriteLine($" {segment.Text,90} : {segment.Start * 1000,5:0} - {segment.End * 1000,5:0}"); 31 | } 32 | ``` -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.DoneEventData.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public enum DoneEventData 10 | { 11 | /// 12 | /// 13 | /// 14 | DONE, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class DoneEventDataExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this DoneEventData value) 26 | { 27 | return value switch 28 | { 29 | DoneEventData.DONE => "[DONE]", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static DoneEventData? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "[DONE]" => DoneEventData.DONE, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.DeleteFineTuningCheckpointPermission.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IFineTuningClient 6 | { 7 | /// 8 | /// Delete checkpoint permission
9 | /// **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
10 | /// Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint. 11 | ///
12 | /// 13 | /// Example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd 14 | /// 15 | /// 16 | /// Example: cp_zc4Q7MP6XxulcVzj4MZdwsAB 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task DeleteFineTuningCheckpointPermissionAsync( 21 | string fineTunedModelCheckpoint, 22 | string permissionId, 23 | global::System.Threading.CancellationToken cancellationToken = default); 24 | } 25 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.ListInputItems.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IResponsesClient 6 | { 7 | /// 8 | /// List input items
9 | /// Returns a list of input items for a given response. 10 | ///
11 | /// 12 | /// 13 | /// Default Value: 20 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task ListInputItemsAsync( 21 | string responseId, 22 | int? limit = default, 23 | global::tryAGI.OpenAI.ListInputItemsOrder? order = default, 24 | string? after = default, 25 | global::System.Collections.Generic.IList? include = default, 26 | global::System.Threading.CancellationToken cancellationToken = default); 27 | } 28 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateChatCompletionRequestVariant2LogitBias.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Modify the likelihood of specified tokens appearing in the completion.
8 | /// Accepts a JSON object that maps tokens (specified by their token ID in the
9 | /// tokenizer) to an associated bias value from -100 to 100. Mathematically,
10 | /// the bias is added to the logits generated by the model prior to sampling.
11 | /// The exact effect will vary per model, but values between -1 and 1 should
12 | /// decrease or increase likelihood of selection; values like -100 or 100
13 | /// should result in a ban or exclusive selection of the relevant token. 14 | ///
15 | public sealed partial class CreateChatCompletionRequestVariant2LogitBias 16 | { 17 | 18 | /// 19 | /// Additional properties that are not explicitly defined in the schema 20 | /// 21 | [global::System.Text.Json.Serialization.JsonExtensionData] 22 | public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.DoneEventEvent.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public enum DoneEventEvent 10 | { 11 | /// 12 | /// 13 | /// 14 | Done, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class DoneEventEventExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this DoneEventEvent value) 26 | { 27 | return value switch 28 | { 29 | DoneEventEvent.Done => "done", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static DoneEventEvent? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "done" => DoneEventEvent.Done, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ErrorEventEvent.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public enum ErrorEventEvent 10 | { 11 | /// 12 | /// 13 | /// 14 | Error, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class ErrorEventEventExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this ErrorEventEvent value) 26 | { 27 | return value switch 28 | { 29 | ErrorEventEvent.Error => "error", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static ErrorEventEvent? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "error" => ErrorEventEvent.Error, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.MCPToolType.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The type of the MCP tool. Always `mcp`. 8 | /// 9 | public enum MCPToolType 10 | { 11 | /// 12 | /// 13 | /// 14 | Mcp, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class MCPToolTypeExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this MCPToolType value) 26 | { 27 | return value switch 28 | { 29 | MCPToolType.Mcp => "mcp", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static MCPToolType? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "mcp" => MCPToolType.Mcp, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.GetResponse.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IResponsesClient 6 | { 7 | /// 8 | /// Get a model response
9 | /// Retrieves a model response with the given ID. 10 | ///
11 | /// 12 | /// Example: resp_677efb5139a88190b512bc3fef8e535d 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// The token to cancel the operation with 19 | /// 20 | global::System.Threading.Tasks.Task GetResponseAsync( 21 | string responseId, 22 | global::System.Collections.Generic.IList? include = default, 23 | bool? stream = default, 24 | int? startingAfter = default, 25 | bool? includeObfuscation = default, 26 | global::System.Threading.CancellationToken cancellationToken = default); 27 | } 28 | } -------------------------------------------------------------------------------- /src/tests/OpenAI.IntegrationTests/Examples/Examples.Audio.SimpleTextToSpeech.cs: -------------------------------------------------------------------------------- 1 | namespace tryAGI.OpenAI.IntegrationTests.Examples; 2 | 3 | public partial class Examples 4 | { 5 | [Test] 6 | [Explicit] 7 | public async Task SimpleTextToSpeech() 8 | { 9 | using var api = GetAuthenticatedClient(); 10 | 11 | byte[] bytes = await api.Audio.CreateSpeechAsync( 12 | model: CreateSpeechRequestModel.Tts1, 13 | input: "Overwatering is a common issue for those taking care of houseplants. To prevent it, it is" 14 | + " crucial to allow the soil to dry out between waterings. Instead of watering on a fixed schedule," 15 | + " consider using a moisture meter to accurately gauge the soil’s wetness. Should the soil retain" 16 | + " moisture, it is wise to postpone watering for a couple more days. When in doubt, it is often safer" 17 | + " to water sparingly and maintain a less-is-more approach.", 18 | voice: VoiceIdsSharedEnum.Alloy); 19 | 20 | FileInfo fileInfo = new($"{Guid.NewGuid()}.mp3"); 21 | 22 | await File.WriteAllBytesAsync(fileInfo.FullName, bytes); 23 | 24 | Console.WriteLine($"Audio available at:\n{new Uri(fileInfo.FullName).AbsoluteUri}"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.BatchObject.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The object type, which is always `batch`. 8 | /// 9 | public enum BatchObject 10 | { 11 | /// 12 | /// 13 | /// 14 | Batch, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class BatchObjectExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this BatchObject value) 26 | { 27 | return value switch 28 | { 29 | BatchObject.Batch => "batch", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static BatchObject? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "batch" => BatchObject.Batch, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalObject.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The object type.
8 | /// Default Value: eval 9 | ///
10 | public enum EvalObject 11 | { 12 | /// 13 | /// 14 | /// 15 | Eval, 16 | } 17 | 18 | /// 19 | /// Enum extensions to do fast conversions without the reflection. 20 | /// 21 | public static class EvalObjectExtensions 22 | { 23 | /// 24 | /// Converts an enum to a string. 25 | /// 26 | public static string ToValueString(this EvalObject value) 27 | { 28 | return value switch 29 | { 30 | EvalObject.Eval => "eval", 31 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 32 | }; 33 | } 34 | /// 35 | /// Converts an string to a enum. 36 | /// 37 | public static EvalObject? ToEnum(string value) 38 | { 39 | return value switch 40 | { 41 | "eval" => EvalObject.Eval, 42 | _ => null, 43 | }; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ModelObject.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The object type, which is always "model". 8 | /// 9 | public enum ModelObject 10 | { 11 | /// 12 | /// 13 | /// 14 | Model, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class ModelObjectExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this ModelObject value) 26 | { 27 | return value switch 28 | { 29 | ModelObject.Model => "model", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static ModelObject? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "model" => ModelObject.Model, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.TextContentType.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Default Value: text 8 | /// 9 | public enum TextContentType 10 | { 11 | /// 12 | /// 13 | /// 14 | Text, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class TextContentTypeExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this TextContentType value) 26 | { 27 | return value switch 28 | { 29 | TextContentType.Text => "text", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static TextContentType? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "text" => TextContentType.Text, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListAssistants.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IAssistantsClient 6 | { 7 | /// 8 | /// List assistants
9 | /// Returns a list of assistants. 10 | ///
11 | /// 12 | /// Default Value: 20 13 | /// 14 | /// 15 | /// Default Value: desc 16 | /// 17 | /// 18 | /// 19 | /// The token to cancel the operation with 20 | /// 21 | #if NET8_0_OR_GREATER 22 | [global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "TRYAGI_OPENAI_BETA_001")] 23 | #endif 24 | global::System.Threading.Tasks.Task ListAssistantsAsync( 25 | int? limit = default, 26 | global::tryAGI.OpenAI.ListAssistantsOrder? order = default, 27 | string? after = default, 28 | string? before = default, 29 | global::System.Threading.CancellationToken cancellationToken = default); 30 | } 31 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UploadObject.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The object type, which is always "upload". 8 | /// 9 | public enum UploadObject 10 | { 11 | /// 12 | /// 13 | /// 14 | Upload, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class UploadObjectExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this UploadObject value) 26 | { 27 | return value switch 28 | { 29 | UploadObject.Upload => "upload", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static UploadObject? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "upload" => UploadObject.Upload, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UsageResponseObject.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public enum UsageResponseObject 10 | { 11 | /// 12 | /// 13 | /// 14 | Page, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class UsageResponseObjectExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this UsageResponseObject value) 26 | { 27 | return value switch 28 | { 29 | UsageResponseObject.Page => "page", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static UsageResponseObject? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "page" => UsageResponseObject.Page, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.AdminApiKeysList.g.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace tryAGI.OpenAI 4 | { 5 | public partial interface IOpenAiClient 6 | { 7 | /// 8 | /// List all organization and project API keys.
9 | /// List organization API keys 10 | ///
11 | /// 12 | /// Return keys with IDs that come after this ID in the pagination order. 13 | /// 14 | /// 15 | /// Order results by creation time, ascending or descending.
16 | /// Default Value: asc 17 | /// 18 | /// 19 | /// Maximum number of keys to return.
20 | /// Default Value: 20 21 | /// 22 | /// The token to cancel the operation with 23 | /// 24 | global::System.Threading.Tasks.Task AdminApiKeysListAsync( 25 | string? after = default, 26 | global::tryAGI.OpenAI.AdminApiKeysListOrder? order = default, 27 | int? limit = default, 28 | global::System.Threading.CancellationToken cancellationToken = default); 29 | } 30 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemType.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The type of the message input. Always `message`. 8 | /// 9 | public enum EvalItemType 10 | { 11 | /// 12 | /// 13 | /// 14 | Message, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class EvalItemTypeExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this EvalItemType value) 26 | { 27 | return value switch 28 | { 29 | EvalItemType.Message => "message", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static EvalItemType? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "message" => EvalItemType.Message, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CustomToolType.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The type of the custom tool. Always `custom`. 8 | /// 9 | public enum CustomToolType 10 | { 11 | /// 12 | /// 13 | /// 14 | Custom, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class CustomToolTypeExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this CustomToolType value) 26 | { 27 | return value switch 28 | { 29 | CustomToolType.Custom => "custom", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static CustomToolType? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "custom" => CustomToolType.Custom, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.FilePathType.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The type of the file path. Always `file_path`. 8 | /// 9 | public enum FilePathType 10 | { 11 | /// 12 | /// 13 | /// 14 | FilePath, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class FilePathTypeExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this FilePathType value) 26 | { 27 | return value switch 28 | { 29 | FilePathType.FilePath => "file_path", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static FilePathType? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "file_path" => FilePathType.FilePath, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OpenAIFileObject.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// The object type, which is always `file`. 8 | /// 9 | public enum OpenAIFileObject 10 | { 11 | /// 12 | /// 13 | /// 14 | File, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class OpenAIFileObjectExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this OpenAIFileObject value) 26 | { 27 | return value switch 28 | { 29 | OpenAIFileObject.File => "file", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static OpenAIFileObject? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "file" => OpenAIFileObject.File, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ToolChoiceMCPType.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// For MCP tools, the type is always `mcp`. 8 | /// 9 | public enum ToolChoiceMCPType 10 | { 11 | /// 12 | /// 13 | /// 14 | Mcp, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class ToolChoiceMCPTypeExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this ToolChoiceMCPType value) 26 | { 27 | return value switch 28 | { 29 | ToolChoiceMCPType.Mcp => "mcp", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static ToolChoiceMCPType? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "mcp" => ToolChoiceMCPType.Mcp, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UserListResponseObject.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public enum UserListResponseObject 10 | { 11 | /// 12 | /// 13 | /// 14 | List, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class UserListResponseObjectExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this UserListResponseObject value) 26 | { 27 | return value switch 28 | { 29 | UserListResponseObject.List => "list", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static UserListResponseObject? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "list" => UserListResponseObject.List, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.TranscriptionInclude.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// 8 | /// 9 | public enum TranscriptionInclude 10 | { 11 | /// 12 | /// 13 | /// 14 | Logprobs, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class TranscriptionIncludeExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this TranscriptionInclude value) 26 | { 27 | return value switch 28 | { 29 | TranscriptionInclude.Logprobs => "logprobs", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static TranscriptionInclude? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "logprobs" => TranscriptionInclude.Logprobs, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UsageCostsBucketWidth.g.cs: -------------------------------------------------------------------------------- 1 | 2 | #nullable enable 3 | 4 | namespace tryAGI.OpenAI 5 | { 6 | /// 7 | /// Default Value: 1d 8 | /// 9 | public enum UsageCostsBucketWidth 10 | { 11 | /// 12 | /// 13 | /// 14 | x1d, 15 | } 16 | 17 | /// 18 | /// Enum extensions to do fast conversions without the reflection. 19 | /// 20 | public static class UsageCostsBucketWidthExtensions 21 | { 22 | /// 23 | /// Converts an enum to a string. 24 | /// 25 | public static string ToValueString(this UsageCostsBucketWidth value) 26 | { 27 | return value switch 28 | { 29 | UsageCostsBucketWidth.x1d => "1d", 30 | _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), 31 | }; 32 | } 33 | /// 34 | /// Converts an string to a enum. 35 | /// 36 | public static UsageCostsBucketWidth? ToEnum(string value) 37 | { 38 | return value switch 39 | { 40 | "1d" => UsageCostsBucketWidth.x1d, 41 | _ => null, 42 | }; 43 | } 44 | } 45 | } --------------------------------------------------------------------------------