diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md index 85eaefe45..7cf0bd4f0 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md @@ -1,6 +1,21 @@ # Release History -## 2.1.0 (Unreleased) +## 2.2.0-beta.1 (2025-02-04) + +This preview release aligns with the corresponding `2.2.0` beta of `OpenAI` and the `2025-01-01-Preview` Azure OpenAI Service API version. + +New features include since 2.1.0-beta.2 include: + +- Audio input for Chat Completions using `gpt-4o-audio-preview` or other compatible models: provide input audio via `ChatMessageContentPart.CreateInputAudioPart()`, set `AudioOptions` and `ResponseModalities` on `ChatCompletionOptions`, retrieve response audio via `OutputAudio` on `ChatCompletion`, and reference audio history from the assistant by using the `AssistantChatMessage(ChatCompletion)` constructor or using `ChatMessageContentPart.CreateAudioPart(string)`. For more information, refer to the examples in [the OpenAI README](https://github.com/openai/openai-dotnet/blob/main/README.md). +- Predicted outputs in Chat Completions: `ChatCompletionOptions` accepts an `OutputPrediction` property that can be used via `ChatOutputPrediction.CreateStaticContentPrediction()` with text content to optimize operation efficiency for scenarios like code completion. For more information, see [OpenAI's predicted outputs announcement](https://community.openai.com/t/introducing-predicted-outputs/1004502). +- Chat Completions `o`-series model feature support: the new `developer` message role via `DeveloperChatMessage` (used just like `SystemChatMessage`), `ReasoningEffortLevel` on Chat Completion options +- [AOAI exclusive] `UserSecurityContext` integration with [Defender for Cloud](https://learn.microsoft.com/azure/defender-for-cloud/gain-end-user-context-ai); add a `UserSecurityContext` instance to `ChatCompletionOptions` with `SetUserSecurityContext()` + +### Breaking Changes + +- **Batch**: files uploaded for batch operations (`UploadFile` with `FileUploadPurpose.Batch`) will now report a `status` of `processed`, matching expected behavior against OpenAI's `/v1` endpoint. This is a change from past behavior where such files would initially report `pending` and a later `processed`, `error`, or other status depending on operation progress. Batch input validation is instead consistently performed from the batch client. + +## 2.1.0 (2024-12-05) This GA library release aligns functionality with the latest `2024-10-21` stable service API label. @@ -39,10 +54,6 @@ The `2024-10-21` service API label introduces stable support for batch chat comp This update brings compatibility with the Azure OpenAI `2024-10-01-preview` service API version as well as the `2.1.0-beta.2` release of the `OpenAI` library. -### Breaking Changes - -- `[Experimental]` `ChatCitation` and `ChatRetrievedDocument` have each replaced the `Uri` property of type `System.Uri` with a `string` property named `Url`. This aligns with the REST specification and accounts for the wire value of `url` not always providing a valid RFC 3986 identifier [[azure-sdk-for-net \#46793](https://github.com/Azure/azure-sdk-for-net/issues/46793)] - ### Features Added - The included update via `2024-09-01-preview` brings AOAI support for streaming token usage in chat completions; `Usage` is now automatically populated in `StreamingChatCompletionUpdate` instances. @@ -50,21 +61,14 @@ This update brings compatibility with the Azure OpenAI `2024-10-01-preview` serv - Note 2: this feature is not yet compatible when using image input (a `ChatMessageContentPart` of `Kind` `Image`) - `2024-10-01-preview` further adds support for ungrounded content detection in chat completion content filter results via the `UngroundedMaterial` property on `ResponseContentFilterResult`, as retrieved from a chat completion via the `GetResponseContentFilterResult()` extension method. -Via `OpenAI 2.0.0-beta.2`: +## Breaking Changes -- Made improvements to the experimental Realtime API. Please note this features area is currently under rapid development and not all changes may be reflected here. - - Several types have been renamed for consistency and clarity. - - ConversationRateLimitsUpdate (previously ConversationRateLimitsUpdatedUpdate) now includes named RequestDetails and TokenDetails properties, mapping to the corresponding named items in the underlying rate_limits command payload. +- `[Experimental]` `ChatCitation` and `ChatRetrievedDocument` have each replaced the `Uri` property of type `System.Uri` with a `string` property named `Url`. This aligns with the REST specification and accounts for the wire value of `url` not always providing a valid RFC 3986 identifier [[azure-sdk-for-net \#46793](https://github.com/Azure/azure-sdk-for-net/issues/46793)] -### Bugs Fixed +## Bugs Fixed -- Addressed an HTTP 401 issue that caused certain connection retry attempts, such as those triggered for HTTP 429 rate limiting errors, to sometimes generate a malformed request with multiple `Authorization` headers that would then be rejected. [#46401](https://github.com/Azure/azure-sdk-for-net/pull/46401) - Addressed an issue that caused `ChatCitation` and `ChatRetrievedDocument` to sometimes throw on deserialization, specifically when a returned value in the `url` JSON field was not populated with an RFC 3986 compliant identifier for `System.Uri` [[azure-sdk-for-net \#46793](https://github.com/Azure/azure-sdk-for-net/issues/46793)] -Via `OpenAI 2.0.0-beta.2`: - -- Fixed serialization and deserialization of ConversationToolChoice literal values (such as "required"). - ## 2.1.0-beta.1 (2024-10-01) Relative to the prior GA release, this update restores preview surfaces, retargeting to the latest `2024-08-01-preview` service `api-version` label. It also brings early support for the newly-announced `/realtime` capabilities with `gpt-4o-realtime-preview`. You can read more about Azure OpenAI support for `/realtime` in the annoucement post here: https://azure.microsoft.com/blog/announcing-new-products-and-features-for-azure-openai-service-including-gpt-4o-realtime-preview-with-audio-and-speech-capabilities/ @@ -634,7 +638,7 @@ management, and align with the Azure SDK guidelines. - In contrast to other capabilities, DALL-E image generation does not require explicit creation or specification of a deployment or model. Its surface as such does not include this concept. - Functions for chat completions are now supported: see [OpenAI's blog post on the topic](https://openai.com/blog/function-calling-and-other-api-updates) for much more detail. - A list of `FunctionDefinition` objects may be populated on `ChatCompletionsOptions` via its `Functions` property. These definitions include a name and description together with a serialized JSON Schema representation of its parameters; these parameters can be generated easily via `BinaryData.FromObjectAsJson` with dynamic objects -- see the README for example usage. - - **NOTE**: Chat Functions requires a minimum of the `-0613` model versions for `gpt-4` and `gpt-3.5-turbo`/`gpt-35-turbo`. Please ensure you're using these later model versions, as Functions are not supported with older model revisions. For Azure OpenAI, you can update a deployment's model version or create a new model deployment with an updated version via the Azure AI Studio interface, also accessible through Azure Portal. + - **NOTE**: Chat Functions requires a minimum of the `-0613` model versions for `gpt-4` and `gpt-3.5-turbo`/`gpt-35-turbo`. Please ensure you're using these later model versions, as Functions are not supported with older model revisions. For Azure OpenAI, you can update a deployment's model version or create a new model deployment with an updated version via the Azure AI Foundry interface, also accessible through Azure Portal. - (Azure OpenAI specific) Completions and Chat Completions responses now include embedded content filter annotations for prompts and responses - A new `Azure.AI.OpenAI.AzureOpenAIModelFactory` is now present for mocking. diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/Directory.Build.props b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/Directory.Build.props index 2d3eea08f..6bc64d160 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/Directory.Build.props +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/Directory.Build.props @@ -4,8 +4,8 @@ $(RepoRoot)/../.dotnet/src/OpenAI.csproj - 2024_10_21 From file: {annotation.InputFileId}, replacement: {annotation.TextToReplace}"); + Assert.That(annotation.InputFileId, Is.Not.Null.And.Not.Empty); + Assert.That(annotation.TextToReplace, Is.Not.Null.And.Not.Empty); } } } diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/AzureOpenAIClientSmokeTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/AzureOpenAIClientSmokeTests.cs new file mode 100644 index 000000000..c4872a707 --- /dev/null +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/AzureOpenAIClientSmokeTests.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.AI.OpenAI.Tests.Utils.Config; +using OpenAI; +using System; + +namespace Azure.AI.OpenAI.Tests; + +[Category("Smoke")] +public class AzureOpenAIClientSmokeTests : AoaiTestBase +{ + private IConfiguration DefaultTestConfig { get; } + + public AzureOpenAIClientSmokeTests(bool isAsync) : base(isAsync) + { + DefaultTestConfig = TestConfig.GetConfig("default"); + } + + [Test] + public void CanCreateClient() + { + AzureOpenAIClient azureOpenAIClient = GetTestTopLevelClient(DefaultTestConfig); + Assert.That(azureOpenAIClient, Is.InstanceOf()); + Assert.That(azureOpenAIClient as OpenAIClient, Is.Not.Null); + } + + [Test] + public void VerifyAllVersionsStringify() + { + foreach (AzureOpenAIClientOptions.ServiceVersion possibleVersionValue + in Enum.GetValues(typeof(AzureOpenAIClientOptions.ServiceVersion))) + { + AzureOpenAIClientOptions clientOptionsWithVersion = new(possibleVersionValue); + string stringifiedVersion = clientOptionsWithVersion.GetRawServiceApiValueForClient(null); + Assert.That(stringifiedVersion, Is.Not.Null.And.Not.Empty); + } + } +} diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/BatchTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/BatchTests.cs index 0999e43bc..c0d379b0e 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/BatchTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/BatchTests.cs @@ -1,27 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Azure.AI.OpenAI.Files; +using OpenAI.Batch; +using OpenAI.Chat; +using OpenAI.Files; +using OpenAI.TestFramework; using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Net.Http; using System.Text.Json; -using System.Text.RegularExpressions; using System.Threading.Tasks; -using Azure.AI.OpenAI.Files; -using Azure.AI.OpenAI.Tests.Models; -using Azure.AI.OpenAI.Tests.Utils; -using Azure.AI.OpenAI.Tests.Utils.Config; -using OpenAI.Batch; -using OpenAI.Chat; -using OpenAI.Embeddings; -using OpenAI.Files; -using OpenAI.TestFramework; -using OpenAI.TestFramework.Mocks; -using OpenAI.TestFramework.Utils; namespace Azure.AI.OpenAI.Tests; @@ -30,16 +22,25 @@ namespace Azure.AI.OpenAI.Tests; public class BatchTests : AoaiTestBase { public BatchTests(bool isAsync) : base(isAsync) - { } + { + } [Test] [Category("Smoke")] public void CanCreateClient() => Assert.That(GetTestClient(), Is.InstanceOf()); [RecordedTest] - public async Task CanUploadFileForBatch() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task CanUploadFileForBatch(AzureOpenAIClientOptions.ServiceVersion? version) { - BatchClient batchClient = GetTestClient(); + BatchClient batchClient = GetTestClient(GetTestClientOptions(version)); OpenAIFileClient fileClient = GetTestClientFrom(batchClient); OpenAIFile newFile = await fileClient.UploadFileAsync( @@ -48,26 +49,31 @@ public async Task CanUploadFileForBatch() FileUploadPurpose.Batch); Validate(newFile); - AzureOpenAIFileStatus azureStatus = newFile.Status.ToAzureOpenAIFileStatus(); - Assert.That(azureStatus, Is.EqualTo(AzureOpenAIFileStatus.Pending)); - - TimeSpan filePollingInterval = Recording!.Mode == RecordedTestMode.Playback ? TimeSpan.FromMilliseconds(1) : TimeSpan.FromSeconds(5); - - for (int i = 0; i < 10 && azureStatus == AzureOpenAIFileStatus.Pending; i++) - { - await Task.Delay(filePollingInterval); - newFile = await fileClient.GetFileAsync(newFile.Id); - azureStatus = newFile.Status.ToAzureOpenAIFileStatus(); - } + // In contrast to fine-tuning, files uploaded for batch will immediately enter -- and remain -- in a + // 'processed' state. Validation is performed via the batch client directly. + AzureOpenAIFileStatus azureStatus = newFile.GetAzureOpenAIFileStatus(); + Assert.That(azureStatus, Is.EqualTo(AzureOpenAIFileStatus.Processed)); - Assert.That(azureStatus, Is.EqualTo(AzureOpenAIFileStatus.Error)); - Assert.That(newFile.StatusDetails, Does.Contain("valid json")); + string createdFileId = newFile.Id; + newFile = await fileClient.GetFileAsync(createdFileId); + Validate(newFile); + Assert.That(newFile.Id, Is.EqualTo(createdFileId)); + Assert.That(newFile.GetAzureOpenAIFileStatus(), Is.EqualTo(AzureOpenAIFileStatus.Processed)); } [RecordedTest] - public async Task CanCancelBatch() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + // [TestCase(null)] + [Category("LongRunning")] // observed live runtime up to 5 minutes + public async Task CanCancelBatch(AzureOpenAIClientOptions.ServiceVersion? version) { - BatchClient batchClient = GetTestClient(); + BatchClient batchClient = GetTestClient(GetTestClientOptions(version)); OpenAIFileClient fileClient = GetTestClientFrom(batchClient); string deploymentName = TestConfig.GetConfig()!.Deployment!; @@ -112,10 +118,18 @@ public async Task CanCancelBatch() } [RecordedTest] +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] [Category("LongRunning")] // observed live runtime typically varies from 6 - 15 minutes - public async Task SimpleBatchCompletionsTest() + public async Task SimpleBatchCompletionsTest(AzureOpenAIClientOptions.ServiceVersion? version) { - BatchClient batchClient = GetTestClient(); + BatchClient batchClient = GetTestClient(GetTestClientOptions(version)); OpenAIFileClient fileClient = GetTestClientFrom(batchClient); string deploymentName = TestConfig.GetConfig()!.Deployment!; @@ -207,6 +221,11 @@ public async Task SimpleBatchCompletionsTest() } } + private TestClientOptions GetTestClientOptions(AzureOpenAIClientOptions.ServiceVersion? version) + { + return version is null ? new TestClientOptions() : new TestClientOptions(version.Value); + } + private List GetVerifiedBatchOutputsOf( BinaryData downloadBytes, IList expectedCustomIds) diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.Audio.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.Audio.cs new file mode 100644 index 000000000..d1dcfd9b4 --- /dev/null +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.Audio.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Azure.AI.OpenAI.Chat; +using OpenAI.Chat; +using OpenAI.TestFramework; + +namespace Azure.AI.OpenAI.Tests; + +public partial class ChatTests +{ + [RecordedTest] + public async Task ChatAudioWorks() + { + ChatClient client = GetTestClient("chat_audio"); + + // Part 1a: exercise non-streaming request for text & audio via a user message with (input) audio content + + BinaryData helloWorldAudioBytes = BinaryData.FromBytes(File.ReadAllBytes(Assets.HelloWorldMp3.RelativePath)); + ChatMessageContentPart helloWorldAudioContentPart = ChatMessageContentPart.CreateInputAudioPart( + helloWorldAudioBytes, + ChatInputAudioFormat.Mp3); + + List messages = [new UserChatMessage([helloWorldAudioContentPart])]; + + ChatCompletionOptions options = new() + { + ResponseModalities = ChatResponseModalities.Text | ChatResponseModalities.Audio, + AudioOptions = new(ChatOutputAudioVoice.Alloy, ChatOutputAudioFormat.Pcm16) + }; + + // Part 1b: verify non-streaming response audio + + ChatCompletion completion = await client.CompleteChatAsync(messages, options); + Assert.That(completion, Is.Not.Null); + Assert.That(completion.Content, Has.Count.EqualTo(0)); + + ChatOutputAudio outputAudio = completion.OutputAudio; + Assert.That(outputAudio, Is.Not.Null); + Assert.That(outputAudio.Id, Is.Not.Null.And.Not.Empty); + Assert.That(outputAudio.AudioBytes, Is.Not.Null); + Assert.That(outputAudio.Transcript, Is.Not.Null.And.Not.Empty); + Assert.That(outputAudio.ExpiresAt, Is.GreaterThan(new DateTimeOffset(2024, 11, 1, 0, 0, 0, TimeSpan.Zero))); + + // Part 2: verify construction of conversation history with past response message audio (via ID) + + AssistantChatMessage audioHistoryMessage = ChatMessage.CreateAssistantMessage(completion); + Assert.That(audioHistoryMessage, Is.InstanceOf()); + Assert.That(audioHistoryMessage.Content, Has.Count.EqualTo(0)); + + Assert.That(audioHistoryMessage.OutputAudioReference?.Id, Is.EqualTo(completion.OutputAudio.Id)); + messages.Add(audioHistoryMessage); + + // Part 2b: add another, new audio content part (user message) afterwards + + BinaryData whatsTheWeatherAudioBytes = BinaryData.FromBytes(File.ReadAllBytes(Assets.AudioWhatsTheWeatherPcm16.RelativePath)); + ChatMessageContentPart whatsTheWeatherAudioContentPart = ChatMessageContentPart.CreateInputAudioPart( + whatsTheWeatherAudioBytes, + ChatInputAudioFormat.Wav); + + messages.Add( + new UserChatMessage( + [ + "Please answer the following spoken question:", + ChatMessageContentPart.CreateInputAudioPart(whatsTheWeatherAudioBytes, ChatInputAudioFormat.Wav), + ])); + + // Part 3: verify streaming response audio + + string? streamedCorrelationId = null; + DateTimeOffset? streamedExpiresAt = null; + StringBuilder streamedTranscriptBuilder = new(); + using MemoryStream outputAudioStream = new(); + await foreach (StreamingChatCompletionUpdate update in client.CompleteChatStreamingAsync(messages, options)) + { + Assert.That(update.ContentUpdate, Has.Count.EqualTo(0)); + StreamingChatOutputAudioUpdate outputAudioUpdate = update.OutputAudioUpdate; + + if (outputAudioUpdate is not null) + { + string serializedOutputAudioUpdate = ModelReaderWriter.Write(outputAudioUpdate).ToString(); + Assert.That(serializedOutputAudioUpdate, Is.Not.Null.And.Not.Empty); + + if (outputAudioUpdate.Id is not null) + { + Assert.That(streamedCorrelationId, Is.Null.Or.EqualTo(streamedCorrelationId)); + streamedCorrelationId ??= outputAudioUpdate.Id; + } + if (outputAudioUpdate.ExpiresAt.HasValue) + { + Assert.That(streamedExpiresAt.HasValue, Is.False); + streamedExpiresAt = outputAudioUpdate.ExpiresAt; + } + streamedTranscriptBuilder.Append(outputAudioUpdate.TranscriptUpdate); + byte[] audioUpdateBytes = outputAudioUpdate.AudioBytesUpdate?.ToArray() ?? []; + outputAudioStream.Write(audioUpdateBytes, 0, audioUpdateBytes.Length); + } + } + Assert.That(streamedCorrelationId, Is.Not.Null.And.Not.Empty); + Assert.That(streamedExpiresAt.HasValue, Is.True); + Assert.That(streamedTranscriptBuilder.ToString(), Is.Not.Null.And.Not.Empty); + Assert.That(outputAudioStream.Length, Is.GreaterThan(9000)); + } +} diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.Tools.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.Tools.cs index 535a599a0..35b46d7a5 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.Tools.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.Tools.cs @@ -60,7 +60,7 @@ public enum ToolChoiceTestType [TestCase(ToolChoiceTestType.None)] [TestCase(ToolChoiceTestType.Auto)] [TestCase(ToolChoiceTestType.Tool)] - [TestCase(ToolChoiceTestType.Required, Ignore = "This seems to be considered invalid")] + [TestCase(ToolChoiceTestType.Required)] public async Task SimpleToolWorks(ToolChoiceTestType toolChoice) { ChatClient client = GetTestClient(); diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.cs index 3f3d7486c..737f80951 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ChatTests.cs @@ -234,6 +234,7 @@ public async Task DefaultAzureCredentialWorks() [RecordedTest] [Ignore("Delay behavior not emulated by recordings, and needs to be run manually with some time in between iterations due to service throttling behavior")] + [Category("Live")] [TestCase("x-ms-retry-after-ms", "1000", 1000)] [TestCase("retry-after-ms", "1400", 1400)] [TestCase("Retry-After", "1", 1000)] @@ -516,6 +517,31 @@ public async Task StructuredOutputsWork() Assert.IsTrue(stepsProperty.ValueKind == JsonValueKind.Array); } + [RecordedTest] + public async Task UserSecurityContextWorks() + { + ChatClient client = GetTestClient(); + + string userId = Guid.NewGuid().ToString(); + string sourceIP = "123.456.78.9"; + UserSecurityContext userSecurityContext = new() + { + EndUserId = userId, + SourceIP = sourceIP, + }; + + ChatCompletionOptions options = new(); + options.SetUserSecurityContext(userSecurityContext); + + UserSecurityContext retrievedUserSecurityContext = options.GetUserSecurityContext(); + Assert.That(retrievedUserSecurityContext, Is.Not.Null); + Assert.That(retrievedUserSecurityContext.EndUserId, Is.EqualTo(userId)); + Assert.That(retrievedUserSecurityContext.SourceIP, Is.EqualTo(sourceIP)); + + ChatCompletion completion = await client.CompleteChatAsync([ChatMessage.CreateUserMessage("Hello, world!")]); + Assert.That(completion, Is.Not.Null); + } + #endregion #region Streaming chat completion tests @@ -647,12 +673,22 @@ public async Task SearchExtensionWorksStreaming() } [RecordedTest] - public async Task AsyncContentFilterWorksStreaming() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task AsyncContentFilterWorksStreaming(AzureOpenAIClientOptions.ServiceVersion? version) { // Precondition: the target deployment is configured with an async content filter that includes a // custom blocklist that will filter variations of the word 'banana.' - ChatClient client = GetTestClient(TestConfig.GetConfig("chat_with_async_filter")); + ChatClient client = GetTestClient( + TestConfig.GetConfig("chat_with_async_filter"), + GetTestClientOptions(version)); StringBuilder contentBuilder = new(); @@ -697,11 +733,80 @@ in client.CompleteChatStreamingAsync( #endregion - #region Tests for interim o1 model support regarding new max_completion_tokens + [RecordedTest] + public async Task ChatWithO1Works() + { + IConfiguration testConfig = TestConfig.GetConfig("chat_o1")!; + + ChatClient client = GetTestClient(testConfig); + + ChatCompletion completion = await client.CompleteChatAsync([ChatMessage.CreateUserMessage("Hello, world!")]); + Assert.That(completion, Is.Not.Null); + } + +#if NET + [RecordedTest] + public async Task PredictedOutputsWork() + { + ChatClient client = GetTestClient(); + + foreach (ChatOutputPrediction predictionVariant in new List( + [ + // Plain string + ChatOutputPrediction.CreateStaticContentPrediction(""" + { + "feature_name": "test_feature", + "enabled": true + } + """.ReplaceLineEndings("\n")), + // One content part + ChatOutputPrediction.CreateStaticContentPrediction( + [ + ChatMessageContentPart.CreateTextPart(""" + { + "feature_name": "test_feature", + "enabled": true + } + """.ReplaceLineEndings("\n")), + ]), + // Several content parts + ChatOutputPrediction.CreateStaticContentPrediction( + [ + "{\n", + " \"feature_name\": \"test_feature\",\n", + " \"enabled\": true\n", + "}", + ]), + ])) + { + ChatCompletionOptions options = new() + { + OutputPrediction = predictionVariant, + }; + + ChatMessage message = ChatMessage.CreateUserMessage(""" + Modify the following input to enable the feature. Only respond with the JSON and include no other text. Do not enclose in markdown backticks or any other additional annotations. + + { + "feature_name": "test_feature", + "enabled": false + } + """.ReplaceLineEndings("\n")); + + ChatCompletion completion = await client.CompleteChatAsync([message], options); + + Assert.That(completion.Usage.OutputTokenDetails.AcceptedPredictionTokenCount, Is.GreaterThan(0)); + } + } +#endif - #endregion #region Helper methods + private TestClientOptions GetTestClientOptions(AzureOpenAIClientOptions.ServiceVersion? version) + { + return version is null ? new TestClientOptions() : new TestClientOptions(version.Value); + } + private void ValidateUpdate(StreamingChatCompletionUpdate update, StringBuilder builder, ref bool foundPromptFilter, ref bool foundResponseFilter, ref ChatTokenUsage? usage) { if (update.CreatedAt == UNIX_EPOCH) diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationProtocolTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationProtocolTests.cs index e489f1922..e8b8fecc6 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationProtocolTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationProtocolTests.cs @@ -23,9 +23,11 @@ public ConversationProtocolTests(bool isAsync) : base(isAsync) #if NET6_0_OR_GREATER [Test] - public async Task ProtocolCanConfigureSession() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(null)] + public async Task ProtocolCanConfigureSession(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); BinaryData configureSessionCommand = BinaryData.FromString(""" diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTestFixtureBase.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTestFixtureBase.cs index d718cc1eb..86042d699 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTestFixtureBase.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTestFixtureBase.cs @@ -16,6 +16,7 @@ namespace Azure.AI.OpenAI.Tests; [Parallelizable(ParallelScope.All)] [Category("Conversation")] +[Category("Live")] public class ConversationTestFixtureBase { internal TestConfig TestConfig { get; } = new(() => RecordedTestMode.Live); @@ -39,17 +40,24 @@ public ConversationTestFixtureBase(bool isAsync) } } - public RealtimeConversationClient GetTestClient() => GetTestClient(DefaultConfiguration); - public RealtimeConversationClient GetTestClient(string configurationName) => GetTestClient(TestConfig.GetConfig(configurationName)); - public RealtimeConversationClient GetTestClient(IConfiguration testConfig) + public TestClientOptions GetTestClientOptions(AzureOpenAIClientOptions.ServiceVersion? version) { + return version is null ? new TestClientOptions() : new TestClientOptions(version.Value); + } + + public RealtimeConversationClient GetTestClient(TestClientOptions clientOptions = null) => GetTestClient(DefaultConfiguration, clientOptions); + public RealtimeConversationClient GetTestClient(string configurationName, TestClientOptions clientOptions = null) => GetTestClient(TestConfig.GetConfig(configurationName), clientOptions); + public RealtimeConversationClient GetTestClient(IConfiguration testConfig, TestClientOptions clientOptions = null) + { + clientOptions ??= new(); + Uri endpoint = testConfig.Endpoint; ApiKeyCredential key = new(testConfig.Key); string deployment = testConfig.Deployment; Console.WriteLine($"--- Connecting to endpoint: {endpoint.AbsoluteUri}"); - AzureOpenAIClient topLevelClient = new(endpoint, key); + AzureOpenAIClient topLevelClient = new(endpoint, key, clientOptions); RealtimeConversationClient client = topLevelClient.GetRealtimeConversationClient(testConfig.Deployment); client.OnSendingCommand += (_, data) => PrintMessageData(data, "> "); diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTests.cs index 0c7ffbeb2..2ea29e967 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ConversationTests.cs @@ -1,6 +1,4 @@ -using NUnit.Framework; -using OpenAI; -using OpenAI.RealtimeConversation; +using OpenAI.RealtimeConversation; using System; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -18,14 +16,34 @@ namespace Azure.AI.OpenAI.Tests; [TestFixture(false)] public class ConversationTests : ConversationTestFixtureBase { - public ConversationTests(bool isAsync) : base(isAsync) { } -#if !AZURE_OPENAI_GA +#if AZURE_OPENAI_GA + [Test] + [Category("Smoke")] + public void VersionNotSupportedThrows() + { + Assert.Throws(() => GetTestClient()); + } +#elif !NET + [Test] + public void ThrowsOnOldNetFramework() + { + _ = Assert.ThrowsAsync(async () => + { + RealtimeConversationClient client = GetTestClient(); + using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); + }); + } +#else [Test] - public async Task CanConfigureSession() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] + [TestCase(null)] + public async Task CanConfigureSession(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); ConversationSessionOptions sessionOptions = new() @@ -91,9 +109,13 @@ List GetReceivedUpdates() where T : ConversationUpdate } [Test] - public async Task TextOnlyWorks() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] + [TestCase(null)] + public async Task TextOnlyWorks(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); await session.AddItemAsync( ConversationItem.CreateUserMessage(["Hello, world!"]), @@ -143,14 +165,17 @@ await session.AddItemAsync( if (update is ConversationRateLimitsUpdate rateLimitsUpdate) { - Assert.That(rateLimitsUpdate.AllDetails, Has.Count.EqualTo(2)); - Assert.That(rateLimitsUpdate.TokenDetails, Is.Not.Null); - Assert.That(rateLimitsUpdate.TokenDetails.Name, Is.EqualTo("tokens")); - Assert.That(rateLimitsUpdate.TokenDetails.MaximumCount, Is.GreaterThan(0)); - Assert.That(rateLimitsUpdate.TokenDetails.RemainingCount, Is.GreaterThan(0)); - Assert.That(rateLimitsUpdate.TokenDetails.RemainingCount, Is.LessThan(rateLimitsUpdate.TokenDetails.MaximumCount)); - Assert.That(rateLimitsUpdate.TokenDetails.TimeUntilReset, Is.GreaterThan(TimeSpan.Zero)); - Assert.That(rateLimitsUpdate.RequestDetails, Is.Not.Null); + // Errata (2025-01-22): no rate limit items being reported + // {"type":"rate_limits.updated","event_id":"event_AscnhKHfFTapqAeiQfE60","rate_limits":[]} + + //Assert.That(rateLimitsUpdate.AllDetails, Has.Count.EqualTo(2)); + //Assert.That(rateLimitsUpdate.TokenDetails, Is.Not.Null); + //Assert.That(rateLimitsUpdate.TokenDetails.Name, Is.EqualTo("tokens")); + //Assert.That(rateLimitsUpdate.TokenDetails.MaximumCount, Is.GreaterThan(0)); + //Assert.That(rateLimitsUpdate.TokenDetails.RemainingCount, Is.GreaterThan(0)); + //Assert.That(rateLimitsUpdate.TokenDetails.RemainingCount, Is.LessThan(rateLimitsUpdate.TokenDetails.MaximumCount)); + //Assert.That(rateLimitsUpdate.TokenDetails.TimeUntilReset, Is.GreaterThan(TimeSpan.Zero)); + //Assert.That(rateLimitsUpdate.RequestDetails, Is.Not.Null); gotRateLimits = true; } } @@ -166,9 +191,13 @@ await session.AddItemAsync( } [Test] - public async Task ItemManipulationWorks() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] + [TestCase(null)] + public async Task ItemManipulationWorks(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); await session.ConfigureSessionAsync( @@ -241,9 +270,13 @@ await session.AddItemAsync( } [Test] - public async Task AudioWithToolsWorks() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] + [TestCase(null)] + public async Task AudioWithToolsWorks(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); ConversationFunctionTool getWeatherTool = new() @@ -339,9 +372,13 @@ public async Task AudioWithToolsWorks() } [Test] - public async Task CanDisableVoiceActivityDetection() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] + [TestCase(null)] + public async Task CanDisableVoiceActivityDetection(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); await session.ConfigureSessionAsync( @@ -388,9 +425,13 @@ or ConversationResponseStartedUpdate } [Test] - public async Task CanUseManualVadTurnDetection() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] + [TestCase(null)] + public async Task CanUseManualVadTurnDetection(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); await session.ConfigureSessionAsync( @@ -461,9 +502,13 @@ await session.ConfigureSessionAsync( } [Test] - public async Task BadCommandProvidesError() + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] + [TestCase(null)] + public async Task BadCommandProvidesError(AzureOpenAIClientOptions.ServiceVersion? version) { - RealtimeConversationClient client = GetTestClient(); + RealtimeConversationClient client = GetTestClient(GetTestClientOptions(version)); using RealtimeConversationSession session = await client.StartConversationSessionAsync(CancellationToken); await session.SendCommandAsync( @@ -489,12 +534,5 @@ await session.SendCommandAsync( Assert.That(gotErrorUpdate, Is.True); } -#else - [Test] - [Category("Smoke")] - public void VersionNotSupportedThrows() - { - Assert.Throws(() => GetTestClient()); - } -#endif +#endif // "else" to AZURE_OPENAI_GA, !NET } diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs index 710405889..aefe3c227 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs @@ -11,16 +11,25 @@ namespace Azure.AI.OpenAI.Tests; public class FileTests : AoaiTestBase { public FileTests(bool isAsync) : base(isAsync) - { } + { + } [Test] [Category("Smoke")] public void CanCreateClient() => Assert.That(GetTestClient(), Is.InstanceOf()); [RecordedTest] - public async Task CanUploadAndDeleteFiles() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + //[TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task CanUploadAndDeleteFiles(AzureOpenAIClientOptions.ServiceVersion? version) { - OpenAIFileClient client = GetTestClient(); + OpenAIFileClient client = GetTestClient(GetTestClientOptions(version)); OpenAIFile file = await client.UploadFileAsync( BinaryData.FromString("hello, world!"), "test_file_delete_me.txt", @@ -32,10 +41,23 @@ public async Task CanUploadAndDeleteFiles() } [RecordedTest] - public async Task CanListFiles() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task CanListFiles(AzureOpenAIClientOptions.ServiceVersion? version) { - OpenAIFileClient client = GetTestClient(); + OpenAIFileClient client = GetTestClient(GetTestClientOptions(version)); OpenAIFileCollection files = await client.GetFilesAsync(); Assert.That(files, Has.Count.GreaterThan(0)); } + + private static TestClientOptions GetTestClientOptions(AzureOpenAIClientOptions.ServiceVersion? version) + { + return version is null ? new TestClientOptions() : new TestClientOptions(version.Value); + } } diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FineTuningTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FineTuningTests.cs index ce12b8f82..2a99737f5 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FineTuningTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/FineTuningTests.cs @@ -17,6 +17,8 @@ using OpenAI.FineTuning; using OpenAI.TestFramework; using OpenAI.TestFramework.Utils; +using Azure.AI.OpenAI.Files; + #if !AZURE_OPENAI_GA using Azure.AI.OpenAI.FineTuning; @@ -24,15 +26,13 @@ namespace Azure.AI.OpenAI.Tests; +#pragma warning disable CS0618 + [Category("FineTuning")] public class FineTuningTests : AoaiTestBase { public FineTuningTests(bool isAsync) : base(isAsync) { - if (Mode == RecordedTestMode.Playback) - { - Assert.Inconclusive("Playback for fine-tuning temporarily disabled"); - } } #if !AZURE_OPENAI_GA @@ -41,9 +41,56 @@ public FineTuningTests(bool isAsync) : base(isAsync) public void CanCreateClient() => Assert.That(GetTestClient(), Is.InstanceOf()); [RecordedTest] - public async Task JobsFineTuning() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task CanUploadFileForFineTuning(AzureOpenAIClientOptions.ServiceVersion? version) + { + FineTuningClient ftClient = GetTestClient(GetTestClientOptions(version)); + OpenAIFileClient fileClient = GetTestClientFrom(ftClient); + + OpenAIFile newFile = await fileClient.UploadFileAsync( + BinaryData.FromString("this isn't valid input for fine tuning"), + "intentionally-bad-ft-input.jsonl", + FileUploadPurpose.FineTune); + Validate(newFile); + + // In contrast to batch, files uploaded for fine tuning will initially appear in a 'pending' state, + // transitioning into a terminal as input validation is handled. In this case, because malformed input is + // uploaded, the terminal status should be 'error'. + AzureOpenAIFileStatus azureStatus = newFile.GetAzureOpenAIFileStatus(); + Assert.That(azureStatus, Is.EqualTo(AzureOpenAIFileStatus.Pending)); + + TimeSpan filePollingInterval = Recording!.Mode == RecordedTestMode.Playback ? TimeSpan.FromMilliseconds(1) : TimeSpan.FromSeconds(5); + + for (int i = 0; i < 10 && azureStatus == AzureOpenAIFileStatus.Pending; i++) + { + await Task.Delay(filePollingInterval); + newFile = await fileClient.GetFileAsync(newFile.Id); + azureStatus = newFile.GetAzureOpenAIFileStatus(); + } + + Assert.That(azureStatus, Is.EqualTo(AzureOpenAIFileStatus.Error)); + Assert.That(newFile.StatusDetails.ToLower(), Does.Contain("validation of jsonl")); + } + + [RecordedTest] +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + //[TestCase(null)] + public async Task JobsFineTuning(AzureOpenAIClientOptions.ServiceVersion? version) { - FineTuningClient client = GetTestClient(); + FineTuningClient client = GetTestClient(GetTestClientOptions(version)); int count = 25; @@ -63,10 +110,18 @@ public async Task JobsFineTuning() } [RecordedTest] - public async Task CheckpointsFineTuning() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task CheckpointsFineTuning(AzureOpenAIClientOptions.ServiceVersion? version) { + FineTuningClient client = GetTestClient(GetTestClientOptions(version)); string fineTunedModel = GetFineTunedModel(); - FineTuningClient client = GetTestClient(); // Check if the model exists by searching all jobs FineTuningJob job = await EnumerateJobsAsync(client) @@ -100,10 +155,18 @@ public async Task CheckpointsFineTuning() } [RecordedTest] - public async Task EventsFineTuning() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + //[TestCase(null)] + public async Task EventsFineTuning(AzureOpenAIClientOptions.ServiceVersion? version) { + FineTuningClient client = GetTestClient(GetTestClientOptions(version)); string fineTunedModel = GetFineTunedModel(); - FineTuningClient client = GetTestClient(); // Check if the model exists by searching all jobs FineTuningJob job = await EnumerateJobsAsync(client) @@ -138,31 +201,23 @@ public async Task EventsFineTuning() } [RecordedTest] - public async Task CreateAndCancelFineTuning() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task CreateAndCancelFineTuning(AzureOpenAIClientOptions.ServiceVersion? version) { + FineTuningClient client = GetTestClient(GetTestClientOptions(version)); var fineTuningFile = Assets.FineTuning; - FineTuningClient client = GetTestClient(); OpenAIFileClient fileClient = GetTestClientFrom(client); - OpenAIFile uploadedFile; - try - { - ClientResult fileResult = await fileClient.GetFileAsync("file-db5f5bfe5ea04ffcaeba89947a872828", new RequestOptions() { }); - uploadedFile = ValidateAndParse(fileResult); - } - catch (ClientResultException e) - { - if (e.Message.Contains("ResourceNotFound")) - { - // upload training data - uploadedFile = await UploadAndWaitForCompleteOrFail(fileClient, fineTuningFile.RelativePath); - } - else - { - throw; - } - } + OpenAIFile uploadedFile = await UploadAndWaitForCompleteOrFail(fileClient, fineTuningFile.RelativePath); + Validate(uploadedFile); // Create the fine tuning job using var requestContent = new FineTuningOptions() @@ -184,6 +239,7 @@ public async Task CreateAndCancelFineTuning() // Wait for some events to become available ClientResult result; ListResponse events; + TimeSpan pollingInterval = Recording!.Mode == RecordedTestMode.Playback ? TimeSpan.FromMilliseconds(1) : TimeSpan.FromSeconds(2); int maxLoops = 10; do { @@ -201,7 +257,7 @@ public async Task CreateAndCancelFineTuning() break; } - await Task.Delay(TimeSpan.FromSeconds(2)); + await Task.Delay(pollingInterval); } while (maxLoops-- > 0); @@ -215,30 +271,20 @@ public async Task CreateAndCancelFineTuning() } [RecordedTest] - public async Task CreateAndDeleteFineTuning() +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] + public async Task CreateAndDeleteFineTuning(AzureOpenAIClientOptions.ServiceVersion? version) { + FineTuningClient client = GetTestClient(GetTestClientOptions(version)); var fineTuningFile = Assets.FineTuning; - - FineTuningClient client = GetTestClient(); OpenAIFileClient fileClient = GetTestClientFrom(client); - OpenAIFile uploadedFile; - try - { - ClientResult fileResult = await fileClient.GetFileAsync("file-db5f5bfe5ea04ffcaeba89947a872828", new RequestOptions() { }); - uploadedFile = ValidateAndParse(fileResult); - } - catch (ClientResultException e) - { - if (e.Message.Contains("ResourceNotFound")) - { - // upload training data - uploadedFile = await UploadAndWaitForCompleteOrFail(fileClient, fineTuningFile.RelativePath); - } - else - { - throw; - } - } + OpenAIFile uploadedFile = await UploadAndWaitForCompleteOrFail(fileClient, fineTuningFile.RelativePath); // Create the fine tuning job using var requestContent = new FineTuningOptions() @@ -269,12 +315,20 @@ public async Task CreateAndDeleteFineTuning() Assert.True(deleted, "Failed to delete fine tuning model: {0}", job.FineTunedModel); } - [RecordedTest]//AutomaticRecord = false)] + [RecordedTest] +#if !AZURE_OPENAI_GA + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_12_01_Preview)] + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2025_01_01_Preview)] +#else + [TestCase(AzureOpenAIClientOptions.ServiceVersion.V2024_10_21)] +#endif + [TestCase(null)] [Category("LongRunning")] // CAUTION: This test can take around 10 to 15 *minutes* in live mode to run - public async Task DeployAndChatWithModel() + public async Task DeployAndChatWithModel(AzureOpenAIClientOptions.ServiceVersion? version) { + FineTuningClient client = GetTestClient(GetTestClientOptions(version)); string fineTunedModel = GetFineTunedModel(); - FineTuningClient client = GetTestClient(); AzureDeploymentClient deploymentClient = GetTestClientFrom(client); string? deploymentName = null; @@ -348,6 +402,11 @@ public async Task DeployAndChatWithModel() #region helper methods + private TestClientOptions GetTestClientOptions(AzureOpenAIClientOptions.ServiceVersion? version) + { + return version is null ? new TestClientOptions() : new TestClientOptions(version.Value); + } + private string GetFineTunedModel() { string? model = TestConfig.GetConfig() @@ -402,7 +461,7 @@ private async IAsyncEnumerable EnumerateAsync(Func DeleteJobAndVerifyAsync(AzureFineTuningJobOperation operation, string jobId, TimeSpan? timeBetween = null, TimeSpan? maxWaitTime = null) { var stopTime = DateTimeOffset.Now + (maxWaitTime ?? TimeSpan.FromMinutes(1)); - var sleepTime = timeBetween ?? TimeSpan.FromSeconds(2); + TimeSpan sleepTime = timeBetween ?? (Recording!.Mode == RecordedTestMode.Playback ? TimeSpan.FromMilliseconds(1): TimeSpan.FromSeconds(2)); RequestOptions noThrow = new() { diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ImageTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ImageTests.cs index e97480a2a..9c67c1ca6 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ImageTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/ImageTests.cs @@ -68,7 +68,6 @@ public async Task CanGetContentFilterResults() GeneratedImage image = imageResult.Value; Assert.That(image, Is.Not.Null); Assert.That(image.ImageUri, Is.Not.Null); - Console.WriteLine($"RESPONSE--\n{imageResult.GetRawResponse().Content}"); RequestImageContentFilterResult promptResults = image.GetRequestContentFilterResult(); ResponseImageContentFilterResult responseResults = image.GetResponseContentFilterResult(); Assert.That(promptResults?.Sexual?.Severity, Is.EqualTo(ContentFilterSeverity.Safe)); diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/AoaiTestBase.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/AoaiTestBase.cs index 6a3b3118e..674dbfe96 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/AoaiTestBase.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/AoaiTestBase.cs @@ -641,10 +641,18 @@ protected void Cleanup() }); RequestOptions requestOptions = new() { ErrorOptions = ClientErrorBehaviors.NoThrow, }; + void WriteIfNotSuppressed(string message) + { + if (Environment.GetEnvironmentVariable("AOAI_SUPPRESS_TRAFFIC_DUMP") != "true") + { + Console.WriteLine(message); + } + } + OpenAIFileClient fileClient = topLevelCleanupClient.GetOpenAIFileClient(); foreach (string fileId in _fileIdsToDelete) { - Console.WriteLine($"Cleanup: {fileId} -> {fileClient.DeleteFile(fileId, requestOptions)?.GetRawResponse().Status}"); + WriteIfNotSuppressed($"Cleanup: {fileId} -> {fileClient.DeleteFile(fileId, requestOptions)?.GetRawResponse().Status}"); } _fileIdsToDelete.Clear(); @@ -659,23 +667,23 @@ protected void Cleanup() VectorStoreClient vectorStoreClient = topLevelCleanupClient.GetVectorStoreClient(); foreach ((string threadId, string messageId) in _threadIdsWithMessageIdsToDelete) { - Console.WriteLine($"Cleanup: {messageId} -> {client.DeleteMessage(threadId, messageId, requestOptions)?.GetRawResponse().Status}"); + WriteIfNotSuppressed($"Cleanup: {messageId} -> {client.DeleteMessage(threadId, messageId, requestOptions)?.GetRawResponse().Status}"); } foreach (string assistantId in _assistantIdsToDelete) { - Console.WriteLine($"Cleanup: {assistantId} -> {client.DeleteAssistant(assistantId, requestOptions)?.GetRawResponse().Status}"); + WriteIfNotSuppressed($"Cleanup: {assistantId} -> {client.DeleteAssistant(assistantId, requestOptions)?.GetRawResponse().Status}"); } foreach (string threadId in _threadIdsToDelete) { - Console.WriteLine($"Cleanup: {threadId} -> {client.DeleteThread(threadId, requestOptions)?.GetRawResponse().Status}"); + WriteIfNotSuppressed($"Cleanup: {threadId} -> {client.DeleteThread(threadId, requestOptions)?.GetRawResponse().Status}"); } foreach ((string vectorStoreId, string fileId) in _vectorStoreFileAssociationsToRemove) { - Console.WriteLine($"Cleanup: {vectorStoreId}<->{fileId} => {vectorStoreClient.RemoveFileFromStore(vectorStoreId, fileId, requestOptions)?.GetRawResponse().Status}"); + WriteIfNotSuppressed($"Cleanup: {vectorStoreId}<->{fileId} => {vectorStoreClient.RemoveFileFromStore(vectorStoreId, fileId, requestOptions)?.GetRawResponse().Status}"); } foreach (string vectorStoreId in _vectorStoreIdsToDelete) { - Console.WriteLine($"Cleanup: {vectorStoreId} => {vectorStoreClient.DeleteVectorStore(vectorStoreId, requestOptions)?.GetRawResponse().Status}"); + WriteIfNotSuppressed($"Cleanup: {vectorStoreId} => {vectorStoreClient.DeleteVectorStore(vectorStoreId, requestOptions)?.GetRawResponse().Status}"); } _threadIdsWithMessageIdsToDelete.Clear(); _assistantIdsToDelete.Clear(); @@ -756,6 +764,6 @@ public TestClientOptions() : base() public TestClientOptions(ServiceVersion version) : base(version) { } - public bool ShouldOutputRequests { get; set; } = true; - public bool ShouldOutputResponses { get; set; } = true; + public bool ShouldOutputRequests { get; set; } = Environment.GetEnvironmentVariable("AOAI_SUPPRESS_TRAFFIC_DUMP") != "true"; + public bool ShouldOutputResponses { get; set; } = Environment.GetEnvironmentVariable("AOAI_SUPPRESS_TRAFFIC_DUMP") != "true"; } diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/Assets.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/Assets.cs index 15590bc9c..3b54e8316 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/Assets.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/Utils/Assets.cs @@ -19,6 +19,15 @@ public Assets() RelativePath = GetPath("hello_world.m4a"), MimeType = "audio/m4a" }; + HelloWorldMp3 = new() + { + Type = AssetType.Audio, + Language = "en", + Description = "Hello world", + Name = "audio_hello_world.mp3", + RelativePath = GetPath("audio_hello_world.mp3"), + MimeType = "audio/mp3" + }; WhisperFrenchDescription = new() { Type = AssetType.Audio, @@ -47,12 +56,23 @@ public Assets() RelativePath = GetPath("fine_tuning.jsonl"), MimeType = "text/plain" }; + AudioWhatsTheWeatherPcm16 = new() + { + Type = AssetType.Audio, + Language = "en", + Description = "Fine tuning data for Open AI to generate a JSON object based on sports headlines", + Name = "whats_the_weather_pcm16_24khz_mono.wav", + RelativePath = GetPath("whats_the_weather_pcm16_24khz_mono.wav"), + MimeType = "audio/wav" + }; } public virtual AssetInfo HelloWorld { get; } + public virtual AssetInfo HelloWorldMp3 { get; } public virtual AssetInfo WhisperFrenchDescription { get; } public virtual AssetInfo DogAndCat { get; } public virtual AssetInfo FineTuning { get; } + public virtual AssetInfo AudioWhatsTheWeatherPcm16 { get; } protected virtual string GetPath(string assetName) { diff --git a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs index 3443a1947..f38a462d5 100644 --- a/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs +++ b/.dotnet.azure/sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs @@ -176,7 +176,8 @@ public async Task CanAssociateFiles() Assert.True(removalResult.Removed); // Errata: removals aren't immediately reflected when requesting the list - await Task.Delay(TimeSpan.FromSeconds(5)); + TimeSpan waitTime = Recording!.Mode == RecordedTestMode.Playback ? TimeSpan.FromMilliseconds(1) : TimeSpan.FromSeconds(10); + await Task.Delay(waitTime); int count = 0; AsyncCollectionResult response = client.GetFileAssociationsAsync(vectorStore.Id); diff --git a/.dotnet.azure/sdk/openai/tools/TestFramework/src/RecordedTestAttribute.cs b/.dotnet.azure/sdk/openai/tools/TestFramework/src/RecordedTestAttribute.cs index 5f98e8d75..f52e063e5 100644 --- a/.dotnet.azure/sdk/openai/tools/TestFramework/src/RecordedTestAttribute.cs +++ b/.dotnet.azure/sdk/openai/tools/TestFramework/src/RecordedTestAttribute.cs @@ -121,7 +121,8 @@ private static bool IsRecordingPlaybackFailure(TestResult result) // 2. Check if the failure message indicates a recording playback exception. This sadly requires us to check test failure // messages which can be a little fragile but there does not seem to be a way to get the exception directly - if (result.Message?.Contains(exceptionName) == true) + if (result.Message?.Contains(exceptionName) == true + || result.Message?.Contains("ClientResultException : NotFound: Recording file path") == true) { return true; } diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..ab873d008 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.cs text=auto +*.tsp text=auto +*.yaml text=auto \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f19a24acc..d330bdf99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -112,11 +112,11 @@ jobs: --no-build --filter "(TestCategory!=Live)" --logger "trx;LogFileName=Azure.AI.OpenAI.Tests.trx" - --logger:"console;verbosity=quiet" --blame-crash-dump-type full --blame-hang-dump-type full --blame-hang-timeout 15minutes --results-directory "${{github.workspace}}/TestResults" + -e AOAI_SUPPRESS_TRAFFIC_DUMP="true" Azure.AI.OpenAI/tests/Azure.AI.OpenAI.Tests.csproj working-directory: .dotnet.azure/sdk/openai diff --git a/.openapi3.azure/openapi3-azure-openai-2024-06-01-generated.yaml b/.openapi3.azure/openapi3-azure-openai-2024-06-01-generated.yaml index 0ea9c6b83..80daf6f81 100644 --- a/.openapi3.azure/openapi3-azure-openai-2024-06-01-generated.yaml +++ b/.openapi3.azure/openapi3-azure-openai-2024-06-01-generated.yaml @@ -7,27 +7,6 @@ tags: - name: Images - name: Assistants paths: - /chat/completions: - post: - operationId: createChatCompletion - parameters: [] - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' - - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' - tags: - - Chat - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AzureCreateChatCompletionRequest' /deployments/{deploymentId}/images/generations: post: operationId: ImageGenerations_Create @@ -86,34 +65,81 @@ paths: application/json: schema: $ref: '#/components/schemas/OpenAI.CreateMessageRequest' + /{deployment_id}/chat/completions: + post: + operationId: createChatCompletion + parameters: + - name: deployment_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' + - type: array + items: + $ref: '#/components/schemas/AzureChatCompletionStreamResponseDelta' + - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' + tags: + - Chat + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AzureCreateChatCompletionRequest' security: - ApiKeyAuth: [] - OAuth2Auth: - https://cognitiveservices.azure.com/.default components: schemas: - AzureChatCompletionResponseMessage: - type: object - properties: - context: - allOf: - - $ref: '#/components/schemas/AzureChatMessageContext' - description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - description: |- - The extended response model component for chat completion response messages on the Azure OpenAI service. - This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other - information related to retrieval-augmented generation performed. AzureChatCompletionStreamResponseDelta: type: object properties: + audio: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageAudioChunk' + description: Response audio associated with the streaming chat delta payload. + content: + type: string + nullable: true + description: The contents of the chunk message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. context: allOf: - $ref: '#/components/schemas/AzureChatMessageContext' description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamResponseDelta' description: |- The extended response model for a streaming chat response message on the Azure OpenAI service. This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other @@ -130,29 +156,12 @@ components: propertyName: type mapping: azure_search: '#/components/schemas/AzureSearchChatDataSource' - azure_ml_index: '#/components/schemas/AzureMachineLearningIndexChatDataSource' azure_cosmos_db: '#/components/schemas/AzureCosmosDBChatDataSource' - elasticsearch: '#/components/schemas/ElasticsearchChatDataSource' - pinecone: '#/components/schemas/PineconeChatDataSource' description: |- A representation of configuration data for a single Azure OpenAI chat data source. This will be used by a chat completions request that should use Azure OpenAI chat extensions to augment the response behavior. The use of this configuration is compatible only with Azure OpenAI. - AzureChatDataSourceAccessTokenAuthenticationOptions: - type: object - required: - - type - - access_token - properties: - type: - type: string - enum: - - access_token - access_token: - type: string - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' AzureChatDataSourceApiKeyAuthenticationOptions: type: object required: @@ -178,9 +187,6 @@ components: propertyName: type mapping: connection_string: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' - key_and_key_id: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' - encoded_api_key: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' - access_token: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' AzureChatDataSourceConnectionStringAuthenticationOptions: @@ -225,20 +231,6 @@ components: Represents a vectorization source that makes internal service calls against an Azure OpenAI embedding model deployment. In contrast with the endpoint-based vectorization source, a deployment-name-based vectorization source must be part of the same Azure OpenAI resource but can be used even in private networks. - AzureChatDataSourceEncodedApiKeyAuthenticationOptions: - type: object - required: - - type - - encoded_api_key - properties: - type: - type: string - enum: - - encoded_api_key - encoded_api_key: - type: string - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' AzureChatDataSourceEndpointVectorizationSource: type: object required: @@ -260,9 +252,8 @@ components: https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. The api-version query parameter is not allowed. authentication: - anyOf: + allOf: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: |- The authentication mechanism to use with the endpoint-based vectorization source. Endpoint authentication supports API key and access token mechanisms. @@ -275,42 +266,6 @@ components: allOf: - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' description: Represents a vectorization source that makes public service calls against an Azure OpenAI embedding model deployment. - AzureChatDataSourceKeyAndKeyIdAuthenticationOptions: - type: object - required: - - type - - key - - key_id - properties: - type: - type: string - enum: - - key_and_key_id - key: - type: string - key_id: - type: string - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' - AzureChatDataSourceModelIdVectorizationSource: - type: object - required: - - type - - model_id - properties: - type: - type: string - enum: - - model_id - description: The type identifier, always 'model_id' for this vectorization source type. - model_id: - type: string - description: The embedding model build ID to use for vectorization. - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' - description: |- - Represents a vectorization source that makes service calls based on a search service model ID. - This source type is currently only supported by Elasticsearch. AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions: type: object required: @@ -347,8 +302,8 @@ components: discriminator: propertyName: type mapping: + endpoint: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' deployment_name: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' - model_id: '#/components/schemas/AzureChatDataSourceModelIdVectorizationSource' description: A representation of a data vectorization source usable as an embedding resource with a data source. AzureChatMessageContext: type: object @@ -432,21 +387,6 @@ components: description: |- An additional property, added to chat completion response messages, produced by the Azure OpenAI service when using extension behavior. This includes intent and citation information from the On Your Data feature. - AzureContentFilterBlocklistIdResult: - type: object - required: - - id - - filtered - properties: - id: - type: string - description: The ID of the custom blocklist associated with the filtered status. - filtered: - type: boolean - description: Whether the associated blocklist resulted in the content being filtered. - description: |- - A content filter result item that associates an existing custom blocklist ID with a value indicating whether or not - the corresponding blocklist resulted in content being filtered. AzureContentFilterBlocklistResult: type: object required: @@ -835,142 +775,352 @@ components: description: Represents a data source configuration that will use an Azure CosmosDB resource. AzureCreateChatCompletionRequest: type: object + required: + - messages properties: - data_sources: - type: array - items: - $ref: '#/components/schemas/AzureChatDataSource' - description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionRequest' - description: |- - The extended request model for chat completions against the Azure OpenAI service. - This adds the ability to provide data sources for the On Your Data feature. - AzureCreateChatCompletionResponse: - type: object - properties: - prompt_filter_results: + messages: type: array items: - type: object - properties: - prompt_index: - type: integer - format: int32 - description: The index of the input prompt that this content filter result corresponds to. - content_filter_results: - allOf: - - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' - description: The content filter results associated with the indexed input prompt. - required: - - prompt_index - - content_filter_results - description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionResponse' - description: |- - The extended top-level chat completion response model for the Azure OpenAI service. - This model adds Responsible AI content filter annotations for prompt input. - AzureImage: - type: object - required: - - prompt_filter_results - - content_filter_results - properties: - prompt_filter_results: - $ref: '#/components/schemas/AzureContentFilterImagePromptResults' - content_filter_results: - $ref: '#/components/schemas/AzureContentFilterImageResponseResults' - allOf: - - $ref: '#/components/schemas/OpenAI.Image' - AzureMachineLearningIndexChatDataSource: - type: object - required: - - type - - parameters - properties: - type: - type: string - enum: - - azure_ml_index - description: The discriminated type identifier, which is always 'azure_ml_index'. - parameters: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + minItems: 1 + description: |- + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + frequency_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + default: 0 + logit_bias: type: object - properties: - top_n_documents: - type: integer - format: int32 - description: The configured number of documents to feature in the query. - in_scope: - type: boolean - description: Whether queries should be restricted to use of the indexed data. - strictness: - type: integer - format: int32 - minimum: 1 - maximum: 5 - description: |- - The configured strictness of the search relevance filtering. - Higher strictness will increase precision but lower recall of the answer. - role_information: - type: string - description: |- - Additional instructions for the model to inform how it should behave and any context it should reference when - generating a response. You can describe the assistant's personality and tell it how to format responses. - This is limited to 100 tokens and counts against the overall token limit. - max_search_queries: - type: integer - format: int32 - description: |- - The maximum number of rewritten queries that should be sent to the search provider for a single user message. - By default, the system will make an automatic determination. - allow_partial_result: - type: boolean - description: |- - If set to true, the system will allow partial search results to be used and the request will fail if all - partial queries fail. If not specified or specified as false, the request will fail if any search query fails. - default: false - include_contexts: - type: array - items: - type: string - enum: - - citations - - intent - - all_retrieved_documents - maxItems: 3 - description: |- - The output context properties to include on the response. - By default, citations and intent will be requested. - default: - - citations - - intent - authentication: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' - project_resource_id: - type: string - description: The ID of the Azure Machine Learning index project to use. - name: - type: string - description: The name of the Azure Machine Learning index to use. - version: - type: string - description: The version of the vector index to use. - filter: - type: string - description: A search filter, which is only applicable if the vector index is of the 'AzureSearch' type. + additionalProperties: + type: integer + format: int32 + nullable: true + description: |- + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + x-oaiTypeLabel: map + default: null + logprobs: + type: boolean + nullable: true + description: |- + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + default: false + top_logprobs: + type: integer + format: int32 + nullable: true + minimum: 0 + maximum: 20 + description: |- + An integer between 0 and 20 specifying the number of most likely tokens to + return at each token position, each with an associated log probability. + `logprobs` must be set to `true` if this parameter is used. + max_tokens: + type: integer + format: int32 + nullable: true + description: |- + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o1 series models](/docs/guides/reasoning). + deprecated: true + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 128 + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + default: 1 + presence_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + default: 0 + response_format: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + description: |- + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model + to produce JSON yourself via a system or user message. Without this, the + model may generate an unending stream of whitespace until the generation + reaches the token limit, resulting in a long-running and seemingly "stuck" + request. Also note that the message content may be partially cut off if + `finish_reason="length"`, which indicates the generation exceeded + `max_tokens` or the conversation exceeded the max context length. + x-oaiExpandable: true + seed: + type: integer + format: int64 + nullable: true + description: |- + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + anyOf: + - type: string + - type: array + items: + type: string + nullable: true + description: Up to 4 sequences where the API will stop generating further tokens. + default: null + stream: + type: boolean + nullable: true + description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' + default: false + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + default: 1 + tools: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTool' + description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + tool_choice: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionNamedToolChoice' + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + function_call: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' + description: |- + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + deprecated: true + x-oaiExpandable: true + functions: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' + minItems: 1 + maxItems: 128 + description: |- + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + deprecated: true + data_sources: + type: array + items: + $ref: '#/components/schemas/AzureChatDataSource' + description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. + description: |- + The extended request model for chat completions against the Azure OpenAI service. + This adds the ability to provide data sources for the On Your Data feature. + AzureCreateChatCompletionResponse: + type: object + required: + - id + - created + - model + - object + - choices + properties: + id: + type: string + description: A unique identifier for the chat completion. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + service_tier: + type: string + enum: + - scale + - default + nullable: true + description: The service tier used for processing the request. + system_fingerprint: + type: string + description: |- + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + enum: + - chat.completion + description: The object type, which is always `chat.completion`. + usage: + $ref: '#/components/schemas/OpenAI.CompletionUsage' + choices: + type: array + items: + $ref: '#/components/schemas/AzureCreateChatCompletionResponseChoice' + prompt_filter_results: + type: array + items: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt that this content filter result corresponds to. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter results associated with the indexed input prompt. + required: + - prompt_index + - content_filter_results + description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. + description: |- + The extended top-level chat completion response model for the Azure OpenAI service. + This model adds Responsible AI content filter annotations for prompt input. + AzureCreateChatCompletionResponseChoice: + type: object + required: + - finish_reason + - index + - message + - logprobs + - content_filter_results + properties: + finish_reason: + type: string + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + description: |- + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + index: + type: integer + format: int32 + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' + logprobs: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message content tokens with log probability information. + readOnly: true + refusal: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message refusal tokens with log probability information. + readOnly: true required: - - authentication - - project_resource_id - - name - - version - description: The parameter information to control the use of the Azure Machine Learning Index data source. + - content + - refusal + nullable: true + description: Log probability information for the choice. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForChoice' + description: The Responsible AI content filter annotations associated with the choice. + AzureImage: + type: object + required: + - prompt_filter_results + - content_filter_results + properties: + prompt_filter_results: + $ref: '#/components/schemas/AzureContentFilterImagePromptResults' + content_filter_results: + $ref: '#/components/schemas/AzureContentFilterImageResponseResults' allOf: - - $ref: '#/components/schemas/AzureChatDataSource' - description: Represents a data source configuration that will use an Azure Machine Learning vector index. + - $ref: '#/components/schemas/OpenAI.Image' AzureOpenAIChatError: type: object properties: @@ -1047,15 +1197,6 @@ components: error: $ref: '#/components/schemas/AzureOpenAIDalleError' description: A structured representation of an error an Azure OpenAI request. - AzureOpenAIServiceApiVersion: - type: string - enum: - - 2024-06-01 - - 2024-08-01-preview - - 2024-09-01-preview - - 2024-10-01-preview - - 2024-10-21 - description: Known service API versions for Azure OpenAI. AzureSearchChatDataSource: type: object required: @@ -1130,7 +1271,6 @@ components: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: The authentication mechanism to use with Azure Search. fields_mapping: type: object @@ -1179,9 +1319,8 @@ components: type: string description: A filter to apply to the search. embedding_dependency: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' description: |- The vectorization source to use with Azure Search. Supported sources for Azure Search include endpoint, deployment name, and integrated. @@ -1198,150 +1337,6 @@ components: items: $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' description: The tool calls generated by the model, such as function calls. - ChatCompletionTokenLogprobBytes: - type: array - items: - type: integer - format: int32 - CreateMessageRequestAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true - required: - - file_id - - tools - ElasticsearchChatDataSource: - type: object - required: - - type - - parameters - properties: - type: - type: string - enum: - - elasticsearch - description: The discriminated type identifier, which is always 'elasticsearch'. - parameters: - type: object - properties: - top_n_documents: - type: integer - format: int32 - description: The configured number of documents to feature in the query. - in_scope: - type: boolean - description: Whether queries should be restricted to use of the indexed data. - strictness: - type: integer - format: int32 - minimum: 1 - maximum: 5 - description: |- - The configured strictness of the search relevance filtering. - Higher strictness will increase precision but lower recall of the answer. - role_information: - type: string - description: |- - Additional instructions for the model to inform how it should behave and any context it should reference when - generating a response. You can describe the assistant's personality and tell it how to format responses. - This is limited to 100 tokens and counts against the overall token limit. - max_search_queries: - type: integer - format: int32 - description: |- - The maximum number of rewritten queries that should be sent to the search provider for a single user message. - By default, the system will make an automatic determination. - allow_partial_result: - type: boolean - description: |- - If set to true, the system will allow partial search results to be used and the request will fail if all - partial queries fail. If not specified or specified as false, the request will fail if any search query fails. - default: false - include_contexts: - type: array - items: - type: string - enum: - - citations - - intent - - all_retrieved_documents - maxItems: 3 - description: |- - The output context properties to include on the response. - By default, citations and intent will be requested. - default: - - citations - - intent - endpoint: - type: string - format: uri - index_name: - type: string - authentication: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' - fields_mapping: - type: object - properties: - title_field: - type: string - url_field: - type: string - filepath_field: - type: string - content_fields: - type: array - items: - type: string - content_fields_separator: - type: string - vector_fields: - type: array - items: - type: string - query_type: - type: string - enum: - - simple - - vector - embedding_dependency: - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' - required: - - endpoint - - index_name - - authentication - description: The parameter information to control the use of the Elasticsearch data source. - allOf: - - $ref: '#/components/schemas/AzureChatDataSource' - MessageObjectAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true OpenAI.AssistantToolDefinition: type: object required: @@ -1387,7 +1382,7 @@ components: description: |- The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. ranking_options: $ref: '#/components/schemas/OpenAI.FileSearchRankingOptions' description: Overrides for the file search tool. @@ -1437,10 +1432,26 @@ components: description: A description of what the function does, used by the model to choose when and how to call the function. name: type: string - description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' - deprecated: true + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + parameters: + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + deprecated: true + OpenAI.ChatCompletionMessageAudioChunk: + type: object + properties: + id: + type: string + transcript: + type: string + data: + type: string + format: base64 + expires_at: + type: integer + format: unixtime OpenAI.ChatCompletionMessageToolCall: type: object required: @@ -1520,12 +1531,7 @@ components: - role properties: content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessageContentPart' - nullable: true + type: string description: The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. x-oaiExpandable: true refusal: @@ -1540,6 +1546,19 @@ components: name: type: string description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + audio: + type: object + properties: + id: + type: string + description: Unique identifier for a previous audio response from the model. + required: + - id + nullable: true + description: |- + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + x-oaiExpandable: true tool_calls: $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' function_call: @@ -1557,11 +1576,7 @@ components: deprecated: true allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - OpenAI.ChatCompletionRequestAssistantMessageContentPart: - anyOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartRefusal' - x-oaiExpandable: true + description: Messages sent by the model in response to user messages. OpenAI.ChatCompletionRequestFunctionMessage: type: object required: @@ -1601,6 +1616,34 @@ components: tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' x-oaiExpandable: true + OpenAI.ChatCompletionRequestMessageContentPartAudio: + type: object + required: + - type + - input_audio + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + format: base64 + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + description: Learn about [audio inputs](/docs/guides/audio). OpenAI.ChatCompletionRequestMessageContentPartImage: type: object required: @@ -1625,24 +1668,11 @@ components: - auto - low - high - description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). default: auto required: - url - OpenAI.ChatCompletionRequestMessageContentPartRefusal: - type: object - required: - - type - - refusal - properties: - type: - type: string - enum: - - refusal - description: The type of the content part. - refusal: - type: string - description: The refusal message generated by the model. + description: Learn about [image inputs](/docs/guides/vision). OpenAI.ChatCompletionRequestMessageContentPartText: type: object required: @@ -1657,6 +1687,7 @@ components: text: type: string description: The text content. + description: Learn about [text inputs](/docs/guides/text-generation). OpenAI.ChatCompletionRequestSystemMessage: type: object required: @@ -1664,11 +1695,7 @@ components: - role properties: content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessageContentPart' + type: string description: The contents of the system message. role: type: string @@ -1680,11 +1707,10 @@ components: description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - OpenAI.ChatCompletionRequestSystemMessageContentPart: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - x-oaiExpandable: true + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. OpenAI.ChatCompletionRequestToolMessage: type: object required: @@ -1731,632 +1757,204 @@ components: role: type: string enum: - - user - description: The role of the messages author, in this case `user`. - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - OpenAI.ChatCompletionRequestUserMessageContentPart: - anyOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' - x-oaiExpandable: true - OpenAI.ChatCompletionResponseMessage: - type: object - required: - - content - - refusal - - role - properties: - content: - type: string - nullable: true - description: The contents of the message. - refusal: - type: string - nullable: true - description: The refusal message generated by the model. - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' - role: - type: string - enum: - - assistant - description: The role of the author of this message. - function_call: - type: object - properties: - name: - type: string - arguments: - type: string - required: - - name - - arguments - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - deprecated: true - description: A chat completion message generated by the model. - OpenAI.ChatCompletionStreamOptions: - type: object - properties: - include_usage: - type: boolean - description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' - description: 'Options for streaming response. Only set this when you set `stream: true`.' - OpenAI.ChatCompletionStreamResponseDelta: - type: object - properties: - content: - type: string - nullable: true - description: The contents of the chunk message. - function_call: - type: object - properties: - name: - type: string - arguments: - type: string - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - deprecated: true - tool_calls: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' - role: - type: string - enum: - - system - - user - - assistant - - tool - description: The role of the author of this message. - refusal: - type: string - nullable: true - description: The refusal message generated by the model. - description: A chat completion delta generated by streamed model responses. - OpenAI.ChatCompletionTokenLogprob: - type: object - required: - - token - - logprob - - bytes - - top_logprobs - properties: - token: - type: string - description: The token. - logprob: - type: number - format: float - description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - bytes: - type: object - allOf: - - $ref: '#/components/schemas/ChatCompletionTokenLogprobBytes' - nullable: true - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. - top_logprobs: - type: array - items: - type: object - properties: - token: - type: string - description: The token. - logprob: - type: number - format: float - description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - bytes: - type: array - items: - type: integer - format: int32 - nullable: true - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. - required: - - token - - logprob - - bytes - description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. - OpenAI.ChatCompletionTool: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - $ref: '#/components/schemas/OpenAI.FunctionObject' - OpenAI.ChatCompletionToolChoiceOption: - anyOf: - - type: string - enum: - - none - - auto - - required - - $ref: '#/components/schemas/OpenAI.ChatCompletionNamedToolChoice' - description: |- - Controls which (if any) tool is called by the model. - `none` means the model will not call any tool and instead generates a message. - `auto` means the model can pick between generating a message or calling one or more tools. - `required` means the model must call one or more tools. - Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. - - `none` is the default when no tools are present. `auto` is the default if tools are present. - x-oaiExpandable: true - OpenAI.ChatResponseFormat: - type: object - required: - - type - properties: - type: - type: string - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/OpenAI.ChatResponseFormatText' - json_object: '#/components/schemas/OpenAI.ChatResponseFormatJsonObject' - json_schema: '#/components/schemas/OpenAI.ChatResponseFormatJsonSchema' - OpenAI.ChatResponseFormatJsonObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - json_object - description: 'The type of response format being defined: `json_object`' - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - OpenAI.ChatResponseFormatJsonSchema: - type: object - required: - - type - - json_schema - properties: - type: - type: string - enum: - - json_schema - description: 'The type of response format being defined: `json_schema`' - json_schema: - type: object - properties: - description: - type: string - description: A description of what the response format is for, used by the model to determine how to respond in the format. - name: - type: string - description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - schema: - $ref: '#/components/schemas/OpenAI.ResponseFormatJsonSchemaSchema' - strict: - type: boolean - nullable: true - description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](/docs/guides/structured-outputs). - default: false - required: - - name - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - OpenAI.ChatResponseFormatText: - type: object - required: - - type - properties: - type: - type: string - enum: - - text - description: 'The type of response format being defined: `text`' + - user + description: The role of the messages author, in this case `user`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - OpenAI.CompletionUsage: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Messages sent by an end user, containing prompts or additional context + information. + OpenAI.ChatCompletionRequestUserMessageContentPart: + anyOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartAudio' + x-oaiExpandable: true + OpenAI.ChatCompletionResponseMessage: type: object required: - - completion_tokens - - prompt_tokens - - total_tokens + - content + - refusal + - role properties: - completion_tokens: - type: integer - format: int32 - description: Number of tokens in the generated completion. - prompt_tokens: - type: integer - format: int32 - description: Number of tokens in the prompt. - total_tokens: - type: integer - format: int32 - description: Total number of tokens used in the request (prompt + completion). - completion_tokens_details: + content: + type: string + nullable: true + description: The contents of the message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' + role: + type: string + enum: + - assistant + description: The role of the author of this message. + function_call: type: object properties: - audio_tokens: - type: integer - format: int32 - description: Audio input tokens generated by the model. - reasoning_tokens: - type: integer - format: int32 - description: Tokens generated by the model for reasoning. + name: + type: string + arguments: + type: string required: - - audio_tokens - - reasoning_tokens - description: Breakdown of tokens used in a completion. - prompt_tokens_details: + - name + - arguments + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + audio: type: object properties: - audio_tokens: - type: integer - format: int32 - description: Audio input tokens present in the prompt. - cached_tokens: + id: + type: string + description: Unique identifier for this audio response. + expires_at: type: integer - format: int32 - description: Cached tokens present in the prompt. + format: unixtime + description: |- + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + format: base64 + description: |- + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. required: - - audio_tokens - - cached_tokens - description: Breakdown of tokens used in the prompt. - description: Usage statistics for the completion request. - OpenAI.CreateChatCompletionRequest: - type: object - required: - - messages - - model - properties: - messages: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - minItems: 1 - description: A list of messages comprising the conversation so far. Depending on the [model](/docs/models) you use, different message types (modalities) are supported, like [text](/docs/guides/text-generation), [images](/docs/guides/vision), and audio. - model: - anyOf: - - type: string - - type: string - enum: - - o1-preview - - o1-preview-2024-09-12 - - o1-mini - - o1-mini-2024-09-12 - - gpt-4o - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - chatgpt-4o-latest - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0301 - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - description: ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. - x-oaiTypeLabel: string - store: - type: boolean - nullable: true - description: |- - Whether or not to store the output of this chat completion request - for use in our [model distillation](/docs/guides/distillation) or [evals](/docs/guides/evals) products. - default: false - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: |- - Developer-defined tags and values used for filtering completions - in the [dashboard](https://platform.openai.com/chat-completions). - frequency_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - logit_bias: - type: object - additionalProperties: - type: integer - format: int32 - nullable: true - description: |- - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - x-oaiTypeLabel: map - default: null - logprobs: - type: boolean - nullable: true - description: Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. - default: false - top_logprobs: - type: integer - format: int32 - nullable: true - minimum: 0 - maximum: 20 - description: An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. - max_tokens: - type: integer - format: int32 - nullable: true - description: |- - The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API. - - This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with [o1 series models](/docs/guides/reasoning). - deprecated: true - max_completion_tokens: - type: integer - format: int32 - nullable: true - description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). - n: - type: integer - format: int32 - nullable: true - minimum: 1 - maximum: 128 - description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. - default: 1 - presence_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - response_format: - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - description: |- - An object specifying the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. - x-oaiExpandable: true - seed: - type: integer - format: int64 - nullable: true - minimum: -9223372036854776000 - maximum: 9223372036854776000 - description: |- - This feature is in Beta. - If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. - Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - service_tier: - type: string - enum: - - auto - - default - nullable: true - description: |- - Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. - - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - When not set, the default behavior is 'auto'. - - When this parameter is set, the response body will include the `service_tier` utilized. - default: auto - stop: - anyOf: - - type: string - - type: array - items: - type: string - nullable: true - description: Up to 4 sequences where the API will stop generating further tokens. - default: null - stream: - type: boolean - nullable: true - description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' - default: false - stream_options: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' - nullable: true - default: null - temperature: - type: number - format: float - nullable: true - minimum: 0 - maximum: 2 - description: |- - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - - We generally recommend altering this or `top_p` but not both. - default: 1 - top_p: - type: number - format: float + - id + - expires_at + - data + - transcript nullable: true - minimum: 0 - maximum: 1 - description: |- - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or `temperature` but not both. - default: 1 - tools: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTool' - description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. - tool_choice: - $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' - parallel_tool_calls: - type: boolean - default: true - user: - type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - function_call: - anyOf: - - type: string - enum: - - none - - auto - - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' description: |- - Deprecated in favor of `tool_choice`. - - Controls which (if any) function is called by the model. - `none` means the model will not call a function and instead generates a message. - `auto` means the model can pick between generating a message or calling a function. - Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - - `none` is the default when no functions are present. `auto` is the default if functions are present. - deprecated: true + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). x-oaiExpandable: true - functions: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' - minItems: 1 - maxItems: 128 - description: |- - Deprecated in favor of `tools`. - - A list of functions the model may generate JSON inputs for. - deprecated: true - OpenAI.CreateChatCompletionResponse: - type: object - required: - - id - - choices - - created - - model - - object + description: A chat completion message generated by the model. + OpenAI.ChatCompletionTokenLogprob: + type: object + required: + - token + - logprob + - bytes + - top_logprobs properties: - id: + token: type: string - description: A unique identifier for the chat completion. - choices: + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 + nullable: true + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + top_logprobs: type: array items: type: object properties: - finish_reason: + token: type: string - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - description: |- - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - `content_filter` if content was omitted due to a flag from our content filters, - `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. - index: - type: integer - format: int32 - description: The index of the choice in the list of choices. - message: - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - logprobs: - type: object - properties: - content: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message content tokens with log probability information. - readOnly: true - refusal: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message refusal tokens with log probability information. - readOnly: true - required: - - content - - refusal + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 nullable: true - description: Log probability information for the choice. + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. required: - - finish_reason - - index - - message - - logprobs - description: A list of chat completion choices. Can be more than one if `n` is greater than 1. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the chat completion was created. - model: - type: string - description: The model used for the chat completion. - service_tier: + - token + - logprob + - bytes + description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. + OpenAI.ChatCompletionTool: + type: object + required: + - type + - function + properties: + type: type: string enum: - - scale - - default - nullable: true - description: The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request. - system_fingerprint: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: '#/components/schemas/OpenAI.FunctionObject' + OpenAI.ChatResponseFormat: + type: object + required: + - type + properties: + type: type: string - description: |- - This fingerprint represents the backend configuration that the model runs with. - - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - object: + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/OpenAI.ChatResponseFormatText' + json_object: '#/components/schemas/OpenAI.ChatResponseFormatJsonObject' + OpenAI.ChatResponseFormatJsonObject: + type: object + required: + - type + properties: + type: type: string enum: - - chat.completion - description: The object type, which is always `chat.completion`. - usage: - $ref: '#/components/schemas/OpenAI.CompletionUsage' - description: Represents a chat completion response returned by model, based on the provided input. + - json_object + description: 'The type of response format being defined: `json_object`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.ChatResponseFormatText: + type: object + required: + - type + properties: + type: + type: string + enum: + - text + description: 'The type of response format being defined: `text`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.CompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int32 + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + format: int32 + description: Number of tokens in the prompt. + total_tokens: + type: integer + format: int32 + description: Total number of tokens used in the request (prompt + completion). + description: Usage statistics for the completion request. OpenAI.CreateImageRequest: type: object required: @@ -2420,7 +2018,7 @@ components: default: vivid user: type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). OpenAI.CreateMessageRequest: type: object required: @@ -2442,17 +2040,37 @@ components: $ref: '#/components/schemas/OpenAI.MessageContent' x-oaiExpandable: true attachments: - type: object - allOf: - - $ref: '#/components/schemas/CreateMessageRequestAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + required: + - file_id + - tools nullable: true description: A list of files attached to the message, and the tools they should be added to. metadata: type: object additionalProperties: type: string - nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map OpenAI.Error: type: object @@ -2499,7 +2117,7 @@ components: description: |- The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. OpenAI.FunctionObject: type: object required: @@ -2512,19 +2130,15 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. strict: type: boolean nullable: true description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). default: false - OpenAI.FunctionParameters: - type: object - additionalProperties: {} - description: |- - The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. OpenAI.Image: type: object properties: @@ -2834,9 +2448,21 @@ components: nullable: true description: The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. attachments: - type: object - allOf: - - $ref: '#/components/schemas/MessageObjectAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true nullable: true description: A list of files attached to the message, and the tools they were added to. metadata: @@ -2844,7 +2470,13 @@ components: additionalProperties: type: string nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map readOnly: true description: Represents a message within a [thread](/docs/api-reference/threads). @@ -2865,119 +2497,6 @@ components: allOf: - $ref: '#/components/schemas/OpenAI.MessageContent' description: The text content that is part of a message. - OpenAI.ResponseFormatJsonSchemaSchema: - type: object - additionalProperties: {} - description: The schema for the response format, described as a JSON Schema object. - PineconeChatDataSource: - type: object - required: - - type - - parameters - properties: - type: - type: string - enum: - - pinecone - description: The discriminated type identifier, which is always 'pinecone'. - parameters: - type: object - properties: - top_n_documents: - type: integer - format: int32 - description: The configured number of documents to feature in the query. - in_scope: - type: boolean - description: Whether queries should be restricted to use of the indexed data. - strictness: - type: integer - format: int32 - minimum: 1 - maximum: 5 - description: |- - The configured strictness of the search relevance filtering. - Higher strictness will increase precision but lower recall of the answer. - role_information: - type: string - description: |- - Additional instructions for the model to inform how it should behave and any context it should reference when - generating a response. You can describe the assistant's personality and tell it how to format responses. - This is limited to 100 tokens and counts against the overall token limit. - max_search_queries: - type: integer - format: int32 - description: |- - The maximum number of rewritten queries that should be sent to the search provider for a single user message. - By default, the system will make an automatic determination. - allow_partial_result: - type: boolean - description: |- - If set to true, the system will allow partial search results to be used and the request will fail if all - partial queries fail. If not specified or specified as false, the request will fail if any search query fails. - default: false - include_contexts: - type: array - items: - type: string - enum: - - citations - - intent - - all_retrieved_documents - maxItems: 3 - description: |- - The output context properties to include on the response. - By default, citations and intent will be requested. - default: - - citations - - intent - environment: - type: string - description: The environment name to use with Pinecone. - index_name: - type: string - description: The name of the Pinecone database index to use. - authentication: - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - description: |- - The authentication mechanism to use with Pinecone. - Supported authentication mechanisms for Pinecone include: API key. - embedding_dependency: - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' - description: |- - The vectorization source to use as an embedding dependency for the Pinecone data source. - Supported vectorization sources for Pinecone include: deployment name. - fields_mapping: - type: object - properties: - content_fields: - type: array - items: - type: string - title_field: - type: string - url_field: - type: string - filepath_field: - type: string - content_fields_separator: - type: string - required: - - content_fields - description: |- - Field mappings to apply to data used by the Pinecone data source. - Note that content field mappings are required for Pinecone. - required: - - environment - - index_name - - authentication - - embedding_dependency - - fields_mapping - description: The parameter information to control the use of the Pinecone data source. - allOf: - - $ref: '#/components/schemas/AzureChatDataSource' securitySchemes: ApiKeyAuth: type: apiKey diff --git a/.openapi3.azure/openapi3-azure-openai-2024-08-01-preview-generated.yaml b/.openapi3.azure/openapi3-azure-openai-2024-08-01-preview-generated.yaml index 2066a2ca9..72257dc32 100644 --- a/.openapi3.azure/openapi3-azure-openai-2024-08-01-preview-generated.yaml +++ b/.openapi3.azure/openapi3-azure-openai-2024-08-01-preview-generated.yaml @@ -7,27 +7,6 @@ tags: - name: Images - name: Assistants paths: - /chat/completions: - post: - operationId: createChatCompletion - parameters: [] - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' - - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' - tags: - - Chat - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AzureCreateChatCompletionRequest' /deployments/{deploymentId}/images/generations: post: operationId: ImageGenerations_Create @@ -86,34 +65,81 @@ paths: application/json: schema: $ref: '#/components/schemas/OpenAI.CreateMessageRequest' + /{deployment_id}/chat/completions: + post: + operationId: createChatCompletion + parameters: + - name: deployment_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' + - type: array + items: + $ref: '#/components/schemas/AzureChatCompletionStreamResponseDelta' + - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' + tags: + - Chat + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AzureCreateChatCompletionRequest' security: - ApiKeyAuth: [] - OAuth2Auth: - https://cognitiveservices.azure.com/.default components: schemas: - AzureChatCompletionResponseMessage: - type: object - properties: - context: - allOf: - - $ref: '#/components/schemas/AzureChatMessageContext' - description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - description: |- - The extended response model component for chat completion response messages on the Azure OpenAI service. - This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other - information related to retrieval-augmented generation performed. AzureChatCompletionStreamResponseDelta: type: object properties: + audio: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageAudioChunk' + description: Response audio associated with the streaming chat delta payload. + content: + type: string + nullable: true + description: The contents of the chunk message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. context: allOf: - $ref: '#/components/schemas/AzureChatMessageContext' description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamResponseDelta' description: |- The extended response model for a streaming chat response message on the Azure OpenAI service. This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other @@ -177,13 +203,13 @@ components: discriminator: propertyName: type mapping: - username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' connection_string: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' + system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' + user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' key_and_key_id: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' encoded_api_key: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' access_token: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' - system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' + username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' AzureChatDataSourceConnectionStringAuthenticationOptions: type: object required: @@ -261,9 +287,8 @@ components: https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. The api-version query parameter is not allowed. authentication: - anyOf: + allOf: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: |- The authentication mechanism to use with the endpoint-based vectorization source. Endpoint authentication supports API key and access token mechanisms. @@ -378,6 +403,7 @@ components: discriminator: propertyName: type mapping: + endpoint: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' deployment_name: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' model_id: '#/components/schemas/AzureChatDataSourceModelIdVectorizationSource' integrated: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' @@ -464,21 +490,6 @@ components: description: |- An additional property, added to chat completion response messages, produced by the Azure OpenAI service when using extension behavior. This includes intent and citation information from the On Your Data feature. - AzureContentFilterBlocklistIdResult: - type: object - required: - - id - - filtered - properties: - id: - type: string - description: The ID of the custom blocklist associated with the filtered status. - filtered: - type: boolean - description: Whether the associated blocklist resulted in the content being filtered. - description: |- - A content filter result item that associates an existing custom blocklist ID with a value indicating whether or not - the corresponding blocklist resulted in content being filtered. AzureContentFilterBlocklistResult: type: object required: @@ -861,22 +872,263 @@ components: description: Represents a data source configuration that will use an Azure CosmosDB resource. AzureCreateChatCompletionRequest: type: object + required: + - messages properties: + messages: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + minItems: 1 + description: |- + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + frequency_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + default: 0 + logit_bias: + type: object + additionalProperties: + type: integer + format: int32 + nullable: true + description: |- + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + x-oaiTypeLabel: map + default: null + logprobs: + type: boolean + nullable: true + description: |- + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + default: false + top_logprobs: + type: integer + format: int32 + nullable: true + minimum: 0 + maximum: 20 + description: |- + An integer between 0 and 20 specifying the number of most likely tokens to + return at each token position, each with an associated log probability. + `logprobs` must be set to `true` if this parameter is used. + max_tokens: + type: integer + format: int32 + nullable: true + description: |- + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o1 series models](/docs/guides/reasoning). + deprecated: true + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 128 + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + default: 1 + presence_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + default: 0 + response_format: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + description: |- + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model + to produce JSON yourself via a system or user message. Without this, the + model may generate an unending stream of whitespace until the generation + reaches the token limit, resulting in a long-running and seemingly "stuck" + request. Also note that the message content may be partially cut off if + `finish_reason="length"`, which indicates the generation exceeded + `max_tokens` or the conversation exceeded the max context length. + x-oaiExpandable: true + seed: + type: integer + format: int64 + nullable: true + description: |- + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + anyOf: + - type: string + - type: array + items: + type: string + nullable: true + description: Up to 4 sequences where the API will stop generating further tokens. + default: null + stream: + type: boolean + nullable: true + description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' + default: false + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + default: 1 + tools: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTool' + description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + tool_choice: + $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + function_call: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' + description: |- + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + deprecated: true + x-oaiExpandable: true + functions: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' + minItems: 1 + maxItems: 128 + description: |- + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + deprecated: true data_sources: type: array items: $ref: '#/components/schemas/AzureChatDataSource' description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionRequest' description: |- The extended request model for chat completions against the Azure OpenAI service. This adds the ability to provide data sources for the On Your Data feature. AzureCreateChatCompletionResponse: type: object - properties: - prompt_filter_results: - type: array + required: + - id + - created + - model + - object + - choices + properties: + id: + type: string + description: A unique identifier for the chat completion. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + service_tier: + type: string + enum: + - scale + - default + nullable: true + description: The service tier used for processing the request. + system_fingerprint: + type: string + description: |- + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + enum: + - chat.completion + description: The object type, which is always `chat.completion`. + usage: + $ref: '#/components/schemas/OpenAI.CompletionUsage' + choices: + type: array + items: + $ref: '#/components/schemas/AzureCreateChatCompletionResponseChoice' + prompt_filter_results: + type: array items: type: object properties: @@ -892,11 +1144,63 @@ components: - prompt_index - content_filter_results description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionResponse' description: |- The extended top-level chat completion response model for the Azure OpenAI service. This model adds Responsible AI content filter annotations for prompt input. + AzureCreateChatCompletionResponseChoice: + type: object + required: + - finish_reason + - index + - message + - logprobs + - content_filter_results + properties: + finish_reason: + type: string + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + description: |- + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + index: + type: integer + format: int32 + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' + logprobs: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message content tokens with log probability information. + readOnly: true + refusal: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message refusal tokens with log probability information. + readOnly: true + required: + - content + - refusal + nullable: true + description: Log probability information for the choice. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForChoice' + description: The Responsible AI content filter annotations associated with the choice. AzureImage: type: object required: @@ -985,15 +1289,6 @@ components: error: $ref: '#/components/schemas/AzureOpenAIDalleError' description: A structured representation of an error an Azure OpenAI request. - AzureOpenAIServiceApiVersion: - type: string - enum: - - 2024-06-01 - - 2024-08-01-preview - - 2024-09-01-preview - - 2024-10-01-preview - - 2024-10-21 - description: Known service API versions for Azure OpenAI. AzureSearchChatDataSource: type: object required: @@ -1062,7 +1357,6 @@ components: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: The authentication mechanism to use with Azure Search. fields_mapping: type: object @@ -1111,10 +1405,8 @@ components: type: string description: A filter to apply to the search. embedding_dependency: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' description: |- The vectorization source to use with Azure Search. Supported sources for Azure Search include endpoint, deployment name, and integrated. @@ -1131,30 +1423,6 @@ components: items: $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' description: The tool calls generated by the model, such as function calls. - ChatCompletionTokenLogprobBytes: - type: array - items: - type: integer - format: int32 - CreateMessageRequestAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true - required: - - file_id - - tools ElasticsearchChatDataSource: type: object required: @@ -1253,22 +1521,6 @@ components: description: The parameter information to control the use of the Elasticsearch data source. allOf: - $ref: '#/components/schemas/AzureChatDataSource' - MessageObjectAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true MongoDBChatDataSource: type: object required: @@ -1435,7 +1687,7 @@ components: description: |- The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. ranking_options: $ref: '#/components/schemas/OpenAI.FileSearchRankingOptions' description: Overrides for the file search tool. @@ -1487,8 +1739,24 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. deprecated: true + OpenAI.ChatCompletionMessageAudioChunk: + type: object + properties: + id: + type: string + transcript: + type: string + data: + type: string + format: base64 + expires_at: + type: integer + format: unixtime OpenAI.ChatCompletionMessageToolCall: type: object required: @@ -1588,6 +1856,19 @@ components: name: type: string description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + audio: + type: object + properties: + id: + type: string + description: Unique identifier for a previous audio response from the model. + required: + - id + nullable: true + description: |- + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + x-oaiExpandable: true tool_calls: $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' function_call: @@ -1605,6 +1886,7 @@ components: deprecated: true allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: Messages sent by the model in response to user messages. OpenAI.ChatCompletionRequestAssistantMessageContentPart: anyOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' @@ -1649,6 +1931,34 @@ components: tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' x-oaiExpandable: true + OpenAI.ChatCompletionRequestMessageContentPartAudio: + type: object + required: + - type + - input_audio + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + format: base64 + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + description: Learn about [audio inputs](/docs/guides/audio). OpenAI.ChatCompletionRequestMessageContentPartImage: type: object required: @@ -1673,10 +1983,11 @@ components: - auto - low - high - description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). default: auto required: - url + description: Learn about [image inputs](/docs/guides/vision). OpenAI.ChatCompletionRequestMessageContentPartRefusal: type: object required: @@ -1705,6 +2016,7 @@ components: text: type: string description: The text content. + description: Learn about [text inputs](/docs/guides/text-generation). OpenAI.ChatCompletionRequestSystemMessage: type: object required: @@ -1728,6 +2040,10 @@ components: description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. OpenAI.ChatCompletionRequestSystemMessageContentPart: type: object allOf: @@ -1786,10 +2102,14 @@ components: description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Messages sent by an end user, containing prompts or additional context + information. OpenAI.ChatCompletionRequestUserMessageContentPart: anyOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartAudio' x-oaiExpandable: true OpenAI.ChatCompletionResponseMessage: type: object @@ -1825,47 +2145,39 @@ components: - arguments description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. deprecated: true - description: A chat completion message generated by the model. - OpenAI.ChatCompletionStreamOptions: - type: object - properties: - include_usage: - type: boolean - description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' - description: 'Options for streaming response. Only set this when you set `stream: true`.' - OpenAI.ChatCompletionStreamResponseDelta: - type: object - properties: - content: - type: string - nullable: true - description: The contents of the chunk message. - function_call: + audio: type: object properties: - name: + id: type: string - arguments: + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: |- + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: type: string - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - deprecated: true - tool_calls: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' - role: - type: string - enum: - - system - - user - - assistant - - tool - description: The role of the author of this message. - refusal: - type: string + format: base64 + description: |- + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + required: + - id + - expires_at + - data + - transcript nullable: true - description: The refusal message generated by the model. - description: A chat completion delta generated by streamed model responses. + description: |- + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). + x-oaiExpandable: true + description: A chat completion message generated by the model. OpenAI.ChatCompletionTokenLogprob: type: object required: @@ -1882,9 +2194,10 @@ components: format: float description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. bytes: - type: object - allOf: - - $ref: '#/components/schemas/ChatCompletionTokenLogprobBytes' + type: array + items: + type: integer + format: int32 nullable: true description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. top_logprobs: @@ -2028,383 +2341,7 @@ components: type: integer format: int32 description: Total number of tokens used in the request (prompt + completion). - completion_tokens_details: - type: object - properties: - audio_tokens: - type: integer - format: int32 - description: Audio input tokens generated by the model. - reasoning_tokens: - type: integer - format: int32 - description: Tokens generated by the model for reasoning. - required: - - audio_tokens - - reasoning_tokens - description: Breakdown of tokens used in a completion. - prompt_tokens_details: - type: object - properties: - audio_tokens: - type: integer - format: int32 - description: Audio input tokens present in the prompt. - cached_tokens: - type: integer - format: int32 - description: Cached tokens present in the prompt. - required: - - audio_tokens - - cached_tokens - description: Breakdown of tokens used in the prompt. description: Usage statistics for the completion request. - OpenAI.CreateChatCompletionRequest: - type: object - required: - - messages - - model - properties: - messages: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - minItems: 1 - description: A list of messages comprising the conversation so far. Depending on the [model](/docs/models) you use, different message types (modalities) are supported, like [text](/docs/guides/text-generation), [images](/docs/guides/vision), and audio. - model: - anyOf: - - type: string - - type: string - enum: - - o1-preview - - o1-preview-2024-09-12 - - o1-mini - - o1-mini-2024-09-12 - - gpt-4o - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - chatgpt-4o-latest - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0301 - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - description: ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. - x-oaiTypeLabel: string - store: - type: boolean - nullable: true - description: |- - Whether or not to store the output of this chat completion request - for use in our [model distillation](/docs/guides/distillation) or [evals](/docs/guides/evals) products. - default: false - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: |- - Developer-defined tags and values used for filtering completions - in the [dashboard](https://platform.openai.com/chat-completions). - frequency_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - logit_bias: - type: object - additionalProperties: - type: integer - format: int32 - nullable: true - description: |- - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - x-oaiTypeLabel: map - default: null - logprobs: - type: boolean - nullable: true - description: Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. - default: false - top_logprobs: - type: integer - format: int32 - nullable: true - minimum: 0 - maximum: 20 - description: An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. - max_tokens: - type: integer - format: int32 - nullable: true - description: |- - The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API. - - This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with [o1 series models](/docs/guides/reasoning). - deprecated: true - max_completion_tokens: - type: integer - format: int32 - nullable: true - description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). - n: - type: integer - format: int32 - nullable: true - minimum: 1 - maximum: 128 - description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. - default: 1 - presence_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - response_format: - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - description: |- - An object specifying the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. - x-oaiExpandable: true - seed: - type: integer - format: int64 - nullable: true - minimum: -9223372036854776000 - maximum: 9223372036854776000 - description: |- - This feature is in Beta. - If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. - Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - service_tier: - type: string - enum: - - auto - - default - nullable: true - description: |- - Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. - - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - When not set, the default behavior is 'auto'. - - When this parameter is set, the response body will include the `service_tier` utilized. - default: auto - stop: - anyOf: - - type: string - - type: array - items: - type: string - nullable: true - description: Up to 4 sequences where the API will stop generating further tokens. - default: null - stream: - type: boolean - nullable: true - description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' - default: false - stream_options: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' - nullable: true - default: null - temperature: - type: number - format: float - nullable: true - minimum: 0 - maximum: 2 - description: |- - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - - We generally recommend altering this or `top_p` but not both. - default: 1 - top_p: - type: number - format: float - nullable: true - minimum: 0 - maximum: 1 - description: |- - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or `temperature` but not both. - default: 1 - tools: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTool' - description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. - tool_choice: - $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' - parallel_tool_calls: - type: boolean - default: true - user: - type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - function_call: - anyOf: - - type: string - enum: - - none - - auto - - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' - description: |- - Deprecated in favor of `tool_choice`. - - Controls which (if any) function is called by the model. - `none` means the model will not call a function and instead generates a message. - `auto` means the model can pick between generating a message or calling a function. - Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - - `none` is the default when no functions are present. `auto` is the default if functions are present. - deprecated: true - x-oaiExpandable: true - functions: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' - minItems: 1 - maxItems: 128 - description: |- - Deprecated in favor of `tools`. - - A list of functions the model may generate JSON inputs for. - deprecated: true - OpenAI.CreateChatCompletionResponse: - type: object - required: - - id - - choices - - created - - model - - object - properties: - id: - type: string - description: A unique identifier for the chat completion. - choices: - type: array - items: - type: object - properties: - finish_reason: - type: string - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - description: |- - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - `content_filter` if content was omitted due to a flag from our content filters, - `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. - index: - type: integer - format: int32 - description: The index of the choice in the list of choices. - message: - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - logprobs: - type: object - properties: - content: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message content tokens with log probability information. - readOnly: true - refusal: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message refusal tokens with log probability information. - readOnly: true - required: - - content - - refusal - nullable: true - description: Log probability information for the choice. - required: - - finish_reason - - index - - message - - logprobs - description: A list of chat completion choices. Can be more than one if `n` is greater than 1. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the chat completion was created. - model: - type: string - description: The model used for the chat completion. - service_tier: - type: string - enum: - - scale - - default - nullable: true - description: The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request. - system_fingerprint: - type: string - description: |- - This fingerprint represents the backend configuration that the model runs with. - - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - object: - type: string - enum: - - chat.completion - description: The object type, which is always `chat.completion`. - usage: - $ref: '#/components/schemas/OpenAI.CompletionUsage' - description: Represents a chat completion response returned by model, based on the provided input. OpenAI.CreateImageRequest: type: object required: @@ -2468,7 +2405,7 @@ components: default: vivid user: type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). OpenAI.CreateMessageRequest: type: object required: @@ -2490,17 +2427,37 @@ components: $ref: '#/components/schemas/OpenAI.MessageContent' x-oaiExpandable: true attachments: - type: object - allOf: - - $ref: '#/components/schemas/CreateMessageRequestAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + required: + - file_id + - tools nullable: true description: A list of files attached to the message, and the tools they should be added to. metadata: type: object additionalProperties: type: string - nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map OpenAI.Error: type: object @@ -2547,7 +2504,7 @@ components: description: |- The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. OpenAI.FunctionObject: type: object required: @@ -2560,19 +2517,15 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. strict: type: boolean nullable: true description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). default: false - OpenAI.FunctionParameters: - type: object - additionalProperties: {} - description: |- - The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. OpenAI.Image: type: object properties: @@ -2882,9 +2835,21 @@ components: nullable: true description: The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. attachments: - type: object - allOf: - - $ref: '#/components/schemas/MessageObjectAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true nullable: true description: A list of files attached to the message, and the tools they were added to. metadata: @@ -2892,7 +2857,13 @@ components: additionalProperties: type: string nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map readOnly: true description: Represents a message within a [thread](/docs/api-reference/threads). diff --git a/.openapi3.azure/openapi3-azure-openai-2024-09-01-preview-generated.yaml b/.openapi3.azure/openapi3-azure-openai-2024-09-01-preview-generated.yaml index 335eec92a..436eb816c 100644 --- a/.openapi3.azure/openapi3-azure-openai-2024-09-01-preview-generated.yaml +++ b/.openapi3.azure/openapi3-azure-openai-2024-09-01-preview-generated.yaml @@ -7,27 +7,6 @@ tags: - name: Images - name: Assistants paths: - /chat/completions: - post: - operationId: createChatCompletion - parameters: [] - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' - - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' - tags: - - Chat - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AzureCreateChatCompletionRequest' /deployments/{deploymentId}/images/generations: post: operationId: ImageGenerations_Create @@ -86,34 +65,81 @@ paths: application/json: schema: $ref: '#/components/schemas/OpenAI.CreateMessageRequest' + /{deployment_id}/chat/completions: + post: + operationId: createChatCompletion + parameters: + - name: deployment_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' + - type: array + items: + $ref: '#/components/schemas/AzureChatCompletionStreamResponseDelta' + - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' + tags: + - Chat + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AzureCreateChatCompletionRequest' security: - ApiKeyAuth: [] - OAuth2Auth: - https://cognitiveservices.azure.com/.default components: schemas: - AzureChatCompletionResponseMessage: - type: object - properties: - context: - allOf: - - $ref: '#/components/schemas/AzureChatMessageContext' - description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - description: |- - The extended response model component for chat completion response messages on the Azure OpenAI service. - This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other - information related to retrieval-augmented generation performed. AzureChatCompletionStreamResponseDelta: type: object properties: + audio: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageAudioChunk' + description: Response audio associated with the streaming chat delta payload. + content: + type: string + nullable: true + description: The contents of the chunk message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. context: allOf: - $ref: '#/components/schemas/AzureChatMessageContext' description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamResponseDelta' description: |- The extended response model for a streaming chat response message on the Azure OpenAI service. This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other @@ -177,13 +203,13 @@ components: discriminator: propertyName: type mapping: - username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' connection_string: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' + system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' + user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' key_and_key_id: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' encoded_api_key: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' access_token: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' - system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' + username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' AzureChatDataSourceConnectionStringAuthenticationOptions: type: object required: @@ -261,9 +287,8 @@ components: https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. The api-version query parameter is not allowed. authentication: - anyOf: + allOf: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: |- The authentication mechanism to use with the endpoint-based vectorization source. Endpoint authentication supports API key and access token mechanisms. @@ -378,6 +403,7 @@ components: discriminator: propertyName: type mapping: + endpoint: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' deployment_name: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' model_id: '#/components/schemas/AzureChatDataSourceModelIdVectorizationSource' integrated: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' @@ -464,21 +490,6 @@ components: description: |- An additional property, added to chat completion response messages, produced by the Azure OpenAI service when using extension behavior. This includes intent and citation information from the On Your Data feature. - AzureContentFilterBlocklistIdResult: - type: object - required: - - id - - filtered - properties: - id: - type: string - description: The ID of the custom blocklist associated with the filtered status. - filtered: - type: boolean - description: Whether the associated blocklist resulted in the content being filtered. - description: |- - A content filter result item that associates an existing custom blocklist ID with a value indicating whether or not - the corresponding blocklist resulted in content being filtered. AzureContentFilterBlocklistResult: type: object required: @@ -861,44 +872,352 @@ components: description: Represents a data source configuration that will use an Azure CosmosDB resource. AzureCreateChatCompletionRequest: type: object + required: + - messages properties: - data_sources: + messages: type: array items: - $ref: '#/components/schemas/AzureChatDataSource' - description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionRequest' - description: |- - The extended request model for chat completions against the Azure OpenAI service. - This adds the ability to provide data sources for the On Your Data feature. - AzureCreateChatCompletionResponse: - type: object - properties: - prompt_filter_results: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + minItems: 1 + description: |- + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + frequency_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + default: 0 + logit_bias: + type: object + additionalProperties: + type: integer + format: int32 + nullable: true + description: |- + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + x-oaiTypeLabel: map + default: null + logprobs: + type: boolean + nullable: true + description: |- + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + default: false + top_logprobs: + type: integer + format: int32 + nullable: true + minimum: 0 + maximum: 20 + description: |- + An integer between 0 and 20 specifying the number of most likely tokens to + return at each token position, each with an associated log probability. + `logprobs` must be set to `true` if this parameter is used. + max_tokens: + type: integer + format: int32 + nullable: true + description: |- + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o1 series models](/docs/guides/reasoning). + deprecated: true + max_completion_tokens: + type: integer + format: int32 + nullable: true + description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 128 + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + default: 1 + presence_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + default: 0 + response_format: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + description: |- + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model + to produce JSON yourself via a system or user message. Without this, the + model may generate an unending stream of whitespace until the generation + reaches the token limit, resulting in a long-running and seemingly "stuck" + request. Also note that the message content may be partially cut off if + `finish_reason="length"`, which indicates the generation exceeded + `max_tokens` or the conversation exceeded the max context length. + x-oaiExpandable: true + seed: + type: integer + format: int64 + nullable: true + description: |- + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + anyOf: + - type: string + - type: array + items: + type: string + nullable: true + description: Up to 4 sequences where the API will stop generating further tokens. + default: null + stream: + type: boolean + nullable: true + description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' + default: false + stream_options: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' + nullable: true + default: null + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + default: 1 + tools: type: array items: - type: object - properties: - prompt_index: - type: integer - format: int32 - description: The index of the input prompt that this content filter result corresponds to. - content_filter_results: - allOf: - - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' - description: The content filter results associated with the indexed input prompt. - required: - - prompt_index - - content_filter_results - description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionResponse' - description: |- - The extended top-level chat completion response model for the Azure OpenAI service. - This model adds Responsible AI content filter annotations for prompt input. - AzureImage: - type: object + $ref: '#/components/schemas/OpenAI.ChatCompletionTool' + description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + tool_choice: + $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' + parallel_tool_calls: + allOf: + - $ref: '#/components/schemas/OpenAI.ParallelToolCalls' + default: true + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + function_call: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' + description: |- + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + deprecated: true + x-oaiExpandable: true + functions: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' + minItems: 1 + maxItems: 128 + description: |- + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + deprecated: true + data_sources: + type: array + items: + $ref: '#/components/schemas/AzureChatDataSource' + description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. + description: |- + The extended request model for chat completions against the Azure OpenAI service. + This adds the ability to provide data sources for the On Your Data feature. + AzureCreateChatCompletionResponse: + type: object + required: + - id + - created + - model + - object + - choices + properties: + id: + type: string + description: A unique identifier for the chat completion. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + service_tier: + type: string + enum: + - scale + - default + nullable: true + description: The service tier used for processing the request. + system_fingerprint: + type: string + description: |- + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + enum: + - chat.completion + description: The object type, which is always `chat.completion`. + usage: + $ref: '#/components/schemas/OpenAI.CompletionUsage' + choices: + type: array + items: + $ref: '#/components/schemas/AzureCreateChatCompletionResponseChoice' + prompt_filter_results: + type: array + items: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt that this content filter result corresponds to. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter results associated with the indexed input prompt. + required: + - prompt_index + - content_filter_results + description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. + description: |- + The extended top-level chat completion response model for the Azure OpenAI service. + This model adds Responsible AI content filter annotations for prompt input. + AzureCreateChatCompletionResponseChoice: + type: object + required: + - finish_reason + - index + - message + - logprobs + - content_filter_results + properties: + finish_reason: + type: string + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + description: |- + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + index: + type: integer + format: int32 + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' + logprobs: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message content tokens with log probability information. + readOnly: true + refusal: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message refusal tokens with log probability information. + readOnly: true + required: + - content + - refusal + nullable: true + description: Log probability information for the choice. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForChoice' + description: The Responsible AI content filter annotations associated with the choice. + AzureImage: + type: object required: - prompt_filter_results - content_filter_results @@ -985,15 +1304,6 @@ components: error: $ref: '#/components/schemas/AzureOpenAIDalleError' description: A structured representation of an error an Azure OpenAI request. - AzureOpenAIServiceApiVersion: - type: string - enum: - - 2024-06-01 - - 2024-08-01-preview - - 2024-09-01-preview - - 2024-10-01-preview - - 2024-10-21 - description: Known service API versions for Azure OpenAI. AzureSearchChatDataSource: type: object required: @@ -1062,7 +1372,6 @@ components: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: The authentication mechanism to use with Azure Search. fields_mapping: type: object @@ -1111,10 +1420,8 @@ components: type: string description: A filter to apply to the search. embedding_dependency: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' description: |- The vectorization source to use with Azure Search. Supported sources for Azure Search include endpoint, deployment name, and integrated. @@ -1131,30 +1438,6 @@ components: items: $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' description: The tool calls generated by the model, such as function calls. - ChatCompletionTokenLogprobBytes: - type: array - items: - type: integer - format: int32 - CreateMessageRequestAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true - required: - - file_id - - tools ElasticsearchChatDataSource: type: object required: @@ -1253,22 +1536,6 @@ components: description: The parameter information to control the use of the Elasticsearch data source. allOf: - $ref: '#/components/schemas/AzureChatDataSource' - MessageObjectAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true MongoDBChatDataSource: type: object required: @@ -1435,7 +1702,7 @@ components: description: |- The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. ranking_options: $ref: '#/components/schemas/OpenAI.FileSearchRankingOptions' description: Overrides for the file search tool. @@ -1487,8 +1754,24 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. deprecated: true + OpenAI.ChatCompletionMessageAudioChunk: + type: object + properties: + id: + type: string + transcript: + type: string + data: + type: string + format: base64 + expires_at: + type: integer + format: unixtime OpenAI.ChatCompletionMessageToolCall: type: object required: @@ -1588,6 +1871,19 @@ components: name: type: string description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + audio: + type: object + properties: + id: + type: string + description: Unique identifier for a previous audio response from the model. + required: + - id + nullable: true + description: |- + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + x-oaiExpandable: true tool_calls: $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' function_call: @@ -1605,6 +1901,7 @@ components: deprecated: true allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: Messages sent by the model in response to user messages. OpenAI.ChatCompletionRequestAssistantMessageContentPart: anyOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' @@ -1649,6 +1946,34 @@ components: tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' x-oaiExpandable: true + OpenAI.ChatCompletionRequestMessageContentPartAudio: + type: object + required: + - type + - input_audio + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + format: base64 + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + description: Learn about [audio inputs](/docs/guides/audio). OpenAI.ChatCompletionRequestMessageContentPartImage: type: object required: @@ -1673,10 +1998,11 @@ components: - auto - low - high - description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). default: auto required: - url + description: Learn about [image inputs](/docs/guides/vision). OpenAI.ChatCompletionRequestMessageContentPartRefusal: type: object required: @@ -1705,6 +2031,7 @@ components: text: type: string description: The text content. + description: Learn about [text inputs](/docs/guides/text-generation). OpenAI.ChatCompletionRequestSystemMessage: type: object required: @@ -1728,6 +2055,10 @@ components: description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. OpenAI.ChatCompletionRequestSystemMessageContentPart: type: object allOf: @@ -1786,10 +2117,14 @@ components: description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Messages sent by an end user, containing prompts or additional context + information. OpenAI.ChatCompletionRequestUserMessageContentPart: anyOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartAudio' x-oaiExpandable: true OpenAI.ChatCompletionResponseMessage: type: object @@ -1825,6 +2160,38 @@ components: - arguments description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. deprecated: true + audio: + type: object + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: |- + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + format: base64 + description: |- + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + required: + - id + - expires_at + - data + - transcript + nullable: true + description: |- + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). + x-oaiExpandable: true description: A chat completion message generated by the model. OpenAI.ChatCompletionStreamOptions: type: object @@ -1833,39 +2200,6 @@ components: type: boolean description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' description: 'Options for streaming response. Only set this when you set `stream: true`.' - OpenAI.ChatCompletionStreamResponseDelta: - type: object - properties: - content: - type: string - nullable: true - description: The contents of the chunk message. - function_call: - type: object - properties: - name: - type: string - arguments: - type: string - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - deprecated: true - tool_calls: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' - role: - type: string - enum: - - system - - user - - assistant - - tool - description: The role of the author of this message. - refusal: - type: string - nullable: true - description: The refusal message generated by the model. - description: A chat completion delta generated by streamed model responses. OpenAI.ChatCompletionTokenLogprob: type: object required: @@ -1882,9 +2216,10 @@ components: format: float description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. bytes: - type: object - allOf: - - $ref: '#/components/schemas/ChatCompletionTokenLogprobBytes' + type: array + items: + type: integer + format: int32 nullable: true description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. top_logprobs: @@ -2031,6 +2366,12 @@ components: completion_tokens_details: type: object properties: + accepted_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. audio_tokens: type: integer format: int32 @@ -2039,376 +2380,21 @@ components: type: integer format: int32 description: Tokens generated by the model for reasoning. - required: - - audio_tokens - - reasoning_tokens - description: Breakdown of tokens used in a completion. - prompt_tokens_details: - type: object - properties: - audio_tokens: - type: integer - format: int32 - description: Audio input tokens present in the prompt. - cached_tokens: + rejected_prediction_tokens: type: integer format: int32 - description: Cached tokens present in the prompt. - required: - - audio_tokens - - cached_tokens - description: Breakdown of tokens used in the prompt. + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that did not appear in the completion. However, like + reasoning tokens, these tokens are still counted in the total + completion tokens for purposes of billing, output, and context window + limits. + description: Breakdown of tokens used in a completion. description: Usage statistics for the completion request. - OpenAI.CreateChatCompletionRequest: + OpenAI.CreateImageRequest: type: object required: - - messages - - model - properties: - messages: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - minItems: 1 - description: A list of messages comprising the conversation so far. Depending on the [model](/docs/models) you use, different message types (modalities) are supported, like [text](/docs/guides/text-generation), [images](/docs/guides/vision), and audio. - model: - anyOf: - - type: string - - type: string - enum: - - o1-preview - - o1-preview-2024-09-12 - - o1-mini - - o1-mini-2024-09-12 - - gpt-4o - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - chatgpt-4o-latest - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0301 - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - description: ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. - x-oaiTypeLabel: string - store: - type: boolean - nullable: true - description: |- - Whether or not to store the output of this chat completion request - for use in our [model distillation](/docs/guides/distillation) or [evals](/docs/guides/evals) products. - default: false - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: |- - Developer-defined tags and values used for filtering completions - in the [dashboard](https://platform.openai.com/chat-completions). - frequency_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - logit_bias: - type: object - additionalProperties: - type: integer - format: int32 - nullable: true - description: |- - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - x-oaiTypeLabel: map - default: null - logprobs: - type: boolean - nullable: true - description: Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. - default: false - top_logprobs: - type: integer - format: int32 - nullable: true - minimum: 0 - maximum: 20 - description: An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. - max_tokens: - type: integer - format: int32 - nullable: true - description: |- - The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API. - - This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with [o1 series models](/docs/guides/reasoning). - deprecated: true - max_completion_tokens: - type: integer - format: int32 - nullable: true - description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). - n: - type: integer - format: int32 - nullable: true - minimum: 1 - maximum: 128 - description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. - default: 1 - presence_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - response_format: - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - description: |- - An object specifying the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. - x-oaiExpandable: true - seed: - type: integer - format: int64 - nullable: true - minimum: -9223372036854776000 - maximum: 9223372036854776000 - description: |- - This feature is in Beta. - If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. - Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - service_tier: - type: string - enum: - - auto - - default - nullable: true - description: |- - Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. - - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - When not set, the default behavior is 'auto'. - - When this parameter is set, the response body will include the `service_tier` utilized. - default: auto - stop: - anyOf: - - type: string - - type: array - items: - type: string - nullable: true - description: Up to 4 sequences where the API will stop generating further tokens. - default: null - stream: - type: boolean - nullable: true - description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' - default: false - stream_options: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' - nullable: true - default: null - temperature: - type: number - format: float - nullable: true - minimum: 0 - maximum: 2 - description: |- - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - - We generally recommend altering this or `top_p` but not both. - default: 1 - top_p: - type: number - format: float - nullable: true - minimum: 0 - maximum: 1 - description: |- - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or `temperature` but not both. - default: 1 - tools: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTool' - description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. - tool_choice: - $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' - parallel_tool_calls: - type: boolean - default: true - user: - type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - function_call: - anyOf: - - type: string - enum: - - none - - auto - - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' - description: |- - Deprecated in favor of `tool_choice`. - - Controls which (if any) function is called by the model. - `none` means the model will not call a function and instead generates a message. - `auto` means the model can pick between generating a message or calling a function. - Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - - `none` is the default when no functions are present. `auto` is the default if functions are present. - deprecated: true - x-oaiExpandable: true - functions: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' - minItems: 1 - maxItems: 128 - description: |- - Deprecated in favor of `tools`. - - A list of functions the model may generate JSON inputs for. - deprecated: true - OpenAI.CreateChatCompletionResponse: - type: object - required: - - id - - choices - - created - - model - - object - properties: - id: - type: string - description: A unique identifier for the chat completion. - choices: - type: array - items: - type: object - properties: - finish_reason: - type: string - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - description: |- - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - `content_filter` if content was omitted due to a flag from our content filters, - `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. - index: - type: integer - format: int32 - description: The index of the choice in the list of choices. - message: - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - logprobs: - type: object - properties: - content: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message content tokens with log probability information. - readOnly: true - refusal: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message refusal tokens with log probability information. - readOnly: true - required: - - content - - refusal - nullable: true - description: Log probability information for the choice. - required: - - finish_reason - - index - - message - - logprobs - description: A list of chat completion choices. Can be more than one if `n` is greater than 1. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the chat completion was created. - model: - type: string - description: The model used for the chat completion. - service_tier: - type: string - enum: - - scale - - default - nullable: true - description: The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request. - system_fingerprint: - type: string - description: |- - This fingerprint represents the backend configuration that the model runs with. - - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - object: - type: string - enum: - - chat.completion - description: The object type, which is always `chat.completion`. - usage: - $ref: '#/components/schemas/OpenAI.CompletionUsage' - description: Represents a chat completion response returned by model, based on the provided input. - OpenAI.CreateImageRequest: - type: object - required: - - prompt + - prompt properties: prompt: type: string @@ -2468,7 +2454,7 @@ components: default: vivid user: type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). OpenAI.CreateMessageRequest: type: object required: @@ -2490,17 +2476,37 @@ components: $ref: '#/components/schemas/OpenAI.MessageContent' x-oaiExpandable: true attachments: - type: object - allOf: - - $ref: '#/components/schemas/CreateMessageRequestAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + required: + - file_id + - tools nullable: true description: A list of files attached to the message, and the tools they should be added to. metadata: type: object additionalProperties: type: string - nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map OpenAI.Error: type: object @@ -2547,7 +2553,7 @@ components: description: |- The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. OpenAI.FunctionObject: type: object required: @@ -2560,19 +2566,15 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. strict: type: boolean nullable: true description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). default: false - OpenAI.FunctionParameters: - type: object - additionalProperties: {} - description: |- - The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. OpenAI.Image: type: object properties: @@ -2882,9 +2884,21 @@ components: nullable: true description: The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. attachments: - type: object - allOf: - - $ref: '#/components/schemas/MessageObjectAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true nullable: true description: A list of files attached to the message, and the tools they were added to. metadata: @@ -2892,7 +2906,13 @@ components: additionalProperties: type: string nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map readOnly: true description: Represents a message within a [thread](/docs/api-reference/threads). @@ -2913,6 +2933,9 @@ components: allOf: - $ref: '#/components/schemas/OpenAI.MessageContent' description: The text content that is part of a message. + OpenAI.ParallelToolCalls: + type: boolean + description: Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use. OpenAI.ResponseFormatJsonSchemaSchema: type: object additionalProperties: {} diff --git a/.openapi3.azure/openapi3-azure-openai-2024-10-01-preview-generated.yaml b/.openapi3.azure/openapi3-azure-openai-2024-10-01-preview-generated.yaml index 08194da76..02988f573 100644 --- a/.openapi3.azure/openapi3-azure-openai-2024-10-01-preview-generated.yaml +++ b/.openapi3.azure/openapi3-azure-openai-2024-10-01-preview-generated.yaml @@ -7,27 +7,6 @@ tags: - name: Images - name: Assistants paths: - /chat/completions: - post: - operationId: createChatCompletion - parameters: [] - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' - - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' - tags: - - Chat - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AzureCreateChatCompletionRequest' /deployments/{deploymentId}/images/generations: post: operationId: ImageGenerations_Create @@ -86,34 +65,81 @@ paths: application/json: schema: $ref: '#/components/schemas/OpenAI.CreateMessageRequest' + /{deployment_id}/chat/completions: + post: + operationId: createChatCompletion + parameters: + - name: deployment_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' + - type: array + items: + $ref: '#/components/schemas/AzureChatCompletionStreamResponseDelta' + - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' + tags: + - Chat + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AzureCreateChatCompletionRequest' security: - ApiKeyAuth: [] - OAuth2Auth: - https://cognitiveservices.azure.com/.default components: schemas: - AzureChatCompletionResponseMessage: - type: object - properties: - context: - allOf: - - $ref: '#/components/schemas/AzureChatMessageContext' - description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - description: |- - The extended response model component for chat completion response messages on the Azure OpenAI service. - This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other - information related to retrieval-augmented generation performed. AzureChatCompletionStreamResponseDelta: type: object properties: + audio: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageAudioChunk' + description: Response audio associated with the streaming chat delta payload. + content: + type: string + nullable: true + description: The contents of the chunk message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. context: allOf: - $ref: '#/components/schemas/AzureChatMessageContext' description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamResponseDelta' description: |- The extended response model for a streaming chat response message on the Azure OpenAI service. This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other @@ -177,13 +203,13 @@ components: discriminator: propertyName: type mapping: - username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' connection_string: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' + system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' + user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' key_and_key_id: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' encoded_api_key: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' access_token: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' - system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' + username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' AzureChatDataSourceConnectionStringAuthenticationOptions: type: object required: @@ -261,9 +287,8 @@ components: https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. The api-version query parameter is not allowed. authentication: - anyOf: + allOf: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: |- The authentication mechanism to use with the endpoint-based vectorization source. Endpoint authentication supports API key and access token mechanisms. @@ -378,6 +403,7 @@ components: discriminator: propertyName: type mapping: + endpoint: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' deployment_name: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' model_id: '#/components/schemas/AzureChatDataSourceModelIdVectorizationSource' integrated: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' @@ -464,21 +490,6 @@ components: description: |- An additional property, added to chat completion response messages, produced by the Azure OpenAI service when using extension behavior. This includes intent and citation information from the On Your Data feature. - AzureContentFilterBlocklistIdResult: - type: object - required: - - id - - filtered - properties: - id: - type: string - description: The ID of the custom blocklist associated with the filtered status. - filtered: - type: boolean - description: Whether the associated blocklist resulted in the content being filtered. - description: |- - A content filter result item that associates an existing custom blocklist ID with a value indicating whether or not - the corresponding blocklist resulted in content being filtered. AzureContentFilterBlocklistResult: type: object required: @@ -896,44 +907,352 @@ components: description: Represents a data source configuration that will use an Azure CosmosDB resource. AzureCreateChatCompletionRequest: type: object + required: + - messages properties: - data_sources: + messages: type: array items: - $ref: '#/components/schemas/AzureChatDataSource' - description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionRequest' - description: |- - The extended request model for chat completions against the Azure OpenAI service. - This adds the ability to provide data sources for the On Your Data feature. - AzureCreateChatCompletionResponse: - type: object - properties: - prompt_filter_results: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + minItems: 1 + description: |- + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + frequency_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + default: 0 + logit_bias: + type: object + additionalProperties: + type: integer + format: int32 + nullable: true + description: |- + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + x-oaiTypeLabel: map + default: null + logprobs: + type: boolean + nullable: true + description: |- + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + default: false + top_logprobs: + type: integer + format: int32 + nullable: true + minimum: 0 + maximum: 20 + description: |- + An integer between 0 and 20 specifying the number of most likely tokens to + return at each token position, each with an associated log probability. + `logprobs` must be set to `true` if this parameter is used. + max_tokens: + type: integer + format: int32 + nullable: true + description: |- + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o1 series models](/docs/guides/reasoning). + deprecated: true + max_completion_tokens: + type: integer + format: int32 + nullable: true + description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 128 + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + default: 1 + presence_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + default: 0 + response_format: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + description: |- + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model + to produce JSON yourself via a system or user message. Without this, the + model may generate an unending stream of whitespace until the generation + reaches the token limit, resulting in a long-running and seemingly "stuck" + request. Also note that the message content may be partially cut off if + `finish_reason="length"`, which indicates the generation exceeded + `max_tokens` or the conversation exceeded the max context length. + x-oaiExpandable: true + seed: + type: integer + format: int64 + nullable: true + description: |- + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + anyOf: + - type: string + - type: array + items: + type: string + nullable: true + description: Up to 4 sequences where the API will stop generating further tokens. + default: null + stream: + type: boolean + nullable: true + description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' + default: false + stream_options: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' + nullable: true + default: null + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + default: 1 + tools: type: array items: - type: object - properties: - prompt_index: - type: integer - format: int32 - description: The index of the input prompt that this content filter result corresponds to. - content_filter_results: - allOf: - - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' - description: The content filter results associated with the indexed input prompt. - required: - - prompt_index - - content_filter_results - description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionResponse' - description: |- - The extended top-level chat completion response model for the Azure OpenAI service. - This model adds Responsible AI content filter annotations for prompt input. - AzureImage: - type: object + $ref: '#/components/schemas/OpenAI.ChatCompletionTool' + description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + tool_choice: + $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' + parallel_tool_calls: + allOf: + - $ref: '#/components/schemas/OpenAI.ParallelToolCalls' + default: true + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + function_call: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' + description: |- + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + deprecated: true + x-oaiExpandable: true + functions: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' + minItems: 1 + maxItems: 128 + description: |- + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + deprecated: true + data_sources: + type: array + items: + $ref: '#/components/schemas/AzureChatDataSource' + description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. + description: |- + The extended request model for chat completions against the Azure OpenAI service. + This adds the ability to provide data sources for the On Your Data feature. + AzureCreateChatCompletionResponse: + type: object + required: + - id + - created + - model + - object + - choices + properties: + id: + type: string + description: A unique identifier for the chat completion. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + service_tier: + type: string + enum: + - scale + - default + nullable: true + description: The service tier used for processing the request. + system_fingerprint: + type: string + description: |- + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + enum: + - chat.completion + description: The object type, which is always `chat.completion`. + usage: + $ref: '#/components/schemas/OpenAI.CompletionUsage' + choices: + type: array + items: + $ref: '#/components/schemas/AzureCreateChatCompletionResponseChoice' + prompt_filter_results: + type: array + items: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt that this content filter result corresponds to. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter results associated with the indexed input prompt. + required: + - prompt_index + - content_filter_results + description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. + description: |- + The extended top-level chat completion response model for the Azure OpenAI service. + This model adds Responsible AI content filter annotations for prompt input. + AzureCreateChatCompletionResponseChoice: + type: object + required: + - finish_reason + - index + - message + - logprobs + - content_filter_results + properties: + finish_reason: + type: string + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + description: |- + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + index: + type: integer + format: int32 + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' + logprobs: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message content tokens with log probability information. + readOnly: true + refusal: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message refusal tokens with log probability information. + readOnly: true + required: + - content + - refusal + nullable: true + description: Log probability information for the choice. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForChoice' + description: The Responsible AI content filter annotations associated with the choice. + AzureImage: + type: object required: - prompt_filter_results - content_filter_results @@ -1020,15 +1339,6 @@ components: error: $ref: '#/components/schemas/AzureOpenAIDalleError' description: A structured representation of an error an Azure OpenAI request. - AzureOpenAIServiceApiVersion: - type: string - enum: - - 2024-06-01 - - 2024-08-01-preview - - 2024-09-01-preview - - 2024-10-01-preview - - 2024-10-21 - description: Known service API versions for Azure OpenAI. AzureSearchChatDataSource: type: object required: @@ -1097,7 +1407,6 @@ components: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: The authentication mechanism to use with Azure Search. fields_mapping: type: object @@ -1146,10 +1455,8 @@ components: type: string description: A filter to apply to the search. embedding_dependency: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' description: |- The vectorization source to use with Azure Search. Supported sources for Azure Search include endpoint, deployment name, and integrated. @@ -1166,30 +1473,6 @@ components: items: $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' description: The tool calls generated by the model, such as function calls. - ChatCompletionTokenLogprobBytes: - type: array - items: - type: integer - format: int32 - CreateMessageRequestAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true - required: - - file_id - - tools ElasticsearchChatDataSource: type: object required: @@ -1288,22 +1571,6 @@ components: description: The parameter information to control the use of the Elasticsearch data source. allOf: - $ref: '#/components/schemas/AzureChatDataSource' - MessageObjectAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true MongoDBChatDataSource: type: object required: @@ -1470,7 +1737,7 @@ components: description: |- The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. ranking_options: $ref: '#/components/schemas/OpenAI.FileSearchRankingOptions' description: Overrides for the file search tool. @@ -1522,8 +1789,24 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. deprecated: true + OpenAI.ChatCompletionMessageAudioChunk: + type: object + properties: + id: + type: string + transcript: + type: string + data: + type: string + format: base64 + expires_at: + type: integer + format: unixtime OpenAI.ChatCompletionMessageToolCall: type: object required: @@ -1623,6 +1906,19 @@ components: name: type: string description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + audio: + type: object + properties: + id: + type: string + description: Unique identifier for a previous audio response from the model. + required: + - id + nullable: true + description: |- + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + x-oaiExpandable: true tool_calls: $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' function_call: @@ -1640,6 +1936,7 @@ components: deprecated: true allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: Messages sent by the model in response to user messages. OpenAI.ChatCompletionRequestAssistantMessageContentPart: anyOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' @@ -1684,6 +1981,34 @@ components: tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' x-oaiExpandable: true + OpenAI.ChatCompletionRequestMessageContentPartAudio: + type: object + required: + - type + - input_audio + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + format: base64 + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + description: Learn about [audio inputs](/docs/guides/audio). OpenAI.ChatCompletionRequestMessageContentPartImage: type: object required: @@ -1708,10 +2033,11 @@ components: - auto - low - high - description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). default: auto required: - url + description: Learn about [image inputs](/docs/guides/vision). OpenAI.ChatCompletionRequestMessageContentPartRefusal: type: object required: @@ -1740,6 +2066,7 @@ components: text: type: string description: The text content. + description: Learn about [text inputs](/docs/guides/text-generation). OpenAI.ChatCompletionRequestSystemMessage: type: object required: @@ -1763,6 +2090,10 @@ components: description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. OpenAI.ChatCompletionRequestSystemMessageContentPart: type: object allOf: @@ -1821,10 +2152,14 @@ components: description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. allOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Messages sent by an end user, containing prompts or additional context + information. OpenAI.ChatCompletionRequestUserMessageContentPart: anyOf: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartAudio' x-oaiExpandable: true OpenAI.ChatCompletionResponseMessage: type: object @@ -1860,6 +2195,38 @@ components: - arguments description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. deprecated: true + audio: + type: object + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: |- + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + format: base64 + description: |- + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + required: + - id + - expires_at + - data + - transcript + nullable: true + description: |- + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). + x-oaiExpandable: true description: A chat completion message generated by the model. OpenAI.ChatCompletionStreamOptions: type: object @@ -1868,39 +2235,6 @@ components: type: boolean description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' description: 'Options for streaming response. Only set this when you set `stream: true`.' - OpenAI.ChatCompletionStreamResponseDelta: - type: object - properties: - content: - type: string - nullable: true - description: The contents of the chunk message. - function_call: - type: object - properties: - name: - type: string - arguments: - type: string - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - deprecated: true - tool_calls: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' - role: - type: string - enum: - - system - - user - - assistant - - tool - description: The role of the author of this message. - refusal: - type: string - nullable: true - description: The refusal message generated by the model. - description: A chat completion delta generated by streamed model responses. OpenAI.ChatCompletionTokenLogprob: type: object required: @@ -1917,9 +2251,10 @@ components: format: float description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. bytes: - type: object - allOf: - - $ref: '#/components/schemas/ChatCompletionTokenLogprobBytes' + type: array + items: + type: integer + format: int32 nullable: true description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. top_logprobs: @@ -2066,6 +2401,12 @@ components: completion_tokens_details: type: object properties: + accepted_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. audio_tokens: type: integer format: int32 @@ -2074,9 +2415,15 @@ components: type: integer format: int32 description: Tokens generated by the model for reasoning. - required: - - audio_tokens - - reasoning_tokens + rejected_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that did not appear in the completion. However, like + reasoning tokens, these tokens are still counted in the total + completion tokens for purposes of billing, output, and context window + limits. description: Breakdown of tokens used in a completion. prompt_tokens_details: type: object @@ -2089,357 +2436,8 @@ components: type: integer format: int32 description: Cached tokens present in the prompt. - required: - - audio_tokens - - cached_tokens description: Breakdown of tokens used in the prompt. description: Usage statistics for the completion request. - OpenAI.CreateChatCompletionRequest: - type: object - required: - - messages - - model - properties: - messages: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - minItems: 1 - description: A list of messages comprising the conversation so far. Depending on the [model](/docs/models) you use, different message types (modalities) are supported, like [text](/docs/guides/text-generation), [images](/docs/guides/vision), and audio. - model: - anyOf: - - type: string - - type: string - enum: - - o1-preview - - o1-preview-2024-09-12 - - o1-mini - - o1-mini-2024-09-12 - - gpt-4o - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - chatgpt-4o-latest - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0301 - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - description: ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. - x-oaiTypeLabel: string - store: - type: boolean - nullable: true - description: |- - Whether or not to store the output of this chat completion request - for use in our [model distillation](/docs/guides/distillation) or [evals](/docs/guides/evals) products. - default: false - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: |- - Developer-defined tags and values used for filtering completions - in the [dashboard](https://platform.openai.com/chat-completions). - frequency_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - logit_bias: - type: object - additionalProperties: - type: integer - format: int32 - nullable: true - description: |- - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - x-oaiTypeLabel: map - default: null - logprobs: - type: boolean - nullable: true - description: Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. - default: false - top_logprobs: - type: integer - format: int32 - nullable: true - minimum: 0 - maximum: 20 - description: An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. - max_tokens: - type: integer - format: int32 - nullable: true - description: |- - The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API. - - This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with [o1 series models](/docs/guides/reasoning). - deprecated: true - max_completion_tokens: - type: integer - format: int32 - nullable: true - description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). - n: - type: integer - format: int32 - nullable: true - minimum: 1 - maximum: 128 - description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. - default: 1 - presence_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - response_format: - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - description: |- - An object specifying the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. - x-oaiExpandable: true - seed: - type: integer - format: int64 - nullable: true - minimum: -9223372036854776000 - maximum: 9223372036854776000 - description: |- - This feature is in Beta. - If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. - Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - service_tier: - type: string - enum: - - auto - - default - nullable: true - description: |- - Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. - - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - When not set, the default behavior is 'auto'. - - When this parameter is set, the response body will include the `service_tier` utilized. - default: auto - stop: - anyOf: - - type: string - - type: array - items: - type: string - nullable: true - description: Up to 4 sequences where the API will stop generating further tokens. - default: null - stream: - type: boolean - nullable: true - description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' - default: false - stream_options: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' - nullable: true - default: null - temperature: - type: number - format: float - nullable: true - minimum: 0 - maximum: 2 - description: |- - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - - We generally recommend altering this or `top_p` but not both. - default: 1 - top_p: - type: number - format: float - nullable: true - minimum: 0 - maximum: 1 - description: |- - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or `temperature` but not both. - default: 1 - tools: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTool' - description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. - tool_choice: - $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' - parallel_tool_calls: - type: boolean - default: true - user: - type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - function_call: - anyOf: - - type: string - enum: - - none - - auto - - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' - description: |- - Deprecated in favor of `tool_choice`. - - Controls which (if any) function is called by the model. - `none` means the model will not call a function and instead generates a message. - `auto` means the model can pick between generating a message or calling a function. - Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - - `none` is the default when no functions are present. `auto` is the default if functions are present. - deprecated: true - x-oaiExpandable: true - functions: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' - minItems: 1 - maxItems: 128 - description: |- - Deprecated in favor of `tools`. - - A list of functions the model may generate JSON inputs for. - deprecated: true - OpenAI.CreateChatCompletionResponse: - type: object - required: - - id - - choices - - created - - model - - object - properties: - id: - type: string - description: A unique identifier for the chat completion. - choices: - type: array - items: - type: object - properties: - finish_reason: - type: string - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - description: |- - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - `content_filter` if content was omitted due to a flag from our content filters, - `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. - index: - type: integer - format: int32 - description: The index of the choice in the list of choices. - message: - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - logprobs: - type: object - properties: - content: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message content tokens with log probability information. - readOnly: true - refusal: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message refusal tokens with log probability information. - readOnly: true - required: - - content - - refusal - nullable: true - description: Log probability information for the choice. - required: - - finish_reason - - index - - message - - logprobs - description: A list of chat completion choices. Can be more than one if `n` is greater than 1. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the chat completion was created. - model: - type: string - description: The model used for the chat completion. - service_tier: - type: string - enum: - - scale - - default - nullable: true - description: The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request. - system_fingerprint: - type: string - description: |- - This fingerprint represents the backend configuration that the model runs with. - - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - object: - type: string - enum: - - chat.completion - description: The object type, which is always `chat.completion`. - usage: - $ref: '#/components/schemas/OpenAI.CompletionUsage' - description: Represents a chat completion response returned by model, based on the provided input. OpenAI.CreateImageRequest: type: object required: @@ -2503,7 +2501,7 @@ components: default: vivid user: type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). OpenAI.CreateMessageRequest: type: object required: @@ -2525,17 +2523,37 @@ components: $ref: '#/components/schemas/OpenAI.MessageContent' x-oaiExpandable: true attachments: - type: object - allOf: - - $ref: '#/components/schemas/CreateMessageRequestAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + required: + - file_id + - tools nullable: true description: A list of files attached to the message, and the tools they should be added to. metadata: type: object additionalProperties: type: string - nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map OpenAI.Error: type: object @@ -2582,7 +2600,7 @@ components: description: |- The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. OpenAI.FunctionObject: type: object required: @@ -2595,19 +2613,15 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. strict: type: boolean nullable: true description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). default: false - OpenAI.FunctionParameters: - type: object - additionalProperties: {} - description: |- - The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. OpenAI.Image: type: object properties: @@ -2917,9 +2931,21 @@ components: nullable: true description: The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. attachments: - type: object - allOf: - - $ref: '#/components/schemas/MessageObjectAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true nullable: true description: A list of files attached to the message, and the tools they were added to. metadata: @@ -2927,7 +2953,13 @@ components: additionalProperties: type: string nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map readOnly: true description: Represents a message within a [thread](/docs/api-reference/threads). @@ -2948,6 +2980,9 @@ components: allOf: - $ref: '#/components/schemas/OpenAI.MessageContent' description: The text content that is part of a message. + OpenAI.ParallelToolCalls: + type: boolean + description: Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use. OpenAI.ResponseFormatJsonSchemaSchema: type: object additionalProperties: {} diff --git a/.openapi3.azure/openapi3-azure-openai-2024-10-21-generated.yaml b/.openapi3.azure/openapi3-azure-openai-2024-10-21-generated.yaml index 3ba630394..dcbc6ccb8 100644 --- a/.openapi3.azure/openapi3-azure-openai-2024-10-21-generated.yaml +++ b/.openapi3.azure/openapi3-azure-openai-2024-10-21-generated.yaml @@ -7,27 +7,6 @@ tags: - name: Images - name: Assistants paths: - /chat/completions: - post: - operationId: createChatCompletion - parameters: [] - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' - - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' - tags: - - Chat - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AzureCreateChatCompletionRequest' /deployments/{deploymentId}/images/generations: post: operationId: ImageGenerations_Create @@ -86,34 +65,81 @@ paths: application/json: schema: $ref: '#/components/schemas/OpenAI.CreateMessageRequest' + /{deployment_id}/chat/completions: + post: + operationId: createChatCompletion + parameters: + - name: deployment_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' + - type: array + items: + $ref: '#/components/schemas/AzureChatCompletionStreamResponseDelta' + - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' + tags: + - Chat + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AzureCreateChatCompletionRequest' security: - ApiKeyAuth: [] - OAuth2Auth: - https://cognitiveservices.azure.com/.default components: schemas: - AzureChatCompletionResponseMessage: - type: object - properties: - context: - allOf: - - $ref: '#/components/schemas/AzureChatMessageContext' - description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - description: |- - The extended response model component for chat completion response messages on the Azure OpenAI service. - This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other - information related to retrieval-augmented generation performed. AzureChatCompletionStreamResponseDelta: type: object properties: + audio: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageAudioChunk' + description: Response audio associated with the streaming chat delta payload. + content: + type: string + nullable: true + description: The contents of the chunk message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. context: allOf: - $ref: '#/components/schemas/AzureChatMessageContext' description: The Azure-specific context information associated with the chat completion response message. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamResponseDelta' description: |- The extended response model for a streaming chat response message on the Azure OpenAI service. This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other @@ -131,28 +157,11 @@ components: mapping: azure_search: '#/components/schemas/AzureSearchChatDataSource' azure_cosmos_db: '#/components/schemas/AzureCosmosDBChatDataSource' - elasticsearch: '#/components/schemas/ElasticsearchChatDataSource' - pinecone: '#/components/schemas/PineconeChatDataSource' - mongo_db: '#/components/schemas/MongoDBChatDataSource' description: |- A representation of configuration data for a single Azure OpenAI chat data source. This will be used by a chat completions request that should use Azure OpenAI chat extensions to augment the response behavior. The use of this configuration is compatible only with Azure OpenAI. - AzureChatDataSourceAccessTokenAuthenticationOptions: - type: object - required: - - type - - access_token - properties: - type: - type: string - enum: - - access_token - access_token: - type: string - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' AzureChatDataSourceApiKeyAuthenticationOptions: type: object required: @@ -177,11 +186,7 @@ components: discriminator: propertyName: type mapping: - username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' connection_string: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' - key_and_key_id: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' - encoded_api_key: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' - access_token: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' AzureChatDataSourceConnectionStringAuthenticationOptions: @@ -226,20 +231,6 @@ components: Represents a vectorization source that makes internal service calls against an Azure OpenAI embedding model deployment. In contrast with the endpoint-based vectorization source, a deployment-name-based vectorization source must be part of the same Azure OpenAI resource but can be used even in private networks. - AzureChatDataSourceEncodedApiKeyAuthenticationOptions: - type: object - required: - - type - - encoded_api_key - properties: - type: - type: string - enum: - - encoded_api_key - encoded_api_key: - type: string - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' AzureChatDataSourceEndpointVectorizationSource: type: object required: @@ -261,9 +252,8 @@ components: https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. The api-version query parameter is not allowed. authentication: - anyOf: + allOf: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: |- The authentication mechanism to use with the endpoint-based vectorization source. Endpoint authentication supports API key and access token mechanisms. @@ -276,55 +266,6 @@ components: allOf: - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' description: Represents a vectorization source that makes public service calls against an Azure OpenAI embedding model deployment. - AzureChatDataSourceIntegratedVectorizationSource: - type: object - required: - - type - properties: - type: - type: string - enum: - - integrated - description: The type identifier, always 'integrated' for this vectorization source type. - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' - description: Represents an integrated vectorization source as defined within the supporting search resource. - AzureChatDataSourceKeyAndKeyIdAuthenticationOptions: - type: object - required: - - type - - key - - key_id - properties: - type: - type: string - enum: - - key_and_key_id - key: - type: string - key_id: - type: string - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' - AzureChatDataSourceModelIdVectorizationSource: - type: object - required: - - type - - model_id - properties: - type: - type: string - enum: - - model_id - description: The type identifier, always 'model_id' for this vectorization source type. - model_id: - type: string - description: The embedding model build ID to use for vectorization. - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' - description: |- - Represents a vectorization source that makes service calls based on a search service model ID. - This source type is currently only supported by Elasticsearch. AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions: type: object required: @@ -350,23 +291,6 @@ components: type: string allOf: - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' - AzureChatDataSourceUsernameAndPasswordAuthenticationOptions: - type: object - required: - - type - - username - - password - properties: - type: - type: string - enum: - - username_and_password - username: - type: string - password: - type: string - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' AzureChatDataSourceVectorizationSource: type: object required: @@ -378,9 +302,8 @@ components: discriminator: propertyName: type mapping: + endpoint: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' deployment_name: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' - model_id: '#/components/schemas/AzureChatDataSourceModelIdVectorizationSource' - integrated: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' description: A representation of a data vectorization source usable as an embedding resource with a data source. AzureChatMessageContext: type: object @@ -464,21 +387,6 @@ components: description: |- An additional property, added to chat completion response messages, produced by the Azure OpenAI service when using extension behavior. This includes intent and citation information from the On Your Data feature. - AzureContentFilterBlocklistIdResult: - type: object - required: - - id - - filtered - properties: - id: - type: string - description: The ID of the custom blocklist associated with the filtered status. - filtered: - type: boolean - description: Whether the associated blocklist resulted in the content being filtered. - description: |- - A content filter result item that associates an existing custom blocklist ID with a value indicating whether or not - the corresponding blocklist resulted in content being filtered. AzureContentFilterBlocklistResult: type: object required: @@ -503,21 +411,6 @@ components: - id description: The pairs of individual blocklist IDs and whether they resulted in a filtering action. description: A collection of true/false filtering results for configured custom blocklists. - AzureContentFilterCompletionTextSpan: - type: object - required: - - completion_start_offset - - completion_end_offset - properties: - completion_start_offset: - type: integer - format: int32 - description: Offset of the UTF32 code point which begins the span. - completion_end_offset: - type: integer - format: int32 - description: Offset of the first UTF32 code point which is excluded from the span. This field is always equal to completion_start_offset for empty spans. This field is always larger than completion_start_offset for non-empty spans. - description: A representation of a span of completion text as used by Azure OpenAI content filter results. AzureContentFilterDetectionResult: type: object required: @@ -876,85 +769,393 @@ components: description: Represents a data source configuration that will use an Azure CosmosDB resource. AzureCreateChatCompletionRequest: type: object + required: + - messages properties: - data_sources: - type: array - items: - $ref: '#/components/schemas/AzureChatDataSource' - description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionRequest' - description: |- - The extended request model for chat completions against the Azure OpenAI service. - This adds the ability to provide data sources for the On Your Data feature. - AzureCreateChatCompletionResponse: - type: object - properties: - prompt_filter_results: + messages: type: array items: - type: object - properties: - prompt_index: - type: integer - format: int32 - description: The index of the input prompt that this content filter result corresponds to. - content_filter_results: - allOf: - - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' - description: The content filter results associated with the indexed input prompt. - required: - - prompt_index - - content_filter_results - description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. - allOf: - - $ref: '#/components/schemas/OpenAI.CreateChatCompletionResponse' - description: |- - The extended top-level chat completion response model for the Azure OpenAI service. - This model adds Responsible AI content filter annotations for prompt input. - AzureImage: - type: object - required: - - prompt_filter_results - - content_filter_results - properties: - prompt_filter_results: - $ref: '#/components/schemas/AzureContentFilterImagePromptResults' - content_filter_results: - $ref: '#/components/schemas/AzureContentFilterImageResponseResults' - allOf: - - $ref: '#/components/schemas/OpenAI.Image' - AzureOpenAIChatError: - type: object - properties: - code: - type: string - description: The distinct, machine-generated identifier for the error. - message: - type: string - description: A human-readable message associated with the error. - param: - type: string - description: If applicable, the request input parameter associated with the error - type: - type: string - description: If applicable, the input line number associated with the error. - inner_error: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + minItems: 1 + description: |- + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + frequency_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + default: 0 + logit_bias: type: object - properties: - code: - type: string - enum: - - ResponsibleAIPolicyViolation - description: The code associated with the inner error. - revised_prompt: - type: string - description: If applicable, the modified prompt used for generation. - content_filter_results: - allOf: - - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' - description: The content filter result details associated with the inner error. - description: If applicable, an upstream error that originated this error. + additionalProperties: + type: integer + format: int32 + nullable: true + description: |- + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + x-oaiTypeLabel: map + default: null + logprobs: + type: boolean + nullable: true + description: |- + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + default: false + top_logprobs: + type: integer + format: int32 + nullable: true + minimum: 0 + maximum: 20 + description: |- + An integer between 0 and 20 specifying the number of most likely tokens to + return at each token position, each with an associated log probability. + `logprobs` must be set to `true` if this parameter is used. + max_tokens: + type: integer + format: int32 + nullable: true + description: |- + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o1 series models](/docs/guides/reasoning). + deprecated: true + max_completion_tokens: + type: integer + format: int32 + nullable: true + description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 128 + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + default: 1 + presence_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + default: 0 + response_format: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + description: |- + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model + to produce JSON yourself via a system or user message. Without this, the + model may generate an unending stream of whitespace until the generation + reaches the token limit, resulting in a long-running and seemingly "stuck" + request. Also note that the message content may be partially cut off if + `finish_reason="length"`, which indicates the generation exceeded + `max_tokens` or the conversation exceeded the max context length. + x-oaiExpandable: true + seed: + type: integer + format: int64 + nullable: true + description: |- + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + anyOf: + - type: string + - type: array + items: + type: string + nullable: true + description: Up to 4 sequences where the API will stop generating further tokens. + default: null + stream: + type: boolean + nullable: true + description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' + default: false + stream_options: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' + nullable: true + default: null + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + default: 1 + tools: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTool' + description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + tool_choice: + $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' + parallel_tool_calls: + allOf: + - $ref: '#/components/schemas/OpenAI.ParallelToolCalls' + default: true + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + function_call: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' + description: |- + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + deprecated: true + x-oaiExpandable: true + functions: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' + minItems: 1 + maxItems: 128 + description: |- + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + deprecated: true + data_sources: + type: array + items: + $ref: '#/components/schemas/AzureChatDataSource' + description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. + description: |- + The extended request model for chat completions against the Azure OpenAI service. + This adds the ability to provide data sources for the On Your Data feature. + AzureCreateChatCompletionResponse: + type: object + required: + - id + - created + - model + - object + - choices + properties: + id: + type: string + description: A unique identifier for the chat completion. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + service_tier: + type: string + enum: + - scale + - default + nullable: true + description: The service tier used for processing the request. + system_fingerprint: + type: string + description: |- + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + enum: + - chat.completion + description: The object type, which is always `chat.completion`. + usage: + $ref: '#/components/schemas/OpenAI.CompletionUsage' + choices: + type: array + items: + $ref: '#/components/schemas/AzureCreateChatCompletionResponseChoice' + prompt_filter_results: + type: array + items: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt that this content filter result corresponds to. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter results associated with the indexed input prompt. + required: + - prompt_index + - content_filter_results + description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. + description: |- + The extended top-level chat completion response model for the Azure OpenAI service. + This model adds Responsible AI content filter annotations for prompt input. + AzureCreateChatCompletionResponseChoice: + type: object + required: + - finish_reason + - index + - message + - logprobs + - content_filter_results + properties: + finish_reason: + type: string + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + description: |- + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + index: + type: integer + format: int32 + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' + logprobs: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message content tokens with log probability information. + readOnly: true + refusal: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message refusal tokens with log probability information. + readOnly: true + required: + - content + - refusal + nullable: true + description: Log probability information for the choice. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForChoice' + description: The Responsible AI content filter annotations associated with the choice. + AzureImage: + type: object + required: + - prompt_filter_results + - content_filter_results + properties: + prompt_filter_results: + $ref: '#/components/schemas/AzureContentFilterImagePromptResults' + content_filter_results: + $ref: '#/components/schemas/AzureContentFilterImageResponseResults' + allOf: + - $ref: '#/components/schemas/OpenAI.Image' + AzureOpenAIChatError: + type: object + properties: + code: + type: string + description: The distinct, machine-generated identifier for the error. + message: + type: string + description: A human-readable message associated with the error. + param: + type: string + description: If applicable, the request input parameter associated with the error + type: + type: string + description: If applicable, the input line number associated with the error. + inner_error: + type: object + properties: + code: + type: string + enum: + - ResponsibleAIPolicyViolation + description: The code associated with the inner error. + revised_prompt: + type: string + description: If applicable, the modified prompt used for generation. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter result details associated with the inner error. + description: If applicable, an upstream error that originated this error. description: The structured representation of an error from an Azure OpenAI chat completion request. AzureOpenAIChatErrorResponse: type: object @@ -1000,71 +1201,6 @@ components: error: $ref: '#/components/schemas/AzureOpenAIDalleError' description: A structured representation of an error an Azure OpenAI request. - AzureOpenAIFile: - type: object - required: - - id - - bytes - - created_at - - filename - - object - - purpose - - status - properties: - id: - type: string - description: The file identifier, which can be referenced in the API endpoints. - bytes: - type: integer - format: int32 - nullable: true - description: The size of the file, in bytes. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the file was created. - filename: - type: string - description: The name of the file. - object: - type: string - enum: - - file - description: The object type, which is always `file`. - purpose: - type: string - enum: - - assistants - - assistants_output - - batch - - batch_output - - fine-tune - - fine-tune-results - - vision - description: The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results` and `vision`. - status_details: - type: string - description: Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. - deprecated: true - status: - type: string - enum: - - uploaded - - pending - - running - - processed - - error - - deleting - - deleted - AzureOpenAIServiceApiVersion: - type: string - enum: - - 2024-06-01 - - 2024-08-01-preview - - 2024-09-01-preview - - 2024-10-01-preview - - 2024-10-21 - description: Known service API versions for Azure OpenAI. AzureSearchChatDataSource: type: object required: @@ -1133,7 +1269,6 @@ components: - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' description: The authentication mechanism to use with Azure Search. fields_mapping: type: object @@ -1160,307 +1295,46 @@ components: items: type: string description: The names of fields that represent vector data. - image_vector_fields: - type: array - items: - type: string - description: The names of fields that represent image vector data. - description: The field mappings to use with the Azure Search resource. - query_type: - type: string - enum: - - simple - - semantic - - vector - - vector_simple_hybrid - - vector_semantic_hybrid - description: The query type for the Azure Search resource to use. - semantic_configuration: - type: string - description: Additional semantic configuration for the query. - filter: - type: string - description: A filter to apply to the search. - embedding_dependency: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' - description: |- - The vectorization source to use with Azure Search. - Supported sources for Azure Search include endpoint, deployment name, and integrated. - required: - - endpoint - - index_name - - authentication - description: The parameter information to control the use of the Azure Search data source. - allOf: - - $ref: '#/components/schemas/AzureChatDataSource' - description: Represents a data source configuration that will use an Azure Search resource. - ChatCompletionMessageToolCallsItem: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' - description: The tool calls generated by the model, such as function calls. - ChatCompletionTokenLogprobBytes: - type: array - items: - type: integer - format: int32 - CreateMessageRequestAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true - required: - - file_id - - tools - ElasticsearchChatDataSource: - type: object - required: - - type - - parameters - properties: - type: - type: string - enum: - - elasticsearch - description: The discriminated type identifier, which is always 'elasticsearch'. - parameters: - type: object - properties: - top_n_documents: - type: integer - format: int32 - description: The configured number of documents to feature in the query. - in_scope: - type: boolean - description: Whether queries should be restricted to use of the indexed data. - strictness: - type: integer - format: int32 - minimum: 1 - maximum: 5 - description: |- - The configured strictness of the search relevance filtering. - Higher strictness will increase precision but lower recall of the answer. - max_search_queries: - type: integer - format: int32 - description: |- - The maximum number of rewritten queries that should be sent to the search provider for a single user message. - By default, the system will make an automatic determination. - allow_partial_result: - type: boolean - description: |- - If set to true, the system will allow partial search results to be used and the request will fail if all - partial queries fail. If not specified or specified as false, the request will fail if any search query fails. - default: false - include_contexts: - type: array - items: - type: string - enum: - - citations - - intent - - all_retrieved_documents - maxItems: 3 - description: |- - The output context properties to include on the response. - By default, citations and intent will be requested. - default: - - citations - - intent - endpoint: - type: string - format: uri - index_name: - type: string - authentication: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' - - $ref: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' - fields_mapping: - type: object - properties: - title_field: - type: string - url_field: - type: string - filepath_field: - type: string - content_fields: - type: array - items: - type: string - content_fields_separator: - type: string - vector_fields: - type: array - items: - type: string - query_type: - type: string - enum: - - simple - - vector - embedding_dependency: - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' - required: - - endpoint - - index_name - - authentication - description: The parameter information to control the use of the Elasticsearch data source. - allOf: - - $ref: '#/components/schemas/AzureChatDataSource' - MessageObjectAttachments: - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - type: array - items: - anyOf: - - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' - - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' - description: The tools to add this file to. - x-oaiExpandable: true - MongoDBChatDataSource: - type: object - required: - - type - - parameters - properties: - type: - type: string - enum: - - mongo_db - description: The discriminated type identifier, which is always 'mongo_db'. - parameters: - type: object - properties: - top_n_documents: - type: integer - format: int32 - description: The configured number of documents to feature in the query. - in_scope: - type: boolean - description: Whether queries should be restricted to use of the indexed data. - strictness: - type: integer - format: int32 - minimum: 1 - maximum: 5 - description: |- - The configured strictness of the search relevance filtering. - Higher strictness will increase precision but lower recall of the answer. - max_search_queries: - type: integer - format: int32 - description: |- - The maximum number of rewritten queries that should be sent to the search provider for a single user message. - By default, the system will make an automatic determination. - allow_partial_result: - type: boolean - description: |- - If set to true, the system will allow partial search results to be used and the request will fail if all - partial queries fail. If not specified or specified as false, the request will fail if any search query fails. - default: false - include_contexts: - type: array - items: - type: string - enum: - - citations - - intent - - all_retrieved_documents - maxItems: 3 - description: |- - The output context properties to include on the response. - By default, citations and intent will be requested. - default: - - citations - - intent - endpoint: - type: string - description: The name of the MongoDB cluster endpoint. - database_name: - type: string - description: The name of the MongoDB database. - collection_name: - type: string - description: The name of the MongoDB collection. - app_name: - type: string - description: The name of the MongoDB application. - index_name: - type: string - description: The name of the MongoDB index. - authentication: - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' - description: |- - The authentication mechanism to use with Pinecone. - Supported authentication mechanisms for Pinecone include: username and password. - embedding_dependency: - anyOf: - - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' - - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' - description: |- - The vectorization source to use as an embedding dependency for the MongoDB data source. - Supported vectorization sources for MongoDB include: endpoint, deployment name. - fields_mapping: - type: object - properties: - content_fields: - type: array - items: - type: string - vector_fields: + image_vector_fields: type: array items: type: string - title_field: - type: string - url_field: - type: string - filepath_field: - type: string - content_fields_separator: - type: string - required: - - content_fields - - vector_fields + description: The names of fields that represent image vector data. + description: The field mappings to use with the Azure Search resource. + query_type: + type: string + enum: + - simple + - semantic + - vector + - vector_simple_hybrid + - vector_semantic_hybrid + description: The query type for the Azure Search resource to use. + semantic_configuration: + type: string + description: Additional semantic configuration for the query. + filter: + type: string + description: A filter to apply to the search. + embedding_dependency: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' description: |- - Field mappings to apply to data used by the MongoDB data source. - Note that content and vector field mappings are required for MongoDB. + The vectorization source to use with Azure Search. + Supported sources for Azure Search include endpoint, deployment name, and integrated. required: - endpoint - - database_name - - collection_name - - app_name - index_name - authentication - - embedding_dependency - - fields_mapping - description: The parameter information to control the use of the MongoDB data source. + description: The parameter information to control the use of the Azure Search data source. allOf: - $ref: '#/components/schemas/AzureChatDataSource' + description: Represents a data source configuration that will use an Azure Search resource. + ChatCompletionMessageToolCallsItem: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' + description: The tool calls generated by the model, such as function calls. OpenAI.AssistantToolDefinition: type: object required: @@ -1506,7 +1380,7 @@ components: description: |- The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. ranking_options: $ref: '#/components/schemas/OpenAI.FileSearchRankingOptions' description: Overrides for the file search tool. @@ -1558,8 +1432,24 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. deprecated: true + OpenAI.ChatCompletionMessageAudioChunk: + type: object + properties: + id: + type: string + transcript: + type: string + data: + type: string + format: base64 + expires_at: + type: integer + format: unixtime OpenAI.ChatCompletionMessageToolCall: type: object required: @@ -1589,254 +1479,53 @@ components: - arguments description: The function that the model called. OpenAI.ChatCompletionMessageToolCallChunk: - type: object - required: - - index - properties: - index: - type: integer - format: int32 - id: - type: string - description: The ID of the tool call. - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - OpenAI.ChatCompletionNamedToolChoice: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - required: - - name - description: Specifies a tool the model should use. Use to force the model to call a specific function. - OpenAI.ChatCompletionRequestAssistantMessage: - type: object - required: - - role - properties: - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessageContentPart' - nullable: true - description: The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. - x-oaiExpandable: true - refusal: - type: string - nullable: true - description: The refusal message by the assistant. - role: - type: string - enum: - - assistant - description: The role of the messages author, in this case `assistant`. - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' - function_call: - type: object - properties: - name: - type: string - arguments: - type: string - required: - - name - - arguments - nullable: true - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - deprecated: true - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - OpenAI.ChatCompletionRequestAssistantMessageContentPart: - anyOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartRefusal' - x-oaiExpandable: true - OpenAI.ChatCompletionRequestFunctionMessage: - type: object - required: - - role - - content - - name - properties: - role: - type: string - enum: - - function - description: The role of the messages author, in this case `function`. - content: - type: string - nullable: true - description: The contents of the function message. - name: - type: string - description: The name of the function to call. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - deprecated: true - OpenAI.ChatCompletionRequestMessage: - type: object - required: - - role - properties: - role: - type: string - description: The role of the author of this message. - discriminator: - propertyName: role - mapping: - system: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessage' - user: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessage' - assistant: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessage' - tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' - function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' - x-oaiExpandable: true - OpenAI.ChatCompletionRequestMessageContentPartImage: - type: object - required: - - type - - image_url - properties: - type: - type: string - enum: - - image_url - description: The type of the content part. - image_url: - type: object - properties: - url: - type: string - format: uri - description: Either a URL of the image or the base64 encoded image data. - detail: - type: string - enum: - - auto - - low - - high - description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). - default: auto - required: - - url - OpenAI.ChatCompletionRequestMessageContentPartRefusal: - type: object - required: - - type - - refusal - properties: - type: - type: string - enum: - - refusal - description: The type of the content part. - refusal: - type: string - description: The refusal message generated by the model. - OpenAI.ChatCompletionRequestMessageContentPartText: - type: object - required: - - type - - text - properties: - type: - type: string - enum: - - text - description: The type of the content part. - text: - type: string - description: The text content. - OpenAI.ChatCompletionRequestSystemMessage: - type: object - required: - - content - - role - properties: - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessageContentPart' - description: The contents of the system message. - role: + type: object + required: + - index + properties: + index: + type: integer + format: int32 + id: type: string - enum: - - system - description: The role of the messages author, in this case `system`. - name: + description: The ID of the tool call. + type: type: string - description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - OpenAI.ChatCompletionRequestSystemMessageContentPart: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - x-oaiExpandable: true - OpenAI.ChatCompletionRequestToolMessage: + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + OpenAI.ChatCompletionNamedToolChoice: type: object required: - - role - - content - - tool_call_id + - type + - function properties: - role: + type: type: string enum: - - tool - description: The role of the messages author, in this case `tool`. - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessageContentPart' - description: The contents of the tool message. - tool_call_id: - type: string - description: Tool call that this message is responding to. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - OpenAI.ChatCompletionRequestToolMessageContentPart: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - x-oaiExpandable: true - OpenAI.ChatCompletionRequestUserMessage: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + description: Specifies a tool the model should use. Use to force the model to call a specific function. + OpenAI.ChatCompletionRequestAssistantMessage: type: object required: - - content - role properties: content: @@ -1844,46 +1533,37 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessageContentPart' - description: The contents of the user message. + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessageContentPart' + nullable: true + description: The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. x-oaiExpandable: true + refusal: + type: string + nullable: true + description: The refusal message by the assistant. role: type: string enum: - - user - description: The role of the messages author, in this case `user`. + - assistant + description: The role of the messages author, in this case `assistant`. name: type: string description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - OpenAI.ChatCompletionRequestUserMessageContentPart: - anyOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' - x-oaiExpandable: true - OpenAI.ChatCompletionResponseMessage: - type: object - required: - - content - - refusal - - role - properties: - content: - type: string - nullable: true - description: The contents of the message. - refusal: - type: string + audio: + type: object + properties: + id: + type: string + description: Unique identifier for a previous audio response from the model. + required: + - id nullable: true - description: The refusal message generated by the model. + description: |- + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + x-oaiExpandable: true tool_calls: $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' - role: - type: string - enum: - - assistant - description: The role of the author of this message. function_call: type: object properties: @@ -1894,588 +1574,513 @@ components: required: - name - arguments + nullable: true description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. deprecated: true - description: A chat completion message generated by the model. - OpenAI.ChatCompletionStreamOptions: - type: object - properties: - include_usage: - type: boolean - description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' - description: 'Options for streaming response. Only set this when you set `stream: true`.' - OpenAI.ChatCompletionStreamResponseDelta: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: Messages sent by the model in response to user messages. + OpenAI.ChatCompletionRequestAssistantMessageContentPart: + anyOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartRefusal' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestFunctionMessage: type: object + required: + - role + - content + - name properties: - content: - type: string - nullable: true - description: The contents of the chunk message. - function_call: - type: object - properties: - name: - type: string - arguments: - type: string - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - deprecated: true - tool_calls: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' role: type: string enum: - - system - - user - - assistant - - tool - description: The role of the author of this message. - refusal: - type: string - nullable: true - description: The refusal message generated by the model. - description: A chat completion delta generated by streamed model responses. - OpenAI.ChatCompletionTokenLogprob: - type: object - required: - - token - - logprob - - bytes - - top_logprobs - properties: - token: + - function + description: The role of the messages author, in this case `function`. + content: type: string - description: The token. - logprob: - type: number - format: float - description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - bytes: - type: object - allOf: - - $ref: '#/components/schemas/ChatCompletionTokenLogprobBytes' nullable: true - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. - top_logprobs: - type: array - items: - type: object - properties: - token: - type: string - description: The token. - logprob: - type: number - format: float - description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - bytes: - type: array - items: - type: integer - format: int32 - nullable: true - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. - required: - - token - - logprob - - bytes - description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. - OpenAI.ChatCompletionTool: - type: object - required: - - type - - function - properties: - type: + description: The contents of the function message. + name: type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - $ref: '#/components/schemas/OpenAI.FunctionObject' - OpenAI.ChatCompletionToolChoiceOption: - anyOf: - - type: string - enum: - - none - - auto - - required - - $ref: '#/components/schemas/OpenAI.ChatCompletionNamedToolChoice' - description: |- - Controls which (if any) tool is called by the model. - `none` means the model will not call any tool and instead generates a message. - `auto` means the model can pick between generating a message or calling one or more tools. - `required` means the model must call one or more tools. - Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. - - `none` is the default when no tools are present. `auto` is the default if tools are present. - x-oaiExpandable: true - OpenAI.ChatResponseFormat: + description: The name of the function to call. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + deprecated: true + OpenAI.ChatCompletionRequestMessage: type: object required: - - type + - role properties: - type: + role: type: string + description: The role of the author of this message. discriminator: - propertyName: type + propertyName: role mapping: - text: '#/components/schemas/OpenAI.ChatResponseFormatText' - json_object: '#/components/schemas/OpenAI.ChatResponseFormatJsonObject' - json_schema: '#/components/schemas/OpenAI.ChatResponseFormatJsonSchema' - OpenAI.ChatResponseFormatJsonObject: + system: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessage' + user: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessage' + assistant: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessage' + tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' + function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestMessageContentPartAudio: type: object required: - type + - input_audio properties: type: type: string enum: - - json_object - description: 'The type of response format being defined: `json_object`' - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - OpenAI.ChatResponseFormatJsonSchema: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + format: base64 + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + description: Learn about [audio inputs](/docs/guides/audio). + OpenAI.ChatCompletionRequestMessageContentPartImage: type: object required: - type - - json_schema + - image_url properties: type: type: string enum: - - json_schema - description: 'The type of response format being defined: `json_schema`' - json_schema: + - image_url + description: The type of the content part. + image_url: type: object properties: - description: + url: type: string - description: A description of what the response format is for, used by the model to determine how to respond in the format. - name: + format: uri + description: Either a URL of the image or the base64 encoded image data. + detail: type: string - description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - schema: - $ref: '#/components/schemas/OpenAI.ResponseFormatJsonSchemaSchema' - strict: - type: boolean - nullable: true - description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](/docs/guides/structured-outputs). - default: false + enum: + - auto + - low + - high + description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). + default: auto required: - - name - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - OpenAI.ChatResponseFormatText: + - url + description: Learn about [image inputs](/docs/guides/vision). + OpenAI.ChatCompletionRequestMessageContentPartRefusal: type: object required: - type + - refusal properties: type: type: string enum: - - text - description: 'The type of response format being defined: `text`' - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - OpenAI.CompletionUsage: + - refusal + description: The type of the content part. + refusal: + type: string + description: The refusal message generated by the model. + OpenAI.ChatCompletionRequestMessageContentPartText: type: object required: - - completion_tokens - - prompt_tokens - - total_tokens + - type + - text properties: - completion_tokens: - type: integer - format: int32 - description: Number of tokens in the generated completion. - prompt_tokens: - type: integer - format: int32 - description: Number of tokens in the prompt. - total_tokens: - type: integer - format: int32 - description: Total number of tokens used in the request (prompt + completion). - completion_tokens_details: - type: object - properties: - audio_tokens: - type: integer - format: int32 - description: Audio input tokens generated by the model. - reasoning_tokens: - type: integer - format: int32 - description: Tokens generated by the model for reasoning. - required: - - audio_tokens - - reasoning_tokens - description: Breakdown of tokens used in a completion. - prompt_tokens_details: - type: object - properties: - audio_tokens: - type: integer - format: int32 - description: Audio input tokens present in the prompt. - cached_tokens: - type: integer - format: int32 - description: Cached tokens present in the prompt. - required: - - audio_tokens - - cached_tokens - description: Breakdown of tokens used in the prompt. - description: Usage statistics for the completion request. - OpenAI.CreateChatCompletionRequest: + type: + type: string + enum: + - text + description: The type of the content part. + text: + type: string + description: The text content. + description: Learn about [text inputs](/docs/guides/text-generation). + OpenAI.ChatCompletionRequestSystemMessage: type: object required: - - messages - - model + - content + - role properties: - messages: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' - minItems: 1 - description: A list of messages comprising the conversation so far. Depending on the [model](/docs/models) you use, different message types (modalities) are supported, like [text](/docs/guides/text-generation), [images](/docs/guides/vision), and audio. - model: + content: anyOf: - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessageContentPart' + description: The contents of the system message. + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. + OpenAI.ChatCompletionRequestSystemMessageContentPart: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestToolMessage: + type: object + required: + - role + - content + - tool_call_id + properties: + role: + type: string + enum: + - tool + description: The role of the messages author, in this case `tool`. + content: + anyOf: - type: string - enum: - - o1-preview - - o1-preview-2024-09-12 - - o1-mini - - o1-mini-2024-09-12 - - gpt-4o - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - chatgpt-4o-latest - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0301 - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - description: ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. - x-oaiTypeLabel: string - store: - type: boolean - nullable: true - description: |- - Whether or not to store the output of this chat completion request - for use in our [model distillation](/docs/guides/distillation) or [evals](/docs/guides/evals) products. - default: false - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: |- - Developer-defined tags and values used for filtering completions - in the [dashboard](https://platform.openai.com/chat-completions). - frequency_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - logit_bias: - type: object - additionalProperties: - type: integer - format: int32 - nullable: true - description: |- - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - x-oaiTypeLabel: map - default: null - logprobs: - type: boolean - nullable: true - description: Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. - default: false - top_logprobs: - type: integer - format: int32 - nullable: true - minimum: 0 - maximum: 20 - description: An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. - max_tokens: - type: integer - format: int32 - nullable: true - description: |- - The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API. - - This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with [o1 series models](/docs/guides/reasoning). - deprecated: true - max_completion_tokens: - type: integer - format: int32 - nullable: true - description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). - n: - type: integer - format: int32 - nullable: true - minimum: 1 - maximum: 128 - description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. - default: 1 - presence_penalty: - type: number - format: float - nullable: true - minimum: -2 - maximum: 2 - description: |- - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - - [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - default: 0 - response_format: - allOf: - - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' - description: |- - An object specifying the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. - x-oaiExpandable: true - seed: - type: integer - format: int64 - nullable: true - minimum: -9223372036854776000 - maximum: 9223372036854776000 - description: |- - This feature is in Beta. - If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. - Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - service_tier: + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessageContentPart' + description: The contents of the tool message. + tool_call_id: type: string - enum: - - auto - - default - nullable: true - description: |- - Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. - - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - - When not set, the default behavior is 'auto'. - - When this parameter is set, the response body will include the `service_tier` utilized. - default: auto - stop: + description: Tool call that this message is responding to. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + OpenAI.ChatCompletionRequestToolMessageContentPart: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestUserMessage: + type: object + required: + - content + - role + properties: + content: anyOf: - type: string - type: array items: - type: string - nullable: true - description: Up to 4 sequences where the API will stop generating further tokens. - default: null - stream: - type: boolean - nullable: true - description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' - default: false - stream_options: - type: object - allOf: - - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' - nullable: true - default: null - temperature: - type: number - format: float + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessageContentPart' + description: The contents of the user message. + x-oaiExpandable: true + role: + type: string + enum: + - user + description: The role of the messages author, in this case `user`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Messages sent by an end user, containing prompts or additional context + information. + OpenAI.ChatCompletionRequestUserMessageContentPart: + anyOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartAudio' + x-oaiExpandable: true + OpenAI.ChatCompletionResponseMessage: + type: object + required: + - content + - refusal + - role + properties: + content: + type: string nullable: true - minimum: 0 - maximum: 2 - description: |- - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - - We generally recommend altering this or `top_p` but not both. - default: 1 - top_p: - type: number - format: float + description: The contents of the message. + refusal: + type: string nullable: true - minimum: 0 - maximum: 1 - description: |- - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or `temperature` but not both. - default: 1 - tools: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTool' - description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. - tool_choice: - $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' - parallel_tool_calls: - type: boolean - default: true - user: + description: The refusal message generated by the model. + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' + role: type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + enum: + - assistant + description: The role of the author of this message. function_call: - anyOf: - - type: string - enum: - - none - - auto - - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' - description: |- - Deprecated in favor of `tool_choice`. - - Controls which (if any) function is called by the model. - `none` means the model will not call a function and instead generates a message. - `auto` means the model can pick between generating a message or calling a function. - Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - - `none` is the default when no functions are present. `auto` is the default if functions are present. + type: object + properties: + name: + type: string + arguments: + type: string + required: + - name + - arguments + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. deprecated: true - x-oaiExpandable: true - functions: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' - minItems: 1 - maxItems: 128 + audio: + type: object + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: |- + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + format: base64 + description: |- + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + required: + - id + - expires_at + - data + - transcript + nullable: true description: |- - Deprecated in favor of `tools`. - - A list of functions the model may generate JSON inputs for. - deprecated: true - OpenAI.CreateChatCompletionResponse: + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). + x-oaiExpandable: true + description: A chat completion message generated by the model. + OpenAI.ChatCompletionStreamOptions: + type: object + properties: + include_usage: + type: boolean + description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' + description: 'Options for streaming response. Only set this when you set `stream: true`.' + OpenAI.ChatCompletionTokenLogprob: type: object required: - - id - - choices - - created - - model - - object + - token + - logprob + - bytes + - top_logprobs properties: - id: + token: type: string - description: A unique identifier for the chat completion. - choices: + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 + nullable: true + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + top_logprobs: type: array items: type: object properties: - finish_reason: + token: type: string - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - description: |- - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - `content_filter` if content was omitted due to a flag from our content filters, - `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. - index: - type: integer - format: int32 - description: The index of the choice in the list of choices. - message: - $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' - logprobs: - type: object - properties: - content: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message content tokens with log probability information. - readOnly: true - refusal: - type: array - items: - $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' - nullable: true - description: A list of message refusal tokens with log probability information. - readOnly: true - required: - - content - - refusal + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 nullable: true - description: Log probability information for the choice. + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. required: - - finish_reason - - index - - message - - logprobs - description: A list of chat completion choices. Can be more than one if `n` is greater than 1. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the chat completion was created. - model: + - token + - logprob + - bytes + description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. + OpenAI.ChatCompletionTool: + type: object + required: + - type + - function + properties: + type: type: string - description: The model used for the chat completion. - service_tier: + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: '#/components/schemas/OpenAI.FunctionObject' + OpenAI.ChatCompletionToolChoiceOption: + anyOf: + - type: string + enum: + - none + - auto + - required + - $ref: '#/components/schemas/OpenAI.ChatCompletionNamedToolChoice' + description: |- + Controls which (if any) tool is called by the model. + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + + `none` is the default when no tools are present. `auto` is the default if tools are present. + x-oaiExpandable: true + OpenAI.ChatResponseFormat: + type: object + required: + - type + properties: + type: + type: string + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/OpenAI.ChatResponseFormatText' + json_object: '#/components/schemas/OpenAI.ChatResponseFormatJsonObject' + json_schema: '#/components/schemas/OpenAI.ChatResponseFormatJsonSchema' + OpenAI.ChatResponseFormatJsonObject: + type: object + required: + - type + properties: + type: type: string enum: - - scale - - default - nullable: true - description: The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request. - system_fingerprint: + - json_object + description: 'The type of response format being defined: `json_object`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.ChatResponseFormatJsonSchema: + type: object + required: + - type + - json_schema + properties: + type: type: string - description: |- - This fingerprint represents the backend configuration that the model runs with. - - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - object: + enum: + - json_schema + description: 'The type of response format being defined: `json_schema`' + json_schema: + type: object + properties: + description: + type: string + description: A description of what the response format is for, used by the model to determine how to respond in the format. + name: + type: string + description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/OpenAI.ResponseFormatJsonSchemaSchema' + strict: + type: boolean + nullable: true + description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](/docs/guides/structured-outputs). + default: false + required: + - name + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.ChatResponseFormatText: + type: object + required: + - type + properties: + type: type: string enum: - - chat.completion - description: The object type, which is always `chat.completion`. - usage: - $ref: '#/components/schemas/OpenAI.CompletionUsage' - description: Represents a chat completion response returned by model, based on the provided input. + - text + description: 'The type of response format being defined: `text`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.CompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int32 + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + format: int32 + description: Number of tokens in the prompt. + total_tokens: + type: integer + format: int32 + description: Total number of tokens used in the request (prompt + completion). + completion_tokens_details: + type: object + properties: + accepted_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. + audio_tokens: + type: integer + format: int32 + description: Audio input tokens generated by the model. + reasoning_tokens: + type: integer + format: int32 + description: Tokens generated by the model for reasoning. + rejected_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that did not appear in the completion. However, like + reasoning tokens, these tokens are still counted in the total + completion tokens for purposes of billing, output, and context window + limits. + description: Breakdown of tokens used in a completion. + prompt_tokens_details: + type: object + properties: + audio_tokens: + type: integer + format: int32 + description: Audio input tokens present in the prompt. + cached_tokens: + type: integer + format: int32 + description: Cached tokens present in the prompt. + description: Breakdown of tokens used in the prompt. + description: Usage statistics for the completion request. OpenAI.CreateImageRequest: type: object required: @@ -2539,7 +2144,7 @@ components: default: vivid user: type: string - description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). OpenAI.CreateMessageRequest: type: object required: @@ -2561,17 +2166,37 @@ components: $ref: '#/components/schemas/OpenAI.MessageContent' x-oaiExpandable: true attachments: - type: object - allOf: - - $ref: '#/components/schemas/CreateMessageRequestAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + required: + - file_id + - tools nullable: true description: A list of files attached to the message, and the tools they should be added to. metadata: type: object additionalProperties: type: string - nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map OpenAI.Error: type: object @@ -2618,7 +2243,7 @@ components: description: |- The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. OpenAI.FunctionObject: type: object required: @@ -2631,19 +2256,15 @@ components: type: string description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: - $ref: '#/components/schemas/OpenAI.FunctionParameters' + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. strict: type: boolean nullable: true description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). default: false - OpenAI.FunctionParameters: - type: object - additionalProperties: {} - description: |- - The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. OpenAI.Image: type: object properties: @@ -2953,9 +2574,21 @@ components: nullable: true description: The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. attachments: - type: object - allOf: - - $ref: '#/components/schemas/MessageObjectAttachments' + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true nullable: true description: A list of files attached to the message, and the tools they were added to. metadata: @@ -2963,7 +2596,13 @@ components: additionalProperties: type: string nullable: true - description: 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. x-oaiTypeLabel: map readOnly: true description: Represents a message within a [thread](/docs/api-reference/threads). @@ -2984,159 +2623,13 @@ components: allOf: - $ref: '#/components/schemas/OpenAI.MessageContent' description: The text content that is part of a message. + OpenAI.ParallelToolCalls: + type: boolean + description: Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use. OpenAI.ResponseFormatJsonSchemaSchema: type: object additionalProperties: {} description: The schema for the response format, described as a JSON Schema object. - OpenAIFileWithOmittedProperties: - type: object - required: - - id - - bytes - - created_at - - filename - - object - - purpose - properties: - id: - type: string - description: The file identifier, which can be referenced in the API endpoints. - bytes: - type: integer - format: int32 - nullable: true - description: The size of the file, in bytes. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the file was created. - filename: - type: string - description: The name of the file. - object: - type: string - enum: - - file - description: The object type, which is always `file`. - purpose: - type: string - enum: - - assistants - - assistants_output - - batch - - batch_output - - fine-tune - - fine-tune-results - - vision - description: The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results` and `vision`. - status_details: - type: string - description: Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. - deprecated: true - description: The `File` object represents a document that has been uploaded to OpenAI. - PineconeChatDataSource: - type: object - required: - - type - - parameters - properties: - type: - type: string - enum: - - pinecone - description: The discriminated type identifier, which is always 'pinecone'. - parameters: - type: object - properties: - top_n_documents: - type: integer - format: int32 - description: The configured number of documents to feature in the query. - in_scope: - type: boolean - description: Whether queries should be restricted to use of the indexed data. - strictness: - type: integer - format: int32 - minimum: 1 - maximum: 5 - description: |- - The configured strictness of the search relevance filtering. - Higher strictness will increase precision but lower recall of the answer. - max_search_queries: - type: integer - format: int32 - description: |- - The maximum number of rewritten queries that should be sent to the search provider for a single user message. - By default, the system will make an automatic determination. - allow_partial_result: - type: boolean - description: |- - If set to true, the system will allow partial search results to be used and the request will fail if all - partial queries fail. If not specified or specified as false, the request will fail if any search query fails. - default: false - include_contexts: - type: array - items: - type: string - enum: - - citations - - intent - - all_retrieved_documents - maxItems: 3 - description: |- - The output context properties to include on the response. - By default, citations and intent will be requested. - default: - - citations - - intent - environment: - type: string - description: The environment name to use with Pinecone. - index_name: - type: string - description: The name of the Pinecone database index to use. - authentication: - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' - description: |- - The authentication mechanism to use with Pinecone. - Supported authentication mechanisms for Pinecone include: API key. - embedding_dependency: - allOf: - - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' - description: |- - The vectorization source to use as an embedding dependency for the Pinecone data source. - Supported vectorization sources for Pinecone include: deployment name. - fields_mapping: - type: object - properties: - content_fields: - type: array - items: - type: string - title_field: - type: string - url_field: - type: string - filepath_field: - type: string - content_fields_separator: - type: string - required: - - content_fields - description: |- - Field mappings to apply to data used by the Pinecone data source. - Note that content field mappings are required for Pinecone. - required: - - environment - - index_name - - authentication - - embedding_dependency - - fields_mapping - description: The parameter information to control the use of the Pinecone data source. - allOf: - - $ref: '#/components/schemas/AzureChatDataSource' securitySchemes: ApiKeyAuth: type: apiKey diff --git a/.openapi3.azure/openapi3-azure-openai-2024-12-01-preview-generated.yaml b/.openapi3.azure/openapi3-azure-openai-2024-12-01-preview-generated.yaml new file mode 100644 index 000000000..7c2d3b934 --- /dev/null +++ b/.openapi3.azure/openapi3-azure-openai-2024-12-01-preview-generated.yaml @@ -0,0 +1,3196 @@ +openapi: 3.0.0 +info: + title: Azure OpenAI Service + version: 2024-12-01-preview +tags: + - name: Chat + - name: Images + - name: Assistants +paths: + /deployments/{deploymentId}/images/generations: + post: + operationId: ImageGenerations_Create + parameters: + - name: deploymentId + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/OpenAI.ImagesResponse' + - $ref: '#/components/schemas/AzureOpenAIDalleErrorResponse' + tags: + - Images + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.CreateImageRequest' + /threads/{thread_id}/messages: + post: + operationId: createMessage + summary: Create a message. + parameters: + - name: thread_id + in: path + required: true + description: The ID of the [thread](/docs/api-reference/threads) to create a message for. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.MessageObject' + default: + description: An unexpected error response. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.ErrorResponse' + tags: + - Assistants + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.CreateMessageRequest' + /{deployment_id}/chat/completions: + post: + operationId: createChatCompletion + parameters: + - name: deployment_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' + - type: array + items: + $ref: '#/components/schemas/AzureChatCompletionStreamResponseDelta' + - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' + tags: + - Chat + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AzureCreateChatCompletionRequest' +security: + - ApiKeyAuth: [] + - OAuth2Auth: + - https://cognitiveservices.azure.com/.default +components: + schemas: + AzureChatCompletionStreamResponseDelta: + type: object + properties: + audio: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageAudioChunk' + description: Response audio associated with the streaming chat delta payload. + content: + type: string + nullable: true + description: The contents of the chunk message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. + context: + allOf: + - $ref: '#/components/schemas/AzureChatMessageContext' + description: The Azure-specific context information associated with the chat completion response message. + description: |- + The extended response model for a streaming chat response message on the Azure OpenAI service. + This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other + information related to retrieval-augmented generation performed. + AzureChatDataSource: + type: object + required: + - type + properties: + type: + type: string + description: The differentiating type identifier for the data source. + discriminator: + propertyName: type + mapping: + azure_search: '#/components/schemas/AzureSearchChatDataSource' + azure_cosmos_db: '#/components/schemas/AzureCosmosDBChatDataSource' + elasticsearch: '#/components/schemas/ElasticsearchChatDataSource' + pinecone: '#/components/schemas/PineconeChatDataSource' + mongo_db: '#/components/schemas/MongoDBChatDataSource' + description: |- + A representation of configuration data for a single Azure OpenAI chat data source. + This will be used by a chat completions request that should use Azure OpenAI chat extensions to augment the + response behavior. + The use of this configuration is compatible only with Azure OpenAI. + AzureChatDataSourceAccessTokenAuthenticationOptions: + type: object + required: + - type + - access_token + properties: + type: + type: string + enum: + - access_token + access_token: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceApiKeyAuthenticationOptions: + type: object + required: + - type + - key + properties: + type: + type: string + enum: + - api_key + key: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceAuthenticationOptions: + type: object + required: + - type + properties: + type: + type: string + discriminator: + propertyName: type + mapping: + connection_string: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' + system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' + user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' + key_and_key_id: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' + encoded_api_key: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' + access_token: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' + username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' + AzureChatDataSourceConnectionStringAuthenticationOptions: + type: object + required: + - type + - connection_string + properties: + type: + type: string + enum: + - connection_string + connection_string: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceDeploymentNameVectorizationSource: + type: object + required: + - type + - deployment_name + properties: + type: + type: string + enum: + - deployment_name + description: The type identifier, always 'deployment_name' for this vectorization source type. + deployment_name: + type: string + description: |- + The embedding model deployment to use for vectorization. This deployment must exist within the same Azure OpenAI + resource as the model deployment being used for chat completions. + dimensions: + type: integer + format: int32 + description: |- + The number of dimensions to request on embeddings. + Only supported in 'text-embedding-3' and later models. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + Represents a vectorization source that makes internal service calls against an Azure OpenAI embedding model + deployment. In contrast with the endpoint-based vectorization source, a deployment-name-based vectorization source + must be part of the same Azure OpenAI resource but can be used even in private networks. + AzureChatDataSourceEncodedApiKeyAuthenticationOptions: + type: object + required: + - type + - encoded_api_key + properties: + type: + type: string + enum: + - encoded_api_key + encoded_api_key: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceEndpointVectorizationSource: + type: object + required: + - type + - endpoint + - authentication + properties: + type: + type: string + enum: + - endpoint + description: The type identifier, always 'endpoint' for this vectorization source type. + endpoint: + type: string + format: uri + description: |- + Specifies the resource endpoint URL from which embeddings should be retrieved. + It should be in the format of: + https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. + The api-version query parameter is not allowed. + authentication: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' + description: |- + The authentication mechanism to use with the endpoint-based vectorization source. + Endpoint authentication supports API key and access token mechanisms. + dimensions: + type: integer + format: int32 + description: |- + The number of dimensions to request on embeddings. + Only supported in 'text-embedding-3' and later models. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: Represents a vectorization source that makes public service calls against an Azure OpenAI embedding model deployment. + AzureChatDataSourceIntegratedVectorizationSource: + type: object + required: + - type + properties: + type: + type: string + enum: + - integrated + description: The type identifier, always 'integrated' for this vectorization source type. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: Represents an integrated vectorization source as defined within the supporting search resource. + AzureChatDataSourceKeyAndKeyIdAuthenticationOptions: + type: object + required: + - type + - key + - key_id + properties: + type: + type: string + enum: + - key_and_key_id + key: + type: string + key_id: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceModelIdVectorizationSource: + type: object + required: + - type + - model_id + properties: + type: + type: string + enum: + - model_id + description: The type identifier, always 'model_id' for this vectorization source type. + model_id: + type: string + description: The embedding model build ID to use for vectorization. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + Represents a vectorization source that makes service calls based on a search service model ID. + This source type is currently only supported by Elasticsearch. + AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions: + type: object + required: + - type + properties: + type: + type: string + enum: + - system_assigned_managed_identity + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions: + type: object + required: + - type + - managed_identity_resource_id + properties: + type: + type: string + enum: + - user_assigned_managed_identity + managed_identity_resource_id: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceUsernameAndPasswordAuthenticationOptions: + type: object + required: + - type + - username + - password + properties: + type: + type: string + enum: + - username_and_password + username: + type: string + password: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceVectorizationSource: + type: object + required: + - type + properties: + type: + type: string + description: The differentiating identifier for the concrete vectorization source. + discriminator: + propertyName: type + mapping: + endpoint: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' + deployment_name: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' + model_id: '#/components/schemas/AzureChatDataSourceModelIdVectorizationSource' + integrated: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' + description: A representation of a data vectorization source usable as an embedding resource with a data source. + AzureChatMessageContext: + type: object + properties: + intent: + type: string + description: The detected intent from the chat history, which is used to carry conversation context between interactions + citations: + type: array + items: + type: object + properties: + content: + type: string + description: The content of the citation. + title: + type: string + description: The title for the citation. + url: + type: string + description: The URL of the citation. + filepath: + type: string + description: The file path for the citation. + chunk_id: + type: string + description: The chunk ID for the citation. + rerank_score: + type: number + format: double + description: The rerank score for the retrieval. + required: + - content + description: The citations produced by the data retrieval. + all_retrieved_documents: + type: object + properties: + content: + type: string + description: The content of the citation. + title: + type: string + description: The title for the citation. + url: + type: string + description: The URL of the citation. + filepath: + type: string + description: The file path for the citation. + chunk_id: + type: string + description: The chunk ID for the citation. + rerank_score: + type: number + format: double + description: The rerank score for the retrieval. + search_queries: + type: array + items: + type: string + description: The search queries executed to retrieve documents. + data_source_index: + type: integer + format: int32 + description: The index of the data source used for retrieval. + original_search_score: + type: number + format: double + description: The original search score for the retrieval. + filter_reason: + type: string + enum: + - score + - rerank + description: If applicable, an indication of why the document was filtered. + required: + - content + - search_queries + - data_source_index + description: Summary information about documents retrieved by the data retrieval operation. + description: |- + An additional property, added to chat completion response messages, produced by the Azure OpenAI service when using + extension behavior. This includes intent and citation information from the On Your Data feature. + AzureContentFilterBlocklistResult: + type: object + required: + - filtered + properties: + filtered: + type: boolean + description: A value indicating whether any of the detailed blocklists resulted in a filtering action. + details: + type: array + items: + type: object + properties: + filtered: + type: boolean + description: A value indicating whether the blocklist produced a filtering action. + id: + type: string + description: The ID of the custom blocklist evaluated. + required: + - filtered + - id + description: The pairs of individual blocklist IDs and whether they resulted in a filtering action. + description: A collection of true/false filtering results for configured custom blocklists. + AzureContentFilterCompletionTextSpan: + type: object + required: + - completion_start_offset + - completion_end_offset + properties: + completion_start_offset: + type: integer + format: int32 + description: Offset of the UTF32 code point which begins the span. + completion_end_offset: + type: integer + format: int32 + description: Offset of the first UTF32 code point which is excluded from the span. This field is always equal to completion_start_offset for empty spans. This field is always larger than completion_start_offset for non-empty spans. + description: A representation of a span of completion text as used by Azure OpenAI content filter results. + AzureContentFilterCompletionTextSpanDetectionResult: + type: object + required: + - filtered + - detected + - details + properties: + filtered: + type: boolean + description: Whether the content detection resulted in a content filtering action. + detected: + type: boolean + description: Whether the labeled content category was detected in the content. + details: + type: array + items: + $ref: '#/components/schemas/AzureContentFilterCompletionTextSpan' + description: Detailed information about the detected completion text spans. + AzureContentFilterDetectionResult: + type: object + required: + - filtered + - detected + properties: + filtered: + type: boolean + description: Whether the content detection resulted in a content filtering action. + detected: + type: boolean + description: Whether the labeled content category was detected in the content. + description: |- + A labeled content filter result item that indicates whether the content was detected and whether the content was + filtered. + AzureContentFilterImagePromptResults: + type: object + required: + - jailbreak + properties: + profanity: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that identifies whether crude, vulgar, or otherwise objection language is present in the + content. + custom_blocklists: + allOf: + - $ref: '#/components/schemas/AzureContentFilterBlocklistResult' + description: A collection of binary filtering outcomes for configured custom blocklists. + jailbreak: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that describes user prompt injection attacks, where malicious users deliberately exploit + system vulnerabilities to elicit unauthorized behavior from the LLM. This could lead to inappropriate content + generation or violations of system-imposed restrictions. + allOf: + - $ref: '#/components/schemas/AzureContentFilterImageResponseResults' + description: A content filter result for an image generation operation's input request content. + AzureContentFilterImageResponseResults: + type: object + properties: + sexual: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to anatomical organs and genitals, romantic relationships, acts + portrayed in erotic or affectionate terms, pregnancy, physical sexual acts, including those portrayed as an + assault or a forced sexual violent act against one's will, prostitution, pornography, and abuse. + violence: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to physical actions intended to hurt, injure, damage, or kill + someone or something; describes weapons, guns and related entities, such as manufactures, associations, + legislation, and so on. + hate: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that can refer to any content that attacks or uses pejorative or discriminatory + language with reference to a person or identity group based on certain differentiating attributes of these groups + including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, + religion, immigration status, ability status, personal appearance, and body size. + self_harm: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that describes language related to physical actions intended to purposely hurt, injure, + damage one's body or kill oneself. + description: A content filter result for an image generation operation's output response content. + AzureContentFilterResultForChoice: + type: object + properties: + sexual: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to anatomical organs and genitals, romantic relationships, acts + portrayed in erotic or affectionate terms, pregnancy, physical sexual acts, including those portrayed as an + assault or a forced sexual violent act against one's will, prostitution, pornography, and abuse. + hate: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that can refer to any content that attacks or uses pejorative or discriminatory + language with reference to a person or identity group based on certain differentiating attributes of these groups + including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, + religion, immigration status, ability status, personal appearance, and body size. + violence: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to physical actions intended to hurt, injure, damage, or kill + someone or something; describes weapons, guns and related entities, such as manufactures, associations, + legislation, and so on. + self_harm: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that describes language related to physical actions intended to purposely hurt, injure, + damage one's body or kill oneself. + profanity: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that identifies whether crude, vulgar, or otherwise objection language is present in the + content. + custom_blocklists: + allOf: + - $ref: '#/components/schemas/AzureContentFilterBlocklistResult' + description: A collection of binary filtering outcomes for configured custom blocklists. + error: + type: object + properties: + code: + type: integer + format: int32 + description: A distinct, machine-readable code associated with the error. + message: + type: string + description: A human-readable message associated with the error. + required: + - code + - message + description: If present, details about an error that prevented content filtering from completing its evaluation. + protected_material_text: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: A detection result that describes a match against text protected under copyright or other status. + protected_material_code: + type: object + properties: + filtered: + type: boolean + description: Whether the content detection resulted in a content filtering action. + detected: + type: boolean + description: Whether the labeled content category was detected in the content. + citation: + type: object + properties: + license: + type: string + description: The name or identifier of the license associated with the detection. + URL: + type: string + format: uri + description: The URL associated with the license. + description: If available, the citation details describing the associated license and its location. + required: + - filtered + - detected + description: A detection result that describes a match against licensed code or other protected source material. + ungrounded_material: + $ref: '#/components/schemas/AzureContentFilterCompletionTextSpanDetectionResult' + description: A content filter result for a single response item produced by a generative AI system. + AzureContentFilterResultForPrompt: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt associated with the accompanying content filter result categories. + content_filter_results: + type: object + properties: + sexual: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to anatomical organs and genitals, romantic relationships, acts + portrayed in erotic or affectionate terms, pregnancy, physical sexual acts, including those portrayed as an + assault or a forced sexual violent act against one's will, prostitution, pornography, and abuse. + hate: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that can refer to any content that attacks or uses pejorative or discriminatory + language with reference to a person or identity group based on certain differentiating attributes of these groups + including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, + religion, immigration status, ability status, personal appearance, and body size. + violence: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to physical actions intended to hurt, injure, damage, or kill + someone or something; describes weapons, guns and related entities, such as manufactures, associations, + legislation, and so on. + self_harm: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that describes language related to physical actions intended to purposely hurt, injure, + damage one's body or kill oneself. + profanity: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that identifies whether crude, vulgar, or otherwise objection language is present in the + content. + custom_blocklists: + allOf: + - $ref: '#/components/schemas/AzureContentFilterBlocklistResult' + description: A collection of binary filtering outcomes for configured custom blocklists. + error: + type: object + properties: + code: + type: integer + format: int32 + description: A distinct, machine-readable code associated with the error. + message: + type: string + description: A human-readable message associated with the error. + required: + - code + - message + description: If present, details about an error that prevented content filtering from completing its evaluation. + jailbreak: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that describes user prompt injection attacks, where malicious users deliberately exploit + system vulnerabilities to elicit unauthorized behavior from the LLM. This could lead to inappropriate content + generation or violations of system-imposed restrictions. + indirect_attack: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that describes attacks on systems powered by Generative AI models that can happen every time + an application processes information that wasn’t directly authored by either the developer of the application or + the user. + required: + - jailbreak + - indirect_attack + description: The content filter category details for the result. + description: A content filter result associated with a single input prompt item into a generative AI system. + AzureContentFilterSeverityResult: + type: object + required: + - filtered + - severity + properties: + filtered: + type: boolean + description: Whether the content severity resulted in a content filtering action. + severity: + type: string + enum: + - safe + - low + - medium + - high + description: The labeled severity of the content. + description: |- + A labeled content filter result item that indicates whether the content was filtered and what the qualitative + severity level of the content was, as evaluated against content filter configuration for the category. + AzureCosmosDBChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - azure_cosmos_db + description: The discriminated type identifier, which is always 'azure_cosmos_db'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + container_name: + type: string + database_name: + type: string + embedding_dependency: + $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + index_name: + type: string + authentication: + $ref: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' + fields_mapping: + type: object + properties: + content_fields: + type: array + items: + type: string + vector_fields: + type: array + items: + type: string + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields_separator: + type: string + required: + - content_fields + - vector_fields + required: + - container_name + - database_name + - embedding_dependency + - index_name + - authentication + - fields_mapping + description: The parameter information to control the use of the Azure CosmosDB data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + description: Represents a data source configuration that will use an Azure CosmosDB resource. + AzureCreateChatCompletionRequest: + type: object + required: + - messages + properties: + messages: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + minItems: 1 + description: |- + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + store: + type: boolean + nullable: true + description: |- + Whether or not to store the output of this chat completion request for + use in our [model distillation](/docs/guides/distillation) or + [evals](/docs/guides/evals) products. + default: false + reasoning_effort: + type: string + enum: + - low + - medium + - high + description: |- + **o1 models only** + + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `low`, `medium`, and `high`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + default: medium + metadata: + type: object + additionalProperties: + type: string + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + x-oaiTypeLabel: map + frequency_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + default: 0 + logit_bias: + type: object + additionalProperties: + type: integer + format: int32 + nullable: true + description: |- + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + x-oaiTypeLabel: map + default: null + logprobs: + type: boolean + nullable: true + description: |- + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + default: false + top_logprobs: + type: integer + format: int32 + nullable: true + minimum: 0 + maximum: 20 + description: |- + An integer between 0 and 20 specifying the number of most likely tokens to + return at each token position, each with an associated log probability. + `logprobs` must be set to `true` if this parameter is used. + max_tokens: + type: integer + format: int32 + nullable: true + description: |- + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o1 series models](/docs/guides/reasoning). + deprecated: true + max_completion_tokens: + type: integer + format: int32 + nullable: true + description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 128 + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + default: 1 + presence_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + default: 0 + response_format: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + description: |- + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model + to produce JSON yourself via a system or user message. Without this, the + model may generate an unending stream of whitespace until the generation + reaches the token limit, resulting in a long-running and seemingly "stuck" + request. Also note that the message content may be partially cut off if + `finish_reason="length"`, which indicates the generation exceeded + `max_tokens` or the conversation exceeded the max context length. + x-oaiExpandable: true + seed: + type: integer + format: int64 + nullable: true + description: |- + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + anyOf: + - type: string + - type: array + items: + type: string + nullable: true + description: Up to 4 sequences where the API will stop generating further tokens. + default: null + stream: + type: boolean + nullable: true + description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' + default: false + stream_options: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' + nullable: true + default: null + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + default: 1 + tools: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTool' + description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + tool_choice: + $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' + parallel_tool_calls: + allOf: + - $ref: '#/components/schemas/OpenAI.ParallelToolCalls' + default: true + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + function_call: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' + description: |- + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + deprecated: true + x-oaiExpandable: true + functions: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' + minItems: 1 + maxItems: 128 + description: |- + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + deprecated: true + data_sources: + type: array + items: + $ref: '#/components/schemas/AzureChatDataSource' + description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. + user_security_context: + $ref: '#/components/schemas/AzureUserSecurityContext' + description: |- + The extended request model for chat completions against the Azure OpenAI service. + This adds the ability to provide data sources for the On Your Data feature. + AzureCreateChatCompletionResponse: + type: object + required: + - id + - created + - model + - object + - choices + properties: + id: + type: string + description: A unique identifier for the chat completion. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + service_tier: + type: string + enum: + - scale + - default + nullable: true + description: The service tier used for processing the request. + system_fingerprint: + type: string + description: |- + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + enum: + - chat.completion + description: The object type, which is always `chat.completion`. + usage: + $ref: '#/components/schemas/OpenAI.CompletionUsage' + choices: + type: array + items: + $ref: '#/components/schemas/AzureCreateChatCompletionResponseChoice' + prompt_filter_results: + type: array + items: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt that this content filter result corresponds to. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter results associated with the indexed input prompt. + required: + - prompt_index + - content_filter_results + description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. + description: |- + The extended top-level chat completion response model for the Azure OpenAI service. + This model adds Responsible AI content filter annotations for prompt input. + AzureCreateChatCompletionResponseChoice: + type: object + required: + - finish_reason + - index + - message + - logprobs + - content_filter_results + properties: + finish_reason: + type: string + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + description: |- + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + index: + type: integer + format: int32 + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' + logprobs: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message content tokens with log probability information. + readOnly: true + refusal: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message refusal tokens with log probability information. + readOnly: true + required: + - content + - refusal + nullable: true + description: Log probability information for the choice. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForChoice' + description: The Responsible AI content filter annotations associated with the choice. + AzureImage: + type: object + required: + - prompt_filter_results + - content_filter_results + properties: + prompt_filter_results: + $ref: '#/components/schemas/AzureContentFilterImagePromptResults' + content_filter_results: + $ref: '#/components/schemas/AzureContentFilterImageResponseResults' + allOf: + - $ref: '#/components/schemas/OpenAI.Image' + AzureOpenAIChatError: + type: object + properties: + code: + type: string + description: The distinct, machine-generated identifier for the error. + message: + type: string + description: A human-readable message associated with the error. + param: + type: string + description: If applicable, the request input parameter associated with the error + type: + type: string + description: If applicable, the input line number associated with the error. + inner_error: + type: object + properties: + code: + type: string + enum: + - ResponsibleAIPolicyViolation + description: The code associated with the inner error. + revised_prompt: + type: string + description: If applicable, the modified prompt used for generation. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter result details associated with the inner error. + description: If applicable, an upstream error that originated this error. + description: The structured representation of an error from an Azure OpenAI chat completion request. + AzureOpenAIChatErrorResponse: + type: object + properties: + error: + $ref: '#/components/schemas/AzureOpenAIChatError' + description: A structured representation of an error an Azure OpenAI request. + AzureOpenAIDalleError: + type: object + properties: + code: + type: string + description: The distinct, machine-generated identifier for the error. + message: + type: string + description: A human-readable message associated with the error. + param: + type: string + description: If applicable, the request input parameter associated with the error + type: + type: string + description: If applicable, the input line number associated with the error. + inner_error: + type: object + properties: + code: + type: string + enum: + - ResponsibleAIPolicyViolation + description: The code associated with the inner error. + revised_prompt: + type: string + description: If applicable, the modified prompt used for generation. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterImagePromptResults' + description: The content filter result details associated with the inner error. + description: If applicable, an upstream error that originated this error. + description: The structured representation of an error from an Azure OpenAI image generation request. + AzureOpenAIDalleErrorResponse: + type: object + properties: + error: + $ref: '#/components/schemas/AzureOpenAIDalleError' + description: A structured representation of an error an Azure OpenAI request. + AzureSearchChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - azure_search + description: The discriminated type identifier, which is always 'azure_search'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + endpoint: + type: string + format: uri + description: The absolute endpoint path for the Azure Search resource to use. + index_name: + type: string + description: The name of the index to use, as specified in the Azure Search resource. + authentication: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' + description: The authentication mechanism to use with Azure Search. + fields_mapping: + type: object + properties: + title_field: + type: string + description: The name of the index field to use as a title. + url_field: + type: string + description: The name of the index field to use as a URL. + filepath_field: + type: string + description: The name of the index field to use as a filepath. + content_fields: + type: array + items: + type: string + description: The names of index fields that should be treated as content. + content_fields_separator: + type: string + description: The separator pattern that content fields should use. + vector_fields: + type: array + items: + type: string + description: The names of fields that represent vector data. + image_vector_fields: + type: array + items: + type: string + description: The names of fields that represent image vector data. + description: The field mappings to use with the Azure Search resource. + query_type: + type: string + enum: + - simple + - semantic + - vector + - vector_simple_hybrid + - vector_semantic_hybrid + description: The query type for the Azure Search resource to use. + semantic_configuration: + type: string + description: Additional semantic configuration for the query. + filter: + type: string + description: A filter to apply to the search. + embedding_dependency: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + The vectorization source to use with Azure Search. + Supported sources for Azure Search include endpoint, deployment name, and integrated. + required: + - endpoint + - index_name + - authentication + description: The parameter information to control the use of the Azure Search data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + description: Represents a data source configuration that will use an Azure Search resource. + AzureUserSecurityContext: + type: object + properties: + application_name: + type: string + description: The name of the application. Sensitive personal information should not be included in this field. + end_user_id: + type: string + description: This identifier is the Microsoft Entra ID (formerly Azure Active Directory) user object ID used to authenticate end-users within the generative AI application. Sensitive personal information should not be included in this field. + end_user_tenant_id: + type: string + description: The Microsoft 365 tenant ID the end user belongs to. It's required when the generative AI application is multitenant. + source_ip: + type: string + description: Captures the original client's IP address. + description: User security context contains several parameters that describe the application itself, and the end user that interacts with the application. These fields assist your security operations teams to investigate and mitigate security incidents by providing a comprehensive approach to protecting your AI applications. [Learn more](https://aka.ms/TP4AI/Documentation/EndUserContext) about protecting AI applications using Microsoft Defender for Cloud. + ChatCompletionMessageToolCallsItem: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' + description: The tool calls generated by the model, such as function calls. + ElasticsearchChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - elasticsearch + description: The discriminated type identifier, which is always 'elasticsearch'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + endpoint: + type: string + format: uri + index_name: + type: string + authentication: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' + fields_mapping: + type: object + properties: + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields: + type: array + items: + type: string + content_fields_separator: + type: string + vector_fields: + type: array + items: + type: string + query_type: + type: string + enum: + - simple + - vector + embedding_dependency: + $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + required: + - endpoint + - index_name + - authentication + description: The parameter information to control the use of the Elasticsearch data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + MongoDBChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - mongo_db + description: The discriminated type identifier, which is always 'mongo_db'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + endpoint: + type: string + description: The name of the MongoDB cluster endpoint. + database_name: + type: string + description: The name of the MongoDB database. + collection_name: + type: string + description: The name of the MongoDB collection. + app_name: + type: string + description: The name of the MongoDB application. + index_name: + type: string + description: The name of the MongoDB index. + authentication: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' + description: |- + The authentication mechanism to use with Pinecone. + Supported authentication mechanisms for Pinecone include: username and password. + embedding_dependency: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' + - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' + description: |- + The vectorization source to use as an embedding dependency for the MongoDB data source. + Supported vectorization sources for MongoDB include: endpoint, deployment name. + fields_mapping: + type: object + properties: + content_fields: + type: array + items: + type: string + vector_fields: + type: array + items: + type: string + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields_separator: + type: string + required: + - content_fields + - vector_fields + description: |- + Field mappings to apply to data used by the MongoDB data source. + Note that content and vector field mappings are required for MongoDB. + required: + - endpoint + - database_name + - collection_name + - app_name + - index_name + - authentication + - embedding_dependency + - fields_mapping + description: The parameter information to control the use of the MongoDB data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + OpenAI.AssistantToolDefinition: + type: object + required: + - type + properties: + type: + type: string + discriminator: + propertyName: type + mapping: + file_search: '#/components/schemas/OpenAI.AssistantToolsFileSearch' + function: '#/components/schemas/OpenAI.AssistantToolsFunction' + OpenAI.AssistantToolsCode: + type: object + required: + - type + properties: + type: + type: string + enum: + - code_interpreter + description: 'The type of tool being defined: `code_interpreter`' + allOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolDefinition' + OpenAI.AssistantToolsFileSearch: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_search + description: 'The type of tool being defined: `file_search`' + file_search: + type: object + properties: + max_num_results: + type: integer + format: int32 + minimum: 1 + maximum: 50 + description: |- + The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. + + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + ranking_options: + $ref: '#/components/schemas/OpenAI.FileSearchRankingOptions' + description: Overrides for the file search tool. + allOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolDefinition' + OpenAI.AssistantToolsFileSearchTypeOnly: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_search + description: 'The type of tool being defined: `file_search`' + OpenAI.AssistantToolsFunction: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: 'The type of tool being defined: `function`' + function: + $ref: '#/components/schemas/OpenAI.FunctionObject' + allOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolDefinition' + OpenAI.ChatCompletionFunctionCallOption: + type: object + required: + - name + properties: + name: + type: string + description: The name of the function to call. + description: 'Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.' + OpenAI.ChatCompletionFunctions: + type: object + required: + - name + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + parameters: + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + deprecated: true + OpenAI.ChatCompletionMessageAudioChunk: + type: object + properties: + id: + type: string + transcript: + type: string + data: + type: string + format: base64 + expires_at: + type: integer + format: unixtime + OpenAI.ChatCompletionMessageToolCall: + type: object + required: + - id + - type + - function + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + required: + - name + - arguments + description: The function that the model called. + OpenAI.ChatCompletionMessageToolCallChunk: + type: object + required: + - index + properties: + index: + type: integer + format: int32 + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + OpenAI.ChatCompletionNamedToolChoice: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + description: Specifies a tool the model should use. Use to force the model to call a specific function. + OpenAI.ChatCompletionRequestAssistantMessage: + type: object + required: + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessageContentPart' + nullable: true + description: The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. + x-oaiExpandable: true + refusal: + type: string + nullable: true + description: The refusal message by the assistant. + role: + type: string + enum: + - assistant + description: The role of the messages author, in this case `assistant`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + audio: + type: object + properties: + id: + type: string + description: Unique identifier for a previous audio response from the model. + required: + - id + nullable: true + description: |- + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + x-oaiExpandable: true + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + required: + - name + - arguments + nullable: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: Messages sent by the model in response to user messages. + OpenAI.ChatCompletionRequestAssistantMessageContentPart: + anyOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartRefusal' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestDeveloperMessage: + type: object + required: + - content + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + description: The contents of the developer message. + role: + type: string + enum: + - developer + description: The role of the messages author, in this case `developer`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, `developer` messages + replace the previous `system` messages. + OpenAI.ChatCompletionRequestFunctionMessage: + type: object + required: + - role + - content + - name + properties: + role: + type: string + enum: + - function + description: The role of the messages author, in this case `function`. + content: + type: string + nullable: true + description: The contents of the function message. + name: + type: string + description: The name of the function to call. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + deprecated: true + OpenAI.ChatCompletionRequestMessage: + type: object + required: + - role + properties: + role: + type: string + description: The role of the author of this message. + discriminator: + propertyName: role + mapping: + system: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessage' + developer: '#/components/schemas/OpenAI.ChatCompletionRequestDeveloperMessage' + user: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessage' + assistant: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessage' + tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' + function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestMessageContentPartAudio: + type: object + required: + - type + - input_audio + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + format: base64 + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + description: Learn about [audio inputs](/docs/guides/audio). + OpenAI.ChatCompletionRequestMessageContentPartImage: + type: object + required: + - type + - image_url + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + image_url: + type: object + properties: + url: + type: string + format: uri + description: Either a URL of the image or the base64 encoded image data. + detail: + type: string + enum: + - auto + - low + - high + description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). + default: auto + required: + - url + description: Learn about [image inputs](/docs/guides/vision). + OpenAI.ChatCompletionRequestMessageContentPartRefusal: + type: object + required: + - type + - refusal + properties: + type: + type: string + enum: + - refusal + description: The type of the content part. + refusal: + type: string + description: The refusal message generated by the model. + OpenAI.ChatCompletionRequestMessageContentPartText: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: The type of the content part. + text: + type: string + description: The text content. + description: Learn about [text inputs](/docs/guides/text-generation). + OpenAI.ChatCompletionRequestSystemMessage: + type: object + required: + - content + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessageContentPart' + description: The contents of the system message. + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. + OpenAI.ChatCompletionRequestSystemMessageContentPart: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestToolMessage: + type: object + required: + - role + - content + - tool_call_id + properties: + role: + type: string + enum: + - tool + description: The role of the messages author, in this case `tool`. + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessageContentPart' + description: The contents of the tool message. + tool_call_id: + type: string + description: Tool call that this message is responding to. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + OpenAI.ChatCompletionRequestToolMessageContentPart: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestUserMessage: + type: object + required: + - content + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessageContentPart' + description: The contents of the user message. + x-oaiExpandable: true + role: + type: string + enum: + - user + description: The role of the messages author, in this case `user`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Messages sent by an end user, containing prompts or additional context + information. + OpenAI.ChatCompletionRequestUserMessageContentPart: + anyOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartAudio' + x-oaiExpandable: true + OpenAI.ChatCompletionResponseMessage: + type: object + required: + - content + - refusal + - role + properties: + content: + type: string + nullable: true + description: The contents of the message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' + role: + type: string + enum: + - assistant + description: The role of the author of this message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + required: + - name + - arguments + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + audio: + type: object + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: |- + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + format: base64 + description: |- + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + required: + - id + - expires_at + - data + - transcript + nullable: true + description: |- + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). + x-oaiExpandable: true + description: A chat completion message generated by the model. + OpenAI.ChatCompletionStreamOptions: + type: object + properties: + include_usage: + type: boolean + description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' + description: 'Options for streaming response. Only set this when you set `stream: true`.' + OpenAI.ChatCompletionTokenLogprob: + type: object + required: + - token + - logprob + - bytes + - top_logprobs + properties: + token: + type: string + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 + nullable: true + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + top_logprobs: + type: array + items: + type: object + properties: + token: + type: string + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 + nullable: true + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + required: + - token + - logprob + - bytes + description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. + OpenAI.ChatCompletionTool: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: '#/components/schemas/OpenAI.FunctionObject' + OpenAI.ChatCompletionToolChoiceOption: + anyOf: + - type: string + enum: + - none + - auto + - required + - $ref: '#/components/schemas/OpenAI.ChatCompletionNamedToolChoice' + description: |- + Controls which (if any) tool is called by the model. + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + + `none` is the default when no tools are present. `auto` is the default if tools are present. + x-oaiExpandable: true + OpenAI.ChatResponseFormat: + type: object + required: + - type + properties: + type: + type: string + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/OpenAI.ChatResponseFormatText' + json_object: '#/components/schemas/OpenAI.ChatResponseFormatJsonObject' + json_schema: '#/components/schemas/OpenAI.ChatResponseFormatJsonSchema' + OpenAI.ChatResponseFormatJsonObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - json_object + description: 'The type of response format being defined: `json_object`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.ChatResponseFormatJsonSchema: + type: object + required: + - type + - json_schema + properties: + type: + type: string + enum: + - json_schema + description: 'The type of response format being defined: `json_schema`' + json_schema: + type: object + properties: + description: + type: string + description: A description of what the response format is for, used by the model to determine how to respond in the format. + name: + type: string + description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/OpenAI.ResponseFormatJsonSchemaSchema' + strict: + type: boolean + nullable: true + description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](/docs/guides/structured-outputs). + default: false + required: + - name + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.ChatResponseFormatText: + type: object + required: + - type + properties: + type: + type: string + enum: + - text + description: 'The type of response format being defined: `text`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.CompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int32 + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + format: int32 + description: Number of tokens in the prompt. + total_tokens: + type: integer + format: int32 + description: Total number of tokens used in the request (prompt + completion). + completion_tokens_details: + type: object + properties: + accepted_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. + audio_tokens: + type: integer + format: int32 + description: Audio input tokens generated by the model. + reasoning_tokens: + type: integer + format: int32 + description: Tokens generated by the model for reasoning. + rejected_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that did not appear in the completion. However, like + reasoning tokens, these tokens are still counted in the total + completion tokens for purposes of billing, output, and context window + limits. + description: Breakdown of tokens used in a completion. + prompt_tokens_details: + type: object + properties: + audio_tokens: + type: integer + format: int32 + description: Audio input tokens present in the prompt. + cached_tokens: + type: integer + format: int32 + description: Cached tokens present in the prompt. + description: Breakdown of tokens used in the prompt. + description: Usage statistics for the completion request. + OpenAI.CreateImageRequest: + type: object + required: + - prompt + properties: + prompt: + type: string + description: A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + - dall-e-3 + nullable: true + description: The model to use for image generation. + x-oaiTypeLabel: string + default: dall-e-2 + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 10 + description: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. + default: 1 + quality: + type: string + enum: + - standard + - hd + description: The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. + default: standard + response_format: + type: string + enum: + - url + - b64_json + nullable: true + description: The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. + default: url + size: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + - 1792x1024 + - 1024x1792 + nullable: true + description: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. + default: 1024x1024 + style: + type: string + enum: + - vivid + - natural + nullable: true + description: The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`. + default: vivid + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + OpenAI.CreateMessageRequest: + type: object + required: + - role + - content + properties: + role: + type: string + enum: + - user + - assistant + description: |- + The role of the entity that is creating the message. Allowed values include: + - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.MessageContent' + x-oaiExpandable: true + attachments: + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + required: + - file_id + - tools + nullable: true + description: A list of files attached to the message, and the tools they should be added to. + metadata: + type: object + additionalProperties: + type: string + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + x-oaiTypeLabel: map + OpenAI.Error: + type: object + required: + - code + - message + - param + - type + properties: + code: + type: string + nullable: true + message: + type: string + param: + type: string + nullable: true + type: + type: string + OpenAI.ErrorResponse: + type: object + required: + - error + properties: + error: + $ref: '#/components/schemas/OpenAI.Error' + OpenAI.FileSearchRankingOptions: + type: object + required: + - score_threshold + properties: + ranker: + type: string + enum: + - auto + - default_2024_08_21 + description: The ranker to use for the file search. If not specified will use the `auto` ranker. + score_threshold: + type: number + format: float + minimum: 0 + maximum: 1 + description: The score threshold for the file search. All values must be a floating point number between 0 and 1. + description: |- + The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + OpenAI.FunctionObject: + type: object + required: + - name + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + parameters: + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + strict: + type: boolean + nullable: true + description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). + default: false + OpenAI.Image: + type: object + properties: + b64_json: + type: string + format: base64 + description: The base64-encoded JSON of the generated image, if `response_format` is `b64_json`. + url: + type: string + format: uri + description: The URL of the generated image, if `response_format` is `url` (default). + revised_prompt: + type: string + description: The prompt that was used to generate the image, if there was any revision to the prompt. + description: Represents the url or the content of an image generated by the OpenAI API. + OpenAI.ImagesResponse: + type: object + required: + - created + - data + properties: + created: + type: integer + format: unixtime + data: + type: array + items: + $ref: '#/components/schemas/OpenAI.Image' + OpenAI.MessageContent: + type: object + description: Represents a single piece of content in an Assistants API message. + OpenAI.MessageContentImageFileObject: + type: object + required: + - type + - image_file + properties: + type: + type: string + enum: + - image_file + description: Always `image_file`. + image_file: + type: object + properties: + file_id: + type: string + description: The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + detail: + type: string + enum: + - auto + - low + - high + description: Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + default: auto + required: + - file_id + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: References an image [File](/docs/api-reference/files) in the content of a message. + OpenAI.MessageContentImageUrlObject: + type: object + required: + - type + - image_url + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + image_url: + type: object + properties: + url: + type: string + format: uri + description: 'The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.' + detail: + type: string + enum: + - auto + - low + - high + description: Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + default: auto + required: + - url + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: References an image URL in the content of a message. + OpenAI.MessageContentRefusalObject: + type: object + required: + - type + - refusal + properties: + type: + type: string + enum: + - refusal + description: Always `refusal`. + refusal: + type: string + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: The refusal content generated by the assistant. + OpenAI.MessageContentTextAnnotationsFileCitationObject: + type: object + required: + - type + - text + - file_citation + - start_index + - end_index + properties: + type: + type: string + enum: + - file_citation + description: Always `file_citation`. + text: + type: string + description: The text in the message content that needs to be replaced. + file_citation: + type: object + properties: + file_id: + type: string + description: The ID of the specific File the citation is from. + required: + - file_id + start_index: + type: integer + format: int32 + minimum: 0 + end_index: + type: integer + format: int32 + minimum: 0 + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContentTextObjectAnnotation' + description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. + OpenAI.MessageContentTextAnnotationsFilePathObject: + type: object + required: + - type + - text + - file_path + - start_index + - end_index + properties: + type: + type: string + enum: + - file_path + description: Always `file_path`. + text: + type: string + description: The text in the message content that needs to be replaced. + file_path: + type: object + properties: + file_id: + type: string + description: The ID of the file that was generated. + required: + - file_id + start_index: + type: integer + format: int32 + minimum: 0 + end_index: + type: integer + format: int32 + minimum: 0 + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContentTextObjectAnnotation' + description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. + OpenAI.MessageContentTextObject: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: Always `text`. + text: + type: object + properties: + value: + type: string + description: The data that makes up the text. + annotations: + type: array + items: + $ref: '#/components/schemas/OpenAI.MessageContentTextObjectAnnotation' + x-oaiExpandable: true + required: + - value + - annotations + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: The text content that is part of a message. + OpenAI.MessageContentTextObjectAnnotation: + type: object + required: + - type + properties: + type: + type: string + description: The discriminated type identifier for the content item. + discriminator: + propertyName: type + mapping: + file_citation: '#/components/schemas/OpenAI.MessageContentTextAnnotationsFileCitationObject' + file_path: '#/components/schemas/OpenAI.MessageContentTextAnnotationsFilePathObject' + OpenAI.MessageObject: + type: object + required: + - id + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - assistant_id + - run_id + - attachments + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message + description: The object type, which is always `thread.message`. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the message was created. + thread_id: + type: string + description: The [thread](/docs/api-reference/threads) ID that this message belongs to. + status: + type: string + enum: + - in_progress + - incomplete + - completed + description: The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + incomplete_details: + type: object + properties: + reason: + type: string + enum: + - content_filter + - max_tokens + - run_cancelled + - run_expired + - run_failed + description: The reason the message is incomplete. + required: + - reason + nullable: true + description: On an incomplete message, details about why the message is incomplete. + completed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was completed. + incomplete_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was marked as incomplete. + role: + type: string + enum: + - user + - assistant + description: The entity that produced the message. One of `user` or `assistant`. + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.MessageContent' + description: The content of the message in array of text and/or images. + x-oaiExpandable: true + readOnly: true + assistant_id: + type: string + nullable: true + description: If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. + run_id: + type: string + nullable: true + description: The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. + attachments: + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + nullable: true + description: A list of files attached to the message, and the tools they were added to. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + x-oaiTypeLabel: map + readOnly: true + description: Represents a message within a [thread](/docs/api-reference/threads). + OpenAI.MessageRequestContentTextObject: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: Always `text`. + text: + type: string + description: Text content to be sent to the model + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: The text content that is part of a message. + OpenAI.ParallelToolCalls: + type: boolean + description: Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use. + OpenAI.ResponseFormatJsonSchemaSchema: + type: object + additionalProperties: {} + description: The schema for the response format, described as a JSON Schema object. + PineconeChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - pinecone + description: The discriminated type identifier, which is always 'pinecone'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + environment: + type: string + description: The environment name to use with Pinecone. + index_name: + type: string + description: The name of the Pinecone database index to use. + authentication: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' + description: |- + The authentication mechanism to use with Pinecone. + Supported authentication mechanisms for Pinecone include: API key. + embedding_dependency: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + The vectorization source to use as an embedding dependency for the Pinecone data source. + Supported vectorization sources for Pinecone include: deployment name. + fields_mapping: + type: object + properties: + content_fields: + type: array + items: + type: string + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields_separator: + type: string + required: + - content_fields + description: |- + Field mappings to apply to data used by the Pinecone data source. + Note that content field mappings are required for Pinecone. + required: + - environment + - index_name + - authentication + - embedding_dependency + - fields_mapping + description: The parameter information to control the use of the Pinecone data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: api-key + OAuth2Auth: + type: oauth2 + flows: + implicit: + authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize + scopes: + https://cognitiveservices.azure.com/.default: '' +servers: + - url: '{endpoint}/openai' + description: Azure OpenAI APIs for completions and search + variables: + endpoint: + default: '' + description: |- + Supported Cognitive Services endpoints (protocol and hostname, for example: + https://westus.api.cognitive.microsoft.com). diff --git a/.openapi3.azure/openapi3-azure-openai-2025-01-01-preview-generated.yaml b/.openapi3.azure/openapi3-azure-openai-2025-01-01-preview-generated.yaml new file mode 100644 index 000000000..dd9474ca1 --- /dev/null +++ b/.openapi3.azure/openapi3-azure-openai-2025-01-01-preview-generated.yaml @@ -0,0 +1,3309 @@ +openapi: 3.0.0 +info: + title: Azure OpenAI Service + version: 2025-01-01-preview +tags: + - name: Chat + - name: Images + - name: Assistants +paths: + /deployments/{deploymentId}/images/generations: + post: + operationId: ImageGenerations_Create + parameters: + - name: deploymentId + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/OpenAI.ImagesResponse' + - $ref: '#/components/schemas/AzureOpenAIDalleErrorResponse' + tags: + - Images + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.CreateImageRequest' + /threads/{thread_id}/messages: + post: + operationId: createMessage + summary: Create a message. + parameters: + - name: thread_id + in: path + required: true + description: The ID of the [thread](/docs/api-reference/threads) to create a message for. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.MessageObject' + default: + description: An unexpected error response. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.ErrorResponse' + tags: + - Assistants + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAI.CreateMessageRequest' + /{deployment_id}/chat/completions: + post: + operationId: createChatCompletion + parameters: + - name: deployment_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/AzureCreateChatCompletionResponse' + - type: array + items: + $ref: '#/components/schemas/AzureChatCompletionStreamResponseDelta' + - $ref: '#/components/schemas/AzureOpenAIChatErrorResponse' + tags: + - Chat + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AzureCreateChatCompletionRequest' +security: + - ApiKeyAuth: [] + - OAuth2Auth: + - https://cognitiveservices.azure.com/.default +components: + schemas: + AzureChatCompletionStreamResponseDelta: + type: object + properties: + audio: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionMessageAudioChunk' + description: Response audio associated with the streaming chat delta payload. + content: + type: string + nullable: true + description: The contents of the chunk message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. + context: + allOf: + - $ref: '#/components/schemas/AzureChatMessageContext' + description: The Azure-specific context information associated with the chat completion response message. + description: |- + The extended response model for a streaming chat response message on the Azure OpenAI service. + This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other + information related to retrieval-augmented generation performed. + AzureChatDataSource: + type: object + required: + - type + properties: + type: + type: string + description: The differentiating type identifier for the data source. + discriminator: + propertyName: type + mapping: + azure_search: '#/components/schemas/AzureSearchChatDataSource' + azure_cosmos_db: '#/components/schemas/AzureCosmosDBChatDataSource' + elasticsearch: '#/components/schemas/ElasticsearchChatDataSource' + pinecone: '#/components/schemas/PineconeChatDataSource' + mongo_db: '#/components/schemas/MongoDBChatDataSource' + description: |- + A representation of configuration data for a single Azure OpenAI chat data source. + This will be used by a chat completions request that should use Azure OpenAI chat extensions to augment the + response behavior. + The use of this configuration is compatible only with Azure OpenAI. + AzureChatDataSourceAccessTokenAuthenticationOptions: + type: object + required: + - type + - access_token + properties: + type: + type: string + enum: + - access_token + access_token: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceApiKeyAuthenticationOptions: + type: object + required: + - type + - key + properties: + type: + type: string + enum: + - api_key + key: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceAuthenticationOptions: + type: object + required: + - type + properties: + type: + type: string + discriminator: + propertyName: type + mapping: + connection_string: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' + system_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' + user_assigned_managed_identity: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' + key_and_key_id: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' + encoded_api_key: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' + access_token: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' + username_and_password: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' + AzureChatDataSourceConnectionStringAuthenticationOptions: + type: object + required: + - type + - connection_string + properties: + type: + type: string + enum: + - connection_string + connection_string: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceDeploymentNameVectorizationSource: + type: object + required: + - type + - deployment_name + properties: + type: + type: string + enum: + - deployment_name + description: The type identifier, always 'deployment_name' for this vectorization source type. + deployment_name: + type: string + description: |- + The embedding model deployment to use for vectorization. This deployment must exist within the same Azure OpenAI + resource as the model deployment being used for chat completions. + dimensions: + type: integer + format: int32 + description: |- + The number of dimensions to request on embeddings. + Only supported in 'text-embedding-3' and later models. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + Represents a vectorization source that makes internal service calls against an Azure OpenAI embedding model + deployment. In contrast with the endpoint-based vectorization source, a deployment-name-based vectorization source + must be part of the same Azure OpenAI resource but can be used even in private networks. + AzureChatDataSourceEncodedApiKeyAuthenticationOptions: + type: object + required: + - type + - encoded_api_key + properties: + type: + type: string + enum: + - encoded_api_key + encoded_api_key: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceEndpointVectorizationSource: + type: object + required: + - type + - endpoint + - authentication + properties: + type: + type: string + enum: + - endpoint + description: The type identifier, always 'endpoint' for this vectorization source type. + endpoint: + type: string + format: uri + description: |- + Specifies the resource endpoint URL from which embeddings should be retrieved. + It should be in the format of: + https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. + The api-version query parameter is not allowed. + authentication: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' + description: |- + The authentication mechanism to use with the endpoint-based vectorization source. + Endpoint authentication supports API key and access token mechanisms. + dimensions: + type: integer + format: int32 + description: |- + The number of dimensions to request on embeddings. + Only supported in 'text-embedding-3' and later models. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: Represents a vectorization source that makes public service calls against an Azure OpenAI embedding model deployment. + AzureChatDataSourceIntegratedVectorizationSource: + type: object + required: + - type + properties: + type: + type: string + enum: + - integrated + description: The type identifier, always 'integrated' for this vectorization source type. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: Represents an integrated vectorization source as defined within the supporting search resource. + AzureChatDataSourceKeyAndKeyIdAuthenticationOptions: + type: object + required: + - type + - key + - key_id + properties: + type: + type: string + enum: + - key_and_key_id + key: + type: string + key_id: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceModelIdVectorizationSource: + type: object + required: + - type + - model_id + properties: + type: + type: string + enum: + - model_id + description: The type identifier, always 'model_id' for this vectorization source type. + model_id: + type: string + description: The embedding model build ID to use for vectorization. + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + Represents a vectorization source that makes service calls based on a search service model ID. + This source type is currently only supported by Elasticsearch. + AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions: + type: object + required: + - type + properties: + type: + type: string + enum: + - system_assigned_managed_identity + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions: + type: object + required: + - type + - managed_identity_resource_id + properties: + type: + type: string + enum: + - user_assigned_managed_identity + managed_identity_resource_id: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceUsernameAndPasswordAuthenticationOptions: + type: object + required: + - type + - username + - password + properties: + type: + type: string + enum: + - username_and_password + username: + type: string + password: + type: string + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceAuthenticationOptions' + AzureChatDataSourceVectorizationSource: + type: object + required: + - type + properties: + type: + type: string + description: The differentiating identifier for the concrete vectorization source. + discriminator: + propertyName: type + mapping: + endpoint: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' + deployment_name: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' + model_id: '#/components/schemas/AzureChatDataSourceModelIdVectorizationSource' + integrated: '#/components/schemas/AzureChatDataSourceIntegratedVectorizationSource' + description: A representation of a data vectorization source usable as an embedding resource with a data source. + AzureChatMessageContext: + type: object + properties: + intent: + type: string + description: The detected intent from the chat history, which is used to carry conversation context between interactions + citations: + type: array + items: + type: object + properties: + content: + type: string + description: The content of the citation. + title: + type: string + description: The title for the citation. + url: + type: string + description: The URL of the citation. + filepath: + type: string + description: The file path for the citation. + chunk_id: + type: string + description: The chunk ID for the citation. + rerank_score: + type: number + format: double + description: The rerank score for the retrieval. + required: + - content + description: The citations produced by the data retrieval. + all_retrieved_documents: + type: object + properties: + content: + type: string + description: The content of the citation. + title: + type: string + description: The title for the citation. + url: + type: string + description: The URL of the citation. + filepath: + type: string + description: The file path for the citation. + chunk_id: + type: string + description: The chunk ID for the citation. + rerank_score: + type: number + format: double + description: The rerank score for the retrieval. + search_queries: + type: array + items: + type: string + description: The search queries executed to retrieve documents. + data_source_index: + type: integer + format: int32 + description: The index of the data source used for retrieval. + original_search_score: + type: number + format: double + description: The original search score for the retrieval. + filter_reason: + type: string + enum: + - score + - rerank + description: If applicable, an indication of why the document was filtered. + required: + - content + - search_queries + - data_source_index + description: Summary information about documents retrieved by the data retrieval operation. + description: |- + An additional property, added to chat completion response messages, produced by the Azure OpenAI service when using + extension behavior. This includes intent and citation information from the On Your Data feature. + AzureContentFilterBlocklistResult: + type: object + required: + - filtered + properties: + filtered: + type: boolean + description: A value indicating whether any of the detailed blocklists resulted in a filtering action. + details: + type: array + items: + type: object + properties: + filtered: + type: boolean + description: A value indicating whether the blocklist produced a filtering action. + id: + type: string + description: The ID of the custom blocklist evaluated. + required: + - filtered + - id + description: The pairs of individual blocklist IDs and whether they resulted in a filtering action. + description: A collection of true/false filtering results for configured custom blocklists. + AzureContentFilterCompletionTextSpan: + type: object + required: + - completion_start_offset + - completion_end_offset + properties: + completion_start_offset: + type: integer + format: int32 + description: Offset of the UTF32 code point which begins the span. + completion_end_offset: + type: integer + format: int32 + description: Offset of the first UTF32 code point which is excluded from the span. This field is always equal to completion_start_offset for empty spans. This field is always larger than completion_start_offset for non-empty spans. + description: A representation of a span of completion text as used by Azure OpenAI content filter results. + AzureContentFilterCompletionTextSpanDetectionResult: + type: object + required: + - filtered + - detected + - details + properties: + filtered: + type: boolean + description: Whether the content detection resulted in a content filtering action. + detected: + type: boolean + description: Whether the labeled content category was detected in the content. + details: + type: array + items: + $ref: '#/components/schemas/AzureContentFilterCompletionTextSpan' + description: Detailed information about the detected completion text spans. + AzureContentFilterDetectionResult: + type: object + required: + - filtered + - detected + properties: + filtered: + type: boolean + description: Whether the content detection resulted in a content filtering action. + detected: + type: boolean + description: Whether the labeled content category was detected in the content. + description: |- + A labeled content filter result item that indicates whether the content was detected and whether the content was + filtered. + AzureContentFilterImagePromptResults: + type: object + required: + - jailbreak + properties: + profanity: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that identifies whether crude, vulgar, or otherwise objection language is present in the + content. + custom_blocklists: + allOf: + - $ref: '#/components/schemas/AzureContentFilterBlocklistResult' + description: A collection of binary filtering outcomes for configured custom blocklists. + jailbreak: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that describes user prompt injection attacks, where malicious users deliberately exploit + system vulnerabilities to elicit unauthorized behavior from the LLM. This could lead to inappropriate content + generation or violations of system-imposed restrictions. + allOf: + - $ref: '#/components/schemas/AzureContentFilterImageResponseResults' + description: A content filter result for an image generation operation's input request content. + AzureContentFilterImageResponseResults: + type: object + properties: + sexual: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to anatomical organs and genitals, romantic relationships, acts + portrayed in erotic or affectionate terms, pregnancy, physical sexual acts, including those portrayed as an + assault or a forced sexual violent act against one's will, prostitution, pornography, and abuse. + violence: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to physical actions intended to hurt, injure, damage, or kill + someone or something; describes weapons, guns and related entities, such as manufactures, associations, + legislation, and so on. + hate: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that can refer to any content that attacks or uses pejorative or discriminatory + language with reference to a person or identity group based on certain differentiating attributes of these groups + including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, + religion, immigration status, ability status, personal appearance, and body size. + self_harm: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that describes language related to physical actions intended to purposely hurt, injure, + damage one's body or kill oneself. + description: A content filter result for an image generation operation's output response content. + AzureContentFilterResultForChoice: + type: object + properties: + sexual: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to anatomical organs and genitals, romantic relationships, acts + portrayed in erotic or affectionate terms, pregnancy, physical sexual acts, including those portrayed as an + assault or a forced sexual violent act against one's will, prostitution, pornography, and abuse. + hate: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that can refer to any content that attacks or uses pejorative or discriminatory + language with reference to a person or identity group based on certain differentiating attributes of these groups + including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, + religion, immigration status, ability status, personal appearance, and body size. + violence: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to physical actions intended to hurt, injure, damage, or kill + someone or something; describes weapons, guns and related entities, such as manufactures, associations, + legislation, and so on. + self_harm: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that describes language related to physical actions intended to purposely hurt, injure, + damage one's body or kill oneself. + profanity: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that identifies whether crude, vulgar, or otherwise objection language is present in the + content. + custom_blocklists: + allOf: + - $ref: '#/components/schemas/AzureContentFilterBlocklistResult' + description: A collection of binary filtering outcomes for configured custom blocklists. + error: + type: object + properties: + code: + type: integer + format: int32 + description: A distinct, machine-readable code associated with the error. + message: + type: string + description: A human-readable message associated with the error. + required: + - code + - message + description: If present, details about an error that prevented content filtering from completing its evaluation. + protected_material_text: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: A detection result that describes a match against text protected under copyright or other status. + protected_material_code: + type: object + properties: + filtered: + type: boolean + description: Whether the content detection resulted in a content filtering action. + detected: + type: boolean + description: Whether the labeled content category was detected in the content. + citation: + type: object + properties: + license: + type: string + description: The name or identifier of the license associated with the detection. + URL: + type: string + format: uri + description: The URL associated with the license. + description: If available, the citation details describing the associated license and its location. + required: + - filtered + - detected + description: A detection result that describes a match against licensed code or other protected source material. + ungrounded_material: + $ref: '#/components/schemas/AzureContentFilterCompletionTextSpanDetectionResult' + description: A content filter result for a single response item produced by a generative AI system. + AzureContentFilterResultForPrompt: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt associated with the accompanying content filter result categories. + content_filter_results: + type: object + properties: + sexual: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to anatomical organs and genitals, romantic relationships, acts + portrayed in erotic or affectionate terms, pregnancy, physical sexual acts, including those portrayed as an + assault or a forced sexual violent act against one's will, prostitution, pornography, and abuse. + hate: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that can refer to any content that attacks or uses pejorative or discriminatory + language with reference to a person or identity group based on certain differentiating attributes of these groups + including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, + religion, immigration status, ability status, personal appearance, and body size. + violence: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category for language related to physical actions intended to hurt, injure, damage, or kill + someone or something; describes weapons, guns and related entities, such as manufactures, associations, + legislation, and so on. + self_harm: + allOf: + - $ref: '#/components/schemas/AzureContentFilterSeverityResult' + description: |- + A content filter category that describes language related to physical actions intended to purposely hurt, injure, + damage one's body or kill oneself. + profanity: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that identifies whether crude, vulgar, or otherwise objection language is present in the + content. + custom_blocklists: + allOf: + - $ref: '#/components/schemas/AzureContentFilterBlocklistResult' + description: A collection of binary filtering outcomes for configured custom blocklists. + error: + type: object + properties: + code: + type: integer + format: int32 + description: A distinct, machine-readable code associated with the error. + message: + type: string + description: A human-readable message associated with the error. + required: + - code + - message + description: If present, details about an error that prevented content filtering from completing its evaluation. + jailbreak: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that describes user prompt injection attacks, where malicious users deliberately exploit + system vulnerabilities to elicit unauthorized behavior from the LLM. This could lead to inappropriate content + generation or violations of system-imposed restrictions. + indirect_attack: + allOf: + - $ref: '#/components/schemas/AzureContentFilterDetectionResult' + description: |- + A detection result that describes attacks on systems powered by Generative AI models that can happen every time + an application processes information that wasn’t directly authored by either the developer of the application or + the user. + required: + - jailbreak + - indirect_attack + description: The content filter category details for the result. + description: A content filter result associated with a single input prompt item into a generative AI system. + AzureContentFilterSeverityResult: + type: object + required: + - filtered + - severity + properties: + filtered: + type: boolean + description: Whether the content severity resulted in a content filtering action. + severity: + type: string + enum: + - safe + - low + - medium + - high + description: The labeled severity of the content. + description: |- + A labeled content filter result item that indicates whether the content was filtered and what the qualitative + severity level of the content was, as evaluated against content filter configuration for the category. + AzureCosmosDBChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - azure_cosmos_db + description: The discriminated type identifier, which is always 'azure_cosmos_db'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + container_name: + type: string + database_name: + type: string + embedding_dependency: + $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + index_name: + type: string + authentication: + $ref: '#/components/schemas/AzureChatDataSourceConnectionStringAuthenticationOptions' + fields_mapping: + type: object + properties: + content_fields: + type: array + items: + type: string + vector_fields: + type: array + items: + type: string + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields_separator: + type: string + required: + - content_fields + - vector_fields + required: + - container_name + - database_name + - embedding_dependency + - index_name + - authentication + - fields_mapping + description: The parameter information to control the use of the Azure CosmosDB data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + description: Represents a data source configuration that will use an Azure CosmosDB resource. + AzureCreateChatCompletionRequest: + type: object + required: + - messages + properties: + messages: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + minItems: 1 + description: |- + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + store: + type: boolean + nullable: true + description: |- + Whether or not to store the output of this chat completion request for + use in our [model distillation](/docs/guides/distillation) or + [evals](/docs/guides/evals) products. + default: false + reasoning_effort: + type: string + enum: + - low + - medium + - high + description: |- + **o1 models only** + + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `low`, `medium`, and `high`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + default: medium + metadata: + type: object + additionalProperties: + type: string + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + x-oaiTypeLabel: map + frequency_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + default: 0 + logit_bias: + type: object + additionalProperties: + type: integer + format: int32 + nullable: true + description: |- + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + x-oaiTypeLabel: map + default: null + logprobs: + type: boolean + nullable: true + description: |- + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + default: false + top_logprobs: + type: integer + format: int32 + nullable: true + minimum: 0 + maximum: 20 + description: |- + An integer between 0 and 20 specifying the number of most likely tokens to + return at each token position, each with an associated log probability. + `logprobs` must be set to `true` if this parameter is used. + max_tokens: + type: integer + format: int32 + nullable: true + description: |- + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o1 series models](/docs/guides/reasoning). + deprecated: true + max_completion_tokens: + type: integer + format: int32 + nullable: true + description: An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning). + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 128 + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + default: 1 + modalities: + type: object + allOf: + - $ref: '#/components/schemas/ChatCompletionModalities' + nullable: true + prediction: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatOutputPrediction' + nullable: true + description: |- + Configuration for a [Predicted Output](/docs/guides/predicted-outputs), + which can greatly improve response times when large parts of the model + response are known ahead of time. This is most common when you are + regenerating a file with only minor changes to most of the content. + x-oaiExpandable: true + audio: + type: object + properties: + voice: + type: string + enum: + - alloy + - ash + - ballad + - coral + - echo + - sage + - shimmer + - verse + description: The voice the model uses to respond. Supported voices are `ash`, `ballad`, `coral`, `sage`, and `verse` (also supported but not recommended are `alloy`, `echo`, and `shimmer`; these voices are less expressive). + format: + type: string + enum: + - wav + - mp3 + - flac + - opus + - pcm16 + description: |- + Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, + `opus`, or `pcm16`. + required: + - voice + - format + nullable: true + description: |- + Parameters for audio output. Required when audio output is requested with + `modalities: ["audio"]`. [Learn more](/docs/guides/audio). + x-oaiExpandable: true + presence_penalty: + type: number + format: float + nullable: true + minimum: -2 + maximum: 2 + description: |- + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + default: 0 + response_format: + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + description: |- + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model + to produce JSON yourself via a system or user message. Without this, the + model may generate an unending stream of whitespace until the generation + reaches the token limit, resulting in a long-running and seemingly "stuck" + request. Also note that the message content may be partially cut off if + `finish_reason="length"`, which indicates the generation exceeded + `max_tokens` or the conversation exceeded the max context length. + x-oaiExpandable: true + seed: + type: integer + format: int64 + nullable: true + description: |- + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + anyOf: + - type: string + - type: array + items: + type: string + nullable: true + description: Up to 4 sequences where the API will stop generating further tokens. + default: null + stream: + type: boolean + nullable: true + description: 'If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).' + default: false + stream_options: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionStreamOptions' + nullable: true + default: null + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + default: 1 + tools: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTool' + description: A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + tool_choice: + $ref: '#/components/schemas/OpenAI.ChatCompletionToolChoiceOption' + parallel_tool_calls: + allOf: + - $ref: '#/components/schemas/OpenAI.ParallelToolCalls' + default: true + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + function_call: + anyOf: + - type: string + enum: + - none + - auto + - $ref: '#/components/schemas/OpenAI.ChatCompletionFunctionCallOption' + description: |- + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + deprecated: true + x-oaiExpandable: true + functions: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionFunctions' + minItems: 1 + maxItems: 128 + description: |- + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + deprecated: true + data_sources: + type: array + items: + $ref: '#/components/schemas/AzureChatDataSource' + description: The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. + user_security_context: + $ref: '#/components/schemas/AzureUserSecurityContext' + description: |- + The extended request model for chat completions against the Azure OpenAI service. + This adds the ability to provide data sources for the On Your Data feature. + AzureCreateChatCompletionResponse: + type: object + required: + - id + - created + - model + - object + - choices + properties: + id: + type: string + description: A unique identifier for the chat completion. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + service_tier: + type: string + enum: + - scale + - default + nullable: true + description: The service tier used for processing the request. + system_fingerprint: + type: string + description: |- + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + enum: + - chat.completion + description: The object type, which is always `chat.completion`. + usage: + $ref: '#/components/schemas/OpenAI.CompletionUsage' + choices: + type: array + items: + $ref: '#/components/schemas/AzureCreateChatCompletionResponseChoice' + prompt_filter_results: + type: array + items: + type: object + properties: + prompt_index: + type: integer + format: int32 + description: The index of the input prompt that this content filter result corresponds to. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter results associated with the indexed input prompt. + required: + - prompt_index + - content_filter_results + description: The Responsible AI content filter annotations associated with prompt inputs into chat completions. + description: |- + The extended top-level chat completion response model for the Azure OpenAI service. + This model adds Responsible AI content filter annotations for prompt input. + AzureCreateChatCompletionResponseChoice: + type: object + required: + - finish_reason + - index + - message + - logprobs + - content_filter_results + properties: + finish_reason: + type: string + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + description: |- + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + index: + type: integer + format: int32 + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/OpenAI.ChatCompletionResponseMessage' + logprobs: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message content tokens with log probability information. + readOnly: true + refusal: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionTokenLogprob' + nullable: true + description: A list of message refusal tokens with log probability information. + readOnly: true + required: + - content + - refusal + nullable: true + description: Log probability information for the choice. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForChoice' + description: The Responsible AI content filter annotations associated with the choice. + AzureImage: + type: object + required: + - prompt_filter_results + - content_filter_results + properties: + prompt_filter_results: + $ref: '#/components/schemas/AzureContentFilterImagePromptResults' + content_filter_results: + $ref: '#/components/schemas/AzureContentFilterImageResponseResults' + allOf: + - $ref: '#/components/schemas/OpenAI.Image' + AzureOpenAIChatError: + type: object + properties: + code: + type: string + description: The distinct, machine-generated identifier for the error. + message: + type: string + description: A human-readable message associated with the error. + param: + type: string + description: If applicable, the request input parameter associated with the error + type: + type: string + description: If applicable, the input line number associated with the error. + inner_error: + type: object + properties: + code: + type: string + enum: + - ResponsibleAIPolicyViolation + description: The code associated with the inner error. + revised_prompt: + type: string + description: If applicable, the modified prompt used for generation. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterResultForPrompt' + description: The content filter result details associated with the inner error. + description: If applicable, an upstream error that originated this error. + description: The structured representation of an error from an Azure OpenAI chat completion request. + AzureOpenAIChatErrorResponse: + type: object + properties: + error: + $ref: '#/components/schemas/AzureOpenAIChatError' + description: A structured representation of an error an Azure OpenAI request. + AzureOpenAIDalleError: + type: object + properties: + code: + type: string + description: The distinct, machine-generated identifier for the error. + message: + type: string + description: A human-readable message associated with the error. + param: + type: string + description: If applicable, the request input parameter associated with the error + type: + type: string + description: If applicable, the input line number associated with the error. + inner_error: + type: object + properties: + code: + type: string + enum: + - ResponsibleAIPolicyViolation + description: The code associated with the inner error. + revised_prompt: + type: string + description: If applicable, the modified prompt used for generation. + content_filter_results: + allOf: + - $ref: '#/components/schemas/AzureContentFilterImagePromptResults' + description: The content filter result details associated with the inner error. + description: If applicable, an upstream error that originated this error. + description: The structured representation of an error from an Azure OpenAI image generation request. + AzureOpenAIDalleErrorResponse: + type: object + properties: + error: + $ref: '#/components/schemas/AzureOpenAIDalleError' + description: A structured representation of an error an Azure OpenAI request. + AzureSearchChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - azure_search + description: The discriminated type identifier, which is always 'azure_search'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + endpoint: + type: string + format: uri + description: The absolute endpoint path for the Azure Search resource to use. + index_name: + type: string + description: The name of the index to use, as specified in the Azure Search resource. + authentication: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceAccessTokenAuthenticationOptions' + description: The authentication mechanism to use with Azure Search. + fields_mapping: + type: object + properties: + title_field: + type: string + description: The name of the index field to use as a title. + url_field: + type: string + description: The name of the index field to use as a URL. + filepath_field: + type: string + description: The name of the index field to use as a filepath. + content_fields: + type: array + items: + type: string + description: The names of index fields that should be treated as content. + content_fields_separator: + type: string + description: The separator pattern that content fields should use. + vector_fields: + type: array + items: + type: string + description: The names of fields that represent vector data. + image_vector_fields: + type: array + items: + type: string + description: The names of fields that represent image vector data. + description: The field mappings to use with the Azure Search resource. + query_type: + type: string + enum: + - simple + - semantic + - vector + - vector_simple_hybrid + - vector_semantic_hybrid + description: The query type for the Azure Search resource to use. + semantic_configuration: + type: string + description: Additional semantic configuration for the query. + filter: + type: string + description: A filter to apply to the search. + embedding_dependency: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + The vectorization source to use with Azure Search. + Supported sources for Azure Search include endpoint, deployment name, and integrated. + required: + - endpoint + - index_name + - authentication + description: The parameter information to control the use of the Azure Search data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + description: Represents a data source configuration that will use an Azure Search resource. + AzureUserSecurityContext: + type: object + properties: + application_name: + type: string + description: The name of the application. Sensitive personal information should not be included in this field. + end_user_id: + type: string + description: This identifier is the Microsoft Entra ID (formerly Azure Active Directory) user object ID used to authenticate end-users within the generative AI application. Sensitive personal information should not be included in this field. + end_user_tenant_id: + type: string + description: The Microsoft 365 tenant ID the end user belongs to. It's required when the generative AI application is multitenant. + source_ip: + type: string + description: Captures the original client's IP address. + description: User security context contains several parameters that describe the application itself, and the end user that interacts with the application. These fields assist your security operations teams to investigate and mitigate security incidents by providing a comprehensive approach to protecting your AI applications. [Learn more](https://aka.ms/TP4AI/Documentation/EndUserContext) about protecting AI applications using Microsoft Defender for Cloud. + ChatCompletionMessageToolCallsItem: + type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionMessageToolCall' + description: The tool calls generated by the model, such as function calls. + ChatCompletionModalities: + type: array + items: + type: string + enum: + - text + - audio + description: |- + Output types that you would like the model to generate for this request. + Most models are capable of generating text, which is the default: + + `["text"]` + + The `gpt-4o-audio-preview` model can also be used to [generate audio](/docs/guides/audio). To + request that this model generate both text and audio responses, you can + use: + + `["text", "audio"]` + ElasticsearchChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - elasticsearch + description: The discriminated type identifier, which is always 'elasticsearch'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + endpoint: + type: string + format: uri + index_name: + type: string + authentication: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceKeyAndKeyIdAuthenticationOptions' + - $ref: '#/components/schemas/AzureChatDataSourceEncodedApiKeyAuthenticationOptions' + fields_mapping: + type: object + properties: + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields: + type: array + items: + type: string + content_fields_separator: + type: string + vector_fields: + type: array + items: + type: string + query_type: + type: string + enum: + - simple + - vector + embedding_dependency: + $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + required: + - endpoint + - index_name + - authentication + description: The parameter information to control the use of the Elasticsearch data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + MongoDBChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - mongo_db + description: The discriminated type identifier, which is always 'mongo_db'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + endpoint: + type: string + description: The name of the MongoDB cluster endpoint. + database_name: + type: string + description: The name of the MongoDB database. + collection_name: + type: string + description: The name of the MongoDB collection. + app_name: + type: string + description: The name of the MongoDB application. + index_name: + type: string + description: The name of the MongoDB index. + authentication: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceUsernameAndPasswordAuthenticationOptions' + description: |- + The authentication mechanism to use with Pinecone. + Supported authentication mechanisms for Pinecone include: username and password. + embedding_dependency: + anyOf: + - $ref: '#/components/schemas/AzureChatDataSourceEndpointVectorizationSource' + - $ref: '#/components/schemas/AzureChatDataSourceDeploymentNameVectorizationSource' + description: |- + The vectorization source to use as an embedding dependency for the MongoDB data source. + Supported vectorization sources for MongoDB include: endpoint, deployment name. + fields_mapping: + type: object + properties: + content_fields: + type: array + items: + type: string + vector_fields: + type: array + items: + type: string + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields_separator: + type: string + required: + - content_fields + - vector_fields + description: |- + Field mappings to apply to data used by the MongoDB data source. + Note that content and vector field mappings are required for MongoDB. + required: + - endpoint + - database_name + - collection_name + - app_name + - index_name + - authentication + - embedding_dependency + - fields_mapping + description: The parameter information to control the use of the MongoDB data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + OpenAI.AssistantToolDefinition: + type: object + required: + - type + properties: + type: + type: string + discriminator: + propertyName: type + mapping: + file_search: '#/components/schemas/OpenAI.AssistantToolsFileSearch' + function: '#/components/schemas/OpenAI.AssistantToolsFunction' + OpenAI.AssistantToolsCode: + type: object + required: + - type + properties: + type: + type: string + enum: + - code_interpreter + description: 'The type of tool being defined: `code_interpreter`' + allOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolDefinition' + OpenAI.AssistantToolsFileSearch: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_search + description: 'The type of tool being defined: `file_search`' + file_search: + type: object + properties: + max_num_results: + type: integer + format: int32 + minimum: 1 + maximum: 50 + description: |- + The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. + + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + ranking_options: + $ref: '#/components/schemas/OpenAI.FileSearchRankingOptions' + description: Overrides for the file search tool. + allOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolDefinition' + OpenAI.AssistantToolsFileSearchTypeOnly: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_search + description: 'The type of tool being defined: `file_search`' + OpenAI.AssistantToolsFunction: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: 'The type of tool being defined: `function`' + function: + $ref: '#/components/schemas/OpenAI.FunctionObject' + allOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolDefinition' + OpenAI.ChatCompletionFunctionCallOption: + type: object + required: + - name + properties: + name: + type: string + description: The name of the function to call. + description: 'Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.' + OpenAI.ChatCompletionFunctions: + type: object + required: + - name + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + parameters: + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + deprecated: true + OpenAI.ChatCompletionMessageAudioChunk: + type: object + properties: + id: + type: string + transcript: + type: string + data: + type: string + format: base64 + expires_at: + type: integer + format: unixtime + OpenAI.ChatCompletionMessageToolCall: + type: object + required: + - id + - type + - function + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + required: + - name + - arguments + description: The function that the model called. + OpenAI.ChatCompletionMessageToolCallChunk: + type: object + required: + - index + properties: + index: + type: integer + format: int32 + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + OpenAI.ChatCompletionNamedToolChoice: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + description: Specifies a tool the model should use. Use to force the model to call a specific function. + OpenAI.ChatCompletionRequestAssistantMessage: + type: object + required: + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessageContentPart' + nullable: true + description: The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. + x-oaiExpandable: true + refusal: + type: string + nullable: true + description: The refusal message by the assistant. + role: + type: string + enum: + - assistant + description: The role of the messages author, in this case `assistant`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + audio: + type: object + properties: + id: + type: string + description: Unique identifier for a previous audio response from the model. + required: + - id + nullable: true + description: |- + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + x-oaiExpandable: true + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + required: + - name + - arguments + nullable: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: Messages sent by the model in response to user messages. + OpenAI.ChatCompletionRequestAssistantMessageContentPart: + anyOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartRefusal' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestDeveloperMessage: + type: object + required: + - content + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + description: The contents of the developer message. + role: + type: string + enum: + - developer + description: The role of the messages author, in this case `developer`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, `developer` messages + replace the previous `system` messages. + OpenAI.ChatCompletionRequestFunctionMessage: + type: object + required: + - role + - content + - name + properties: + role: + type: string + enum: + - function + description: The role of the messages author, in this case `function`. + content: + type: string + nullable: true + description: The contents of the function message. + name: + type: string + description: The name of the function to call. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + deprecated: true + OpenAI.ChatCompletionRequestMessage: + type: object + required: + - role + properties: + role: + type: string + description: The role of the author of this message. + discriminator: + propertyName: role + mapping: + system: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessage' + developer: '#/components/schemas/OpenAI.ChatCompletionRequestDeveloperMessage' + user: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessage' + assistant: '#/components/schemas/OpenAI.ChatCompletionRequestAssistantMessage' + tool: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessage' + function: '#/components/schemas/OpenAI.ChatCompletionRequestFunctionMessage' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestMessageContentPartAudio: + type: object + required: + - type + - input_audio + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + format: base64 + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + description: Learn about [audio inputs](/docs/guides/audio). + OpenAI.ChatCompletionRequestMessageContentPartImage: + type: object + required: + - type + - image_url + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + image_url: + type: object + properties: + url: + type: string + format: uri + description: Either a URL of the image or the base64 encoded image data. + detail: + type: string + enum: + - auto + - low + - high + description: Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). + default: auto + required: + - url + description: Learn about [image inputs](/docs/guides/vision). + OpenAI.ChatCompletionRequestMessageContentPartRefusal: + type: object + required: + - type + - refusal + properties: + type: + type: string + enum: + - refusal + description: The type of the content part. + refusal: + type: string + description: The refusal message generated by the model. + OpenAI.ChatCompletionRequestMessageContentPartText: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: The type of the content part. + text: + type: string + description: The text content. + description: Learn about [text inputs](/docs/guides/text-generation). + OpenAI.ChatCompletionRequestSystemMessage: + type: object + required: + - content + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestSystemMessageContentPart' + description: The contents of the system message. + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. + OpenAI.ChatCompletionRequestSystemMessageContentPart: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestToolMessage: + type: object + required: + - role + - content + - tool_call_id + properties: + role: + type: string + enum: + - tool + description: The role of the messages author, in this case `tool`. + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestToolMessageContentPart' + description: The contents of the tool message. + tool_call_id: + type: string + description: Tool call that this message is responding to. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + OpenAI.ChatCompletionRequestToolMessageContentPart: + type: object + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + x-oaiExpandable: true + OpenAI.ChatCompletionRequestUserMessage: + type: object + required: + - content + - role + properties: + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestUserMessageContentPart' + description: The contents of the user message. + x-oaiExpandable: true + role: + type: string + enum: + - user + description: The role of the messages author, in this case `user`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + allOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessage' + description: |- + Messages sent by an end user, containing prompts or additional context + information. + OpenAI.ChatCompletionRequestUserMessageContentPart: + anyOf: + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartAudio' + x-oaiExpandable: true + OpenAI.ChatCompletionResponseMessage: + type: object + required: + - content + - refusal + - role + properties: + content: + type: string + nullable: true + description: The contents of the message. + refusal: + type: string + nullable: true + description: The refusal message generated by the model. + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCallsItem' + role: + type: string + enum: + - assistant + description: The role of the author of this message. + function_call: + type: object + properties: + name: + type: string + arguments: + type: string + required: + - name + - arguments + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + deprecated: true + audio: + type: object + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: |- + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + format: base64 + description: |- + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + required: + - id + - expires_at + - data + - transcript + nullable: true + description: |- + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). + x-oaiExpandable: true + description: A chat completion message generated by the model. + OpenAI.ChatCompletionStreamOptions: + type: object + properties: + include_usage: + type: boolean + description: 'If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.' + description: 'Options for streaming response. Only set this when you set `stream: true`.' + OpenAI.ChatCompletionTokenLogprob: + type: object + required: + - token + - logprob + - bytes + - top_logprobs + properties: + token: + type: string + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 + nullable: true + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + top_logprobs: + type: array + items: + type: object + properties: + token: + type: string + description: The token. + logprob: + type: number + format: float + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + bytes: + type: array + items: + type: integer + format: int32 + nullable: true + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + required: + - token + - logprob + - bytes + description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. + OpenAI.ChatCompletionTool: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: '#/components/schemas/OpenAI.FunctionObject' + OpenAI.ChatCompletionToolChoiceOption: + anyOf: + - type: string + enum: + - none + - auto + - required + - $ref: '#/components/schemas/OpenAI.ChatCompletionNamedToolChoice' + description: |- + Controls which (if any) tool is called by the model. + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + + `none` is the default when no tools are present. `auto` is the default if tools are present. + x-oaiExpandable: true + OpenAI.ChatOutputPrediction: + type: object + required: + - type + properties: + type: + anyOf: + - type: string + - type: string + enum: + - content + discriminator: + propertyName: type + mapping: + content: '#/components/schemas/OpenAI.ChatOutputPredictionContent' + description: Base representation of predicted output from a model. + OpenAI.ChatOutputPredictionContent: + type: object + required: + - type + - content + properties: + type: + type: string + enum: + - content + description: |- + The type of the predicted content you want to provide. This type is + currently always `content`. + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAI.ChatCompletionRequestMessageContentPartText' + description: |- + The content that should be matched when generating a model response. + If generated tokens would match this content, the entire model response + can be returned much more quickly. + x-oaiExpandable: true + allOf: + - $ref: '#/components/schemas/OpenAI.ChatOutputPrediction' + description: |- + Static predicted output content, such as the content of a text file that is + being regenerated. + OpenAI.ChatResponseFormat: + type: object + required: + - type + properties: + type: + type: string + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/OpenAI.ChatResponseFormatText' + json_object: '#/components/schemas/OpenAI.ChatResponseFormatJsonObject' + json_schema: '#/components/schemas/OpenAI.ChatResponseFormatJsonSchema' + OpenAI.ChatResponseFormatJsonObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - json_object + description: 'The type of response format being defined: `json_object`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.ChatResponseFormatJsonSchema: + type: object + required: + - type + - json_schema + properties: + type: + type: string + enum: + - json_schema + description: 'The type of response format being defined: `json_schema`' + json_schema: + type: object + properties: + description: + type: string + description: A description of what the response format is for, used by the model to determine how to respond in the format. + name: + type: string + description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/OpenAI.ResponseFormatJsonSchemaSchema' + strict: + type: boolean + nullable: true + description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](/docs/guides/structured-outputs). + default: false + required: + - name + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.ChatResponseFormatText: + type: object + required: + - type + properties: + type: + type: string + enum: + - text + description: 'The type of response format being defined: `text`' + allOf: + - $ref: '#/components/schemas/OpenAI.ChatResponseFormat' + OpenAI.CompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int32 + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + format: int32 + description: Number of tokens in the prompt. + total_tokens: + type: integer + format: int32 + description: Total number of tokens used in the request (prompt + completion). + completion_tokens_details: + type: object + properties: + accepted_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. + audio_tokens: + type: integer + format: int32 + description: Audio input tokens generated by the model. + reasoning_tokens: + type: integer + format: int32 + description: Tokens generated by the model for reasoning. + rejected_prediction_tokens: + type: integer + format: int32 + description: |- + When using Predicted Outputs, the number of tokens in the + prediction that did not appear in the completion. However, like + reasoning tokens, these tokens are still counted in the total + completion tokens for purposes of billing, output, and context window + limits. + description: Breakdown of tokens used in a completion. + prompt_tokens_details: + type: object + properties: + audio_tokens: + type: integer + format: int32 + description: Audio input tokens present in the prompt. + cached_tokens: + type: integer + format: int32 + description: Cached tokens present in the prompt. + description: Breakdown of tokens used in the prompt. + description: Usage statistics for the completion request. + OpenAI.CreateImageRequest: + type: object + required: + - prompt + properties: + prompt: + type: string + description: A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + - dall-e-3 + nullable: true + description: The model to use for image generation. + x-oaiTypeLabel: string + default: dall-e-2 + n: + type: integer + format: int32 + nullable: true + minimum: 1 + maximum: 10 + description: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. + default: 1 + quality: + type: string + enum: + - standard + - hd + description: The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. + default: standard + response_format: + type: string + enum: + - url + - b64_json + nullable: true + description: The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. + default: url + size: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + - 1792x1024 + - 1024x1792 + nullable: true + description: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. + default: 1024x1024 + style: + type: string + enum: + - vivid + - natural + nullable: true + description: The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`. + default: vivid + user: + type: string + description: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + OpenAI.CreateMessageRequest: + type: object + required: + - role + - content + properties: + role: + type: string + enum: + - user + - assistant + description: |- + The role of the entity that is creating the message. Allowed values include: + - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.MessageContent' + x-oaiExpandable: true + attachments: + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + required: + - file_id + - tools + nullable: true + description: A list of files attached to the message, and the tools they should be added to. + metadata: + type: object + additionalProperties: + type: string + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + x-oaiTypeLabel: map + OpenAI.Error: + type: object + required: + - code + - message + - param + - type + properties: + code: + type: string + nullable: true + message: + type: string + param: + type: string + nullable: true + type: + type: string + OpenAI.ErrorResponse: + type: object + required: + - error + properties: + error: + $ref: '#/components/schemas/OpenAI.Error' + OpenAI.FileSearchRankingOptions: + type: object + required: + - score_threshold + properties: + ranker: + type: string + enum: + - auto + - default_2024_08_21 + description: The ranker to use for the file search. If not specified will use the `auto` ranker. + score_threshold: + type: number + format: float + minimum: 0 + maximum: 1 + description: The score threshold for the file search. All values must be a floating point number between 0 and 1. + description: |- + The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + OpenAI.FunctionObject: + type: object + required: + - name + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + parameters: + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + strict: + type: boolean + nullable: true + description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). + default: false + OpenAI.Image: + type: object + properties: + b64_json: + type: string + format: base64 + description: The base64-encoded JSON of the generated image, if `response_format` is `b64_json`. + url: + type: string + format: uri + description: The URL of the generated image, if `response_format` is `url` (default). + revised_prompt: + type: string + description: The prompt that was used to generate the image, if there was any revision to the prompt. + description: Represents the url or the content of an image generated by the OpenAI API. + OpenAI.ImagesResponse: + type: object + required: + - created + - data + properties: + created: + type: integer + format: unixtime + data: + type: array + items: + $ref: '#/components/schemas/OpenAI.Image' + OpenAI.MessageContent: + type: object + description: Represents a single piece of content in an Assistants API message. + OpenAI.MessageContentImageFileObject: + type: object + required: + - type + - image_file + properties: + type: + type: string + enum: + - image_file + description: Always `image_file`. + image_file: + type: object + properties: + file_id: + type: string + description: The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + detail: + type: string + enum: + - auto + - low + - high + description: Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + default: auto + required: + - file_id + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: References an image [File](/docs/api-reference/files) in the content of a message. + OpenAI.MessageContentImageUrlObject: + type: object + required: + - type + - image_url + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + image_url: + type: object + properties: + url: + type: string + format: uri + description: 'The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.' + detail: + type: string + enum: + - auto + - low + - high + description: Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + default: auto + required: + - url + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: References an image URL in the content of a message. + OpenAI.MessageContentRefusalObject: + type: object + required: + - type + - refusal + properties: + type: + type: string + enum: + - refusal + description: Always `refusal`. + refusal: + type: string + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: The refusal content generated by the assistant. + OpenAI.MessageContentTextAnnotationsFileCitationObject: + type: object + required: + - type + - text + - file_citation + - start_index + - end_index + properties: + type: + type: string + enum: + - file_citation + description: Always `file_citation`. + text: + type: string + description: The text in the message content that needs to be replaced. + file_citation: + type: object + properties: + file_id: + type: string + description: The ID of the specific File the citation is from. + required: + - file_id + start_index: + type: integer + format: int32 + minimum: 0 + end_index: + type: integer + format: int32 + minimum: 0 + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContentTextObjectAnnotation' + description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. + OpenAI.MessageContentTextAnnotationsFilePathObject: + type: object + required: + - type + - text + - file_path + - start_index + - end_index + properties: + type: + type: string + enum: + - file_path + description: Always `file_path`. + text: + type: string + description: The text in the message content that needs to be replaced. + file_path: + type: object + properties: + file_id: + type: string + description: The ID of the file that was generated. + required: + - file_id + start_index: + type: integer + format: int32 + minimum: 0 + end_index: + type: integer + format: int32 + minimum: 0 + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContentTextObjectAnnotation' + description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. + OpenAI.MessageContentTextObject: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: Always `text`. + text: + type: object + properties: + value: + type: string + description: The data that makes up the text. + annotations: + type: array + items: + $ref: '#/components/schemas/OpenAI.MessageContentTextObjectAnnotation' + x-oaiExpandable: true + required: + - value + - annotations + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: The text content that is part of a message. + OpenAI.MessageContentTextObjectAnnotation: + type: object + required: + - type + properties: + type: + type: string + description: The discriminated type identifier for the content item. + discriminator: + propertyName: type + mapping: + file_citation: '#/components/schemas/OpenAI.MessageContentTextAnnotationsFileCitationObject' + file_path: '#/components/schemas/OpenAI.MessageContentTextAnnotationsFilePathObject' + OpenAI.MessageObject: + type: object + required: + - id + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - assistant_id + - run_id + - attachments + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message + description: The object type, which is always `thread.message`. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the message was created. + thread_id: + type: string + description: The [thread](/docs/api-reference/threads) ID that this message belongs to. + status: + type: string + enum: + - in_progress + - incomplete + - completed + description: The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + incomplete_details: + type: object + properties: + reason: + type: string + enum: + - content_filter + - max_tokens + - run_cancelled + - run_expired + - run_failed + description: The reason the message is incomplete. + required: + - reason + nullable: true + description: On an incomplete message, details about why the message is incomplete. + completed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was completed. + incomplete_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was marked as incomplete. + role: + type: string + enum: + - user + - assistant + description: The entity that produced the message. One of `user` or `assistant`. + content: + type: array + items: + $ref: '#/components/schemas/OpenAI.MessageContent' + description: The content of the message in array of text and/or images. + x-oaiExpandable: true + readOnly: true + assistant_id: + type: string + nullable: true + description: If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. + run_id: + type: string + nullable: true + description: The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. + attachments: + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + anyOf: + - $ref: '#/components/schemas/OpenAI.AssistantToolsCode' + - $ref: '#/components/schemas/OpenAI.AssistantToolsFileSearchTypeOnly' + description: The tools to add this file to. + x-oaiExpandable: true + nullable: true + description: A list of files attached to the message, and the tools they were added to. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: |- + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + x-oaiTypeLabel: map + readOnly: true + description: Represents a message within a [thread](/docs/api-reference/threads). + OpenAI.MessageRequestContentTextObject: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: Always `text`. + text: + type: string + description: Text content to be sent to the model + allOf: + - $ref: '#/components/schemas/OpenAI.MessageContent' + description: The text content that is part of a message. + OpenAI.ParallelToolCalls: + type: boolean + description: Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use. + OpenAI.ResponseFormatJsonSchemaSchema: + type: object + additionalProperties: {} + description: The schema for the response format, described as a JSON Schema object. + PineconeChatDataSource: + type: object + required: + - type + - parameters + properties: + type: + type: string + enum: + - pinecone + description: The discriminated type identifier, which is always 'pinecone'. + parameters: + type: object + properties: + top_n_documents: + type: integer + format: int32 + description: The configured number of documents to feature in the query. + in_scope: + type: boolean + description: Whether queries should be restricted to use of the indexed data. + strictness: + type: integer + format: int32 + minimum: 1 + maximum: 5 + description: |- + The configured strictness of the search relevance filtering. + Higher strictness will increase precision but lower recall of the answer. + max_search_queries: + type: integer + format: int32 + description: |- + The maximum number of rewritten queries that should be sent to the search provider for a single user message. + By default, the system will make an automatic determination. + allow_partial_result: + type: boolean + description: |- + If set to true, the system will allow partial search results to be used and the request will fail if all + partial queries fail. If not specified or specified as false, the request will fail if any search query fails. + default: false + include_contexts: + type: array + items: + type: string + enum: + - citations + - intent + - all_retrieved_documents + maxItems: 3 + description: |- + The output context properties to include on the response. + By default, citations and intent will be requested. + default: + - citations + - intent + environment: + type: string + description: The environment name to use with Pinecone. + index_name: + type: string + description: The name of the Pinecone database index to use. + authentication: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceApiKeyAuthenticationOptions' + description: |- + The authentication mechanism to use with Pinecone. + Supported authentication mechanisms for Pinecone include: API key. + embedding_dependency: + allOf: + - $ref: '#/components/schemas/AzureChatDataSourceVectorizationSource' + description: |- + The vectorization source to use as an embedding dependency for the Pinecone data source. + Supported vectorization sources for Pinecone include: deployment name. + fields_mapping: + type: object + properties: + content_fields: + type: array + items: + type: string + title_field: + type: string + url_field: + type: string + filepath_field: + type: string + content_fields_separator: + type: string + required: + - content_fields + description: |- + Field mappings to apply to data used by the Pinecone data source. + Note that content field mappings are required for Pinecone. + required: + - environment + - index_name + - authentication + - embedding_dependency + - fields_mapping + description: The parameter information to control the use of the Pinecone data source. + allOf: + - $ref: '#/components/schemas/AzureChatDataSource' + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: api-key + OAuth2Auth: + type: oauth2 + flows: + implicit: + authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize + scopes: + https://cognitiveservices.azure.com/.default: '' +servers: + - url: '{endpoint}/openai' + description: Azure OpenAI APIs for completions and search + variables: + endpoint: + default: '' + description: |- + Supported Cognitive Services endpoints (protocol and hostname, for example: + https://westus.api.cognitive.microsoft.com). diff --git a/.typespec.azure/chat/models.oyd.auth.tsp b/.typespec.azure/chat/models.oyd.auth.tsp index 9e2b85cdc..5e0f05138 100644 --- a/.typespec.azure/chat/models.oyd.auth.tsp +++ b/.typespec.azure/chat/models.oyd.auth.tsp @@ -16,20 +16,26 @@ model AzureChatDataSourceApiKeyAuthenticationOptions key: string; } -@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) -model AzureChatDataSourceUsernameAndPasswordAuthenticationOptions - extends AzureChatDataSourceAuthenticationOptions { - type: "username_and_password"; - username: string; - password: string; -} - model AzureChatDataSourceConnectionStringAuthenticationOptions extends AzureChatDataSourceAuthenticationOptions { type: "connection_string"; connection_string: string; } +model AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions + extends AzureChatDataSourceAuthenticationOptions { + type: "system_assigned_managed_identity"; +} + +model AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions + extends AzureChatDataSourceAuthenticationOptions { + type: "user_assigned_managed_identity"; + managed_identity_resource_id: string; +} + +@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) // from 2024-07-01-preview +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model AzureChatDataSourceKeyAndKeyIdAuthenticationOptions extends AzureChatDataSourceAuthenticationOptions { type: "key_and_key_id"; @@ -37,25 +43,30 @@ model AzureChatDataSourceKeyAndKeyIdAuthenticationOptions key_id: string; } +@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) // from 2024-07-01-preview +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model AzureChatDataSourceEncodedApiKeyAuthenticationOptions extends AzureChatDataSourceAuthenticationOptions { type: "encoded_api_key"; encoded_api_key: string; } +@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) // from 2024-07-01-preview +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model AzureChatDataSourceAccessTokenAuthenticationOptions extends AzureChatDataSourceAuthenticationOptions { type: "access_token"; access_token: string; } -model AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions - extends AzureChatDataSourceAuthenticationOptions { - type: "system_assigned_managed_identity"; -} - -model AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions +@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) +model AzureChatDataSourceUsernameAndPasswordAuthenticationOptions extends AzureChatDataSourceAuthenticationOptions { - type: "user_assigned_managed_identity"; - managed_identity_resource_id: string; + type: "username_and_password"; + username: string; + password: string; } diff --git a/.typespec.azure/chat/models.oyd.vectorization.tsp b/.typespec.azure/chat/models.oyd.vectorization.tsp index 843aa9444..b35529255 100644 --- a/.typespec.azure/chat/models.oyd.vectorization.tsp +++ b/.typespec.azure/chat/models.oyd.vectorization.tsp @@ -35,6 +35,10 @@ model AzureChatDataSourceEndpointVectorizationSource * The authentication mechanism to use with the endpoint-based vectorization source. * Endpoint authentication supports API key and access token mechanisms. */ + @typeChangedFrom( + AzureOpenAIServiceApiVersion.v2024_10_21, + AzureChatDataSourceApiKeyAuthenticationOptions + ) authentication: AzureChatDataSourceApiKeyAuthenticationOptions | AzureChatDataSourceAccessTokenAuthenticationOptions; /** @@ -71,6 +75,9 @@ model AzureChatDataSourceDeploymentNameVectorizationSource * Represents a vectorization source that makes service calls based on a search service model ID. * This source type is currently only supported by Elasticsearch. */ +@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model AzureChatDataSourceModelIdVectorizationSource extends AzureChatDataSourceVectorizationSource { /** The type identifier, always 'model_id' for this vectorization source type. */ @@ -84,6 +91,8 @@ model AzureChatDataSourceModelIdVectorizationSource * Represents an integrated vectorization source as defined within the supporting search resource. */ @added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model AzureChatDataSourceIntegratedVectorizationSource extends AzureChatDataSourceVectorizationSource { /** The type identifier, always 'integrated' for this vectorization source type. */ diff --git a/.typespec.azure/chat/models.request.tsp b/.typespec.azure/chat/models.request.tsp index 2d9ba381a..0ae2aeba3 100644 --- a/.typespec.azure/chat/models.request.tsp +++ b/.typespec.azure/chat/models.request.tsp @@ -9,16 +9,88 @@ using TypeSpec.Versioning; namespace AzureOpenAI; +@withoutOmittedProperties("model") +@withoutOmittedProperties("service_tier") +model CreateChatCompletionRequestCommonBase + is OpenAI.CreateChatCompletionRequest; + +// Ingested changes from OpenAI for 2025-01-01-preview + +@@added(CreateChatCompletionRequestCommonBase.modalities, + AzureOpenAIServiceApiVersion.v2025_01_01_preview +); +@@added(CreateChatCompletionRequestCommonBase.prediction, + AzureOpenAIServiceApiVersion.v2025_01_01_preview +); +@@added(CreateChatCompletionRequestCommonBase.audio, + AzureOpenAIServiceApiVersion.v2025_01_01_preview +); + +// Ingested changes from OpenAI for 2024-12-01-preview + +@@added(CreateChatCompletionRequestCommonBase.store, + AzureOpenAIServiceApiVersion.v2024_12_01_preview +); +@@added(CreateChatCompletionRequestCommonBase.metadata, + AzureOpenAIServiceApiVersion.v2024_12_01_preview +); +@@added(CreateChatCompletionRequestCommonBase.reasoning_effort, + AzureOpenAIServiceApiVersion.v2024_12_01_preview +); +@@added(OpenAI.ChatCompletionRequestDeveloperMessage, + AzureOpenAIServiceApiVersion.v2024_12_01_preview +); + +// Ingested changes from OpenAI for 2024-10-01-preview + +@@added(OpenAI.CompletionUsage.prompt_tokens_details, + AzureOpenAIServiceApiVersion.v2024_10_01_preview +); + +// Ingested changes from OpenAI for 2024-09-01-preview + +@@added(CreateChatCompletionRequestCommonBase.stream_options, + AzureOpenAIServiceApiVersion.v2024_09_01_preview +); +@@added(CreateChatCompletionRequestCommonBase.max_completion_tokens, + AzureOpenAIServiceApiVersion.v2024_09_01_preview +); +@@added(CreateChatCompletionRequestCommonBase.parallel_tool_calls, + AzureOpenAIServiceApiVersion.v2024_09_01_preview +); + +// Ingested changes from OpenAI for 2024-08-01-preview + +@@typeChangedFrom(OpenAI.ChatCompletionRequestSystemMessage.content, + AzureOpenAIServiceApiVersion.v2024_08_01_preview, + string +); +@@typeChangedFrom(OpenAI.ChatCompletionRequestAssistantMessage.content, + AzureOpenAIServiceApiVersion.v2024_08_01_preview, + string +); + +// Ingested changes from OpenAI for 2024-07-01-preview (moved to 2024-08-01-preview) + +@@typeChangedFrom(CreateChatCompletionRequestCommonBase.tool_choice, + AzureOpenAIServiceApiVersion.v2024_08_01_preview, + "none" | "auto" | OpenAI.ChatCompletionNamedToolChoice +); + /** * The extended request model for chat completions against the Azure OpenAI service. * This adds the ability to provide data sources for the On Your Data feature. */ -model AzureCreateChatCompletionRequest - extends OpenAI.CreateChatCompletionRequest { +model AzureCreateChatCompletionRequest { + ...CreateChatCompletionRequestCommonBase; + /** * The data sources to use for the On Your Data feature, exclusive to Azure OpenAI. */ data_sources?: AzureChatDataSource[]; + + @added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) + user_security_context?: AzureUserSecurityContext; } /** @@ -33,6 +105,10 @@ model AzureChatDataSource { type: string; } +alias AzureSearchAuthenticationOptions = AzureChatDataSourceApiKeyAuthenticationOptions | AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions | AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions; + +alias AzureSearchAuthenticationOptionsWithAccessToken = AzureSearchAuthenticationOptions | AzureChatDataSourceAccessTokenAuthenticationOptions; + /** Represents a data source configuration that will use an Azure Search resource. */ model AzureSearchChatDataSource extends AzureChatDataSource { /** The discriminated type identifier, which is always 'azure_search'. */ @@ -51,11 +127,11 @@ model AzureSearchChatDataSource extends AzureChatDataSource { /** * The authentication mechanism to use with Azure Search. */ - authentication: - | AzureChatDataSourceApiKeyAuthenticationOptions - | AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions - | AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions - | AzureChatDataSourceAccessTokenAuthenticationOptions; + @typeChangedFrom( + AzureOpenAIServiceApiVersion.v2024_10_21, + AzureSearchAuthenticationOptions + ) + authentication: AzureSearchAuthenticationOptionsWithAccessToken; /** The field mappings to use with the Azure Search resource. */ fields_mapping?: { @@ -99,36 +175,7 @@ model AzureSearchChatDataSource extends AzureChatDataSource { * The vectorization source to use with Azure Search. * Supported sources for Azure Search include endpoint, deployment name, and integrated. */ - @typeChangedFrom( - AzureOpenAIServiceApiVersion.v2024_08_01_preview, - AzureChatDataSourceEndpointVectorizationSource | AzureChatDataSourceDeploymentNameVectorizationSource - ) - embedding_dependency?: AzureChatDataSourceEndpointVectorizationSource | AzureChatDataSourceDeploymentNameVectorizationSource | AzureChatDataSourceIntegratedVectorizationSource; - }; -} - -/** Represents a data source configuration that will use an Azure Machine Learning vector index. */ -@removed(AzureOpenAIServiceApiVersion.v2024_08_01_preview) -model AzureMachineLearningIndexChatDataSource extends AzureChatDataSource { - /** The discriminated type identifier, which is always 'azure_ml_index'. */ - type: "azure_ml_index"; - - /** The parameter information to control the use of the Azure Machine Learning Index data source. */ - parameters: { - ...AzureChatDataSourceCommonParameters; - authentication: AzureChatDataSourceAccessTokenAuthenticationOptions | AzureChatDataSourceSystemAssignedManagedIdentityAuthenticationOptions | AzureChatDataSourceUserAssignedManagedIdentityAuthenticationOptions; - - /** The ID of the Azure Machine Learning index project to use. */ - project_resource_id: string; - - /** The name of the Azure Machine Learning index to use. */ - name: string; - - /** The version of the vector index to use. */ - version: string; - - /** A search filter, which is only applicable if the vector index is of the 'AzureSearch' type. */ - filter?: string; + embedding_dependency?: AzureChatDataSourceVectorizationSource; }; } @@ -156,6 +203,9 @@ model AzureCosmosDBChatDataSource extends AzureChatDataSource { }; } +@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) // from 2024-07-01-preview +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model ElasticsearchChatDataSource extends AzureChatDataSource { /** The discriminated type identifier, which is always 'elasticsearch'. */ type: "elasticsearch"; @@ -165,7 +215,12 @@ model ElasticsearchChatDataSource extends AzureChatDataSource { ...AzureChatDataSourceCommonParameters; endpoint: url; index_name: string; + + @added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) // from 2024-07-01-preview + @removed(AzureOpenAIServiceApiVersion.v2024_10_21) + @added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) authentication: AzureChatDataSourceKeyAndKeyIdAuthenticationOptions | AzureChatDataSourceEncodedApiKeyAuthenticationOptions; + fields_mapping?: { title_field?: string; url_field?: string; @@ -179,6 +234,9 @@ model ElasticsearchChatDataSource extends AzureChatDataSource { }; } +@added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) // from 2024-07-01-preview +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model PineconeChatDataSource extends AzureChatDataSource { /** The discriminated type identifier, which is always 'pinecone'. */ type: "pinecone"; @@ -220,6 +278,8 @@ model PineconeChatDataSource extends AzureChatDataSource { } @added(AzureOpenAIServiceApiVersion.v2024_08_01_preview) +@removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model MongoDBChatDataSource extends AzureChatDataSource { /** The discriminated type identifier, which is always 'mongo_db'. */ type: "mongo_db"; @@ -316,3 +376,21 @@ alias AzureChatDataSourceCommonParameters = { "intent" ]; }; + +/** + * User security context contains several parameters that describe the application itself, and the end user that interacts with the application. These fields assist your security operations teams to investigate and mitigate security incidents by providing a comprehensive approach to protecting your AI applications. [Learn more](https://aka.ms/TP4AI/Documentation/EndUserContext) about protecting AI applications using Microsoft Defender for Cloud. + */ +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) +model AzureUserSecurityContext { + /** The name of the application. Sensitive personal information should not be included in this field. */ + application_name?: string; + + /** This identifier is the Microsoft Entra ID (formerly Azure Active Directory) user object ID used to authenticate end-users within the generative AI application. Sensitive personal information should not be included in this field. */ + end_user_id?: string; + + /** The Microsoft 365 tenant ID the end user belongs to. It's required when the generative AI application is multitenant. */ + end_user_tenant_id?: string; + + /** Captures the original client's IP address. */ + source_ip?: string; +} diff --git a/.typespec.azure/chat/models.response.tsp b/.typespec.azure/chat/models.response.tsp index 9796fea44..601c9a35e 100644 --- a/.typespec.azure/chat/models.response.tsp +++ b/.typespec.azure/chat/models.response.tsp @@ -1,14 +1,45 @@ +import "@typespec/versioning"; + import "../../.typespec/chat/models.tsp"; import "../common"; +using TypeSpec.Versioning; + namespace AzureOpenAI; +// Ingested changes from OpenAI for 2024-09-01-preview + +@@added(OpenAI.CompletionUsage.completion_tokens_details, + AzureOpenAIServiceApiVersion.v2024_09_01_preview +); + +// Ingested changes from OpenAI for 2024-08-01-preview + +@@added(OpenAI.ChatResponseFormatJsonSchema, + AzureOpenAIServiceApiVersion.v2024_08_01_preview +); + +model AzureCreateChatCompletionResponseChoice { + ...OpenAI.CreateChatCompletionResponseChoice; + + /** + * The Responsible AI content filter annotations associated with the choice. + */ + content_filter_results: AzureContentFilterResultForChoice; +} + +@withoutOmittedProperties("choices") +model CreateChatCompletionResponseCommonBase + is OpenAI.CreateChatCompletionResponse; + /** * The extended top-level chat completion response model for the Azure OpenAI service. * This model adds Responsible AI content filter annotations for prompt input. */ -model AzureCreateChatCompletionResponse - extends OpenAI.CreateChatCompletionResponse { +model AzureCreateChatCompletionResponse { + ...CreateChatCompletionResponseCommonBase; + choices: AzureCreateChatCompletionResponseChoice[]; + /** * The Responsible AI content filter annotations associated with prompt inputs into chat completions. */ @@ -59,8 +90,9 @@ model AzureChatMessageContext { * This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other * information related to retrieval-augmented generation performed. */ -model AzureChatCompletionResponseMessage - extends OpenAI.ChatCompletionResponseMessage { +model AzureChatCompletionResponseMessage { + ...OpenAI.ChatCompletionResponseMessage; + /** * The Azure-specific context information associated with the chat completion response message. */ @@ -72,8 +104,9 @@ model AzureChatCompletionResponseMessage * This model adds support for chat message context, used by the On Your Data feature for intent, citations, and other * information related to retrieval-augmented generation performed. */ -model AzureChatCompletionStreamResponseDelta - extends OpenAI.ChatCompletionStreamResponseDelta { +model AzureChatCompletionStreamResponseDelta { + ...OpenAI.ChatCompletionStreamResponseDelta; + /** * The Azure-specific context information associated with the chat completion response message. */ diff --git a/.typespec.azure/chat/operations.tsp b/.typespec.azure/chat/operations.tsp index 138a7283d..7c79511c7 100644 --- a/.typespec.azure/chat/operations.tsp +++ b/.typespec.azure/chat/operations.tsp @@ -11,13 +11,14 @@ using OpenAI; namespace AzureOpenAI; -@route("/chat") +@route("{deployment_id}/chat") interface AzureChat { @route("completions") @post @operationId("createChatCompletion") @tag("Chat") createChatCompletion( - ...AzureCreateChatCompletionRequest, - ): AzureCreateChatCompletionResponse | AzureOpenAIChatErrorResponse; + @path deployment_id: string, + @body request: AzureCreateChatCompletionRequest, + ): AzureCreateChatCompletionResponse | AzureChatCompletionStreamResponseDelta[] | AzureOpenAIChatErrorResponse; } diff --git a/.typespec.azure/common/models.rai.tsp b/.typespec.azure/common/models.rai.tsp index a8068a3aa..4b5e2ebd4 100644 --- a/.typespec.azure/common/models.rai.tsp +++ b/.typespec.azure/common/models.rai.tsp @@ -59,6 +59,7 @@ model AzureContentFilterCompletionTextSpan { @added(AzureOpenAIServiceApiVersion.v2024_10_01_preview) @removed(AzureOpenAIServiceApiVersion.v2024_10_21) +@added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) model AzureContentFilterCompletionTextSpanDetectionResult { ...AzureContentFilterDetectionResult; @@ -67,6 +68,7 @@ model AzureContentFilterCompletionTextSpanDetectionResult { */ @added(AzureOpenAIServiceApiVersion.v2024_10_01_preview) @removed(AzureOpenAIServiceApiVersion.v2024_10_21) + @added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) details: AzureContentFilterCompletionTextSpan[]; } @@ -171,6 +173,7 @@ model AzureContentFilterResultForChoice { @added(AzureOpenAIServiceApiVersion.v2024_10_01_preview) @removed(AzureOpenAIServiceApiVersion.v2024_10_21) + @added(AzureOpenAIServiceApiVersion.v2024_12_01_preview) ungrounded_material?: AzureContentFilterCompletionTextSpanDetectionResult; } diff --git a/.typespec.azure/main.tsp b/.typespec.azure/main.tsp index 54310a2ab..d18dfa0c2 100644 --- a/.typespec.azure/main.tsp +++ b/.typespec.azure/main.tsp @@ -76,4 +76,14 @@ enum AzureOpenAIServiceApiVersion { * The 2024-10-21 (stable) service API version label. */ v2024_10_21: "2024-10-21", + + /** + * The 2024-12-01-preview service API version label. + */ + v2024_12_01_preview: "2024-12-01-preview", + + /** + * The 2025-01-01-preview service API version label. + */ + v2025_01_01_preview: "2025-01-01-preview", } diff --git a/.typespec.azure/tspconfig.yaml b/.typespec.azure/tspconfig.yaml index d6a1bc0f8..9adc4a453 100644 --- a/.typespec.azure/tspconfig.yaml +++ b/.typespec.azure/tspconfig.yaml @@ -4,6 +4,7 @@ emit: options: "@typespec/openapi3": output-file: "{project-root}/../.openapi3.azure/openapi3-azure-openai-{version}-generated.yaml" + omit-unreachable-types: true "@azure-tools/typespec-csharp": namespace: "Azure.AI.OpenAI" emitter-output-dir: "{project-root}/../.dotnet.azure/sdk/openai/Azure.AI.OpenAI/src"