diff --git a/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs b/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs index 8a8ed03b3049..93b76afcc763 100644 --- a/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs +++ b/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs @@ -145,6 +145,7 @@ public partial class AzureCognitiveSearchChatExtensionConfiguration : Azure.AI.O { public AzureCognitiveSearchChatExtensionConfiguration() { } public AzureCognitiveSearchChatExtensionConfiguration(Azure.AI.OpenAI.AzureChatExtensionType type, System.Uri searchEndpoint, string indexName) { } + public AzureCognitiveSearchChatExtensionConfiguration(Azure.AI.OpenAI.AzureChatExtensionType type, System.Uri searchEndpoint, string searchKey, string indexName) { } public int? DocumentCount { get { throw null; } set { } } public System.Uri EmbeddingEndpoint { get { throw null; } set { } } public Azure.AI.OpenAI.AzureCognitiveSearchIndexFieldMappingOptions FieldMappingOptions { get { throw null; } set { } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchChatExtensionConfiguration.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchChatExtensionConfiguration.cs index ed8d605e2b62..b9d346beb6d4 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchChatExtensionConfiguration.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchChatExtensionConfiguration.cs @@ -4,6 +4,8 @@ #nullable disable using System; +using System.Runtime.CompilerServices; +using System.Text.Json; using Azure.Core; namespace Azure.AI.OpenAI @@ -12,6 +14,7 @@ namespace Azure.AI.OpenAI /// A specific representation of configurable options for Azure Cognitive Search when using it as an Azure OpenAI chat /// extension. /// + [CodeGenSuppress("ToRequestContent")] public partial class AzureCognitiveSearchChatExtensionConfiguration : AzureChatExtensionConfiguration { // CUSTOM CODE NOTE: this override effects the desired "default" behavior in the derived type diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchIndexFieldMappingOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchIndexFieldMappingOptions.cs deleted file mode 100644 index b90d7626f84a..000000000000 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchIndexFieldMappingOptions.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.AI.OpenAI -{ - /// Optional settings to control how fields are processed when using a configured Azure Cognitive Search resource. - public partial class AzureCognitiveSearchIndexFieldMappingOptions - { - /// Initializes a new instance of AzureCognitiveSearchIndexFieldMappingOptions. - public AzureCognitiveSearchIndexFieldMappingOptions() - { - ContentFieldNames = new ChangeTrackingList(); - VectorFieldNames = new ChangeTrackingList(); - } - - /// Initializes a new instance of AzureCognitiveSearchIndexFieldMappingOptions. - /// The name of the index field to use as a title. - /// The name of the index field to use as a URL. - /// The name of the index field to use as a filepath. - /// The names of index fields that should be treated as content. - /// The separator pattern that content fields should use. - /// The names of fields that represent vector data. - internal AzureCognitiveSearchIndexFieldMappingOptions(string titleFieldName, string urlFieldName, string filepathFieldName, IList contentFieldNames, string contentFieldSeparator, IList vectorFieldNames) - { - TitleFieldName = titleFieldName; - UrlFieldName = urlFieldName; - FilepathFieldName = filepathFieldName; - ContentFieldNames = contentFieldNames; - ContentFieldSeparator = contentFieldSeparator; - VectorFieldNames = vectorFieldNames; - } - - /// The name of the index field to use as a title. - public string TitleFieldName { get; set; } - /// The name of the index field to use as a URL. - public string UrlFieldName { get; set; } - /// The name of the index field to use as a filepath. - public string FilepathFieldName { get; set; } - /// The names of index fields that should be treated as content. - public IList ContentFieldNames { get; } - /// The separator pattern that content fields should use. - public string ContentFieldSeparator { get; set; } - /// The names of fields that represent vector data. - public IList VectorFieldNames { get; } - } -} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageSize.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageSize.cs deleted file mode 100644 index 6adba31850ef..000000000000 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageSize.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Azure.AI.OpenAI -{ - /// The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024. - public readonly partial struct ImageSize : IEquatable - { - //Temp change need until we resolve usage issue. - //https://github.com/Azure/autorest.csharp/issues/3836 - } -} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs index f5460a934f13..5f28167f63a8 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs @@ -16,7 +16,7 @@ public partial class AudioTranscriptionOptions /// Initializes a new instance of AudioTranscriptionOptions. /// /// The audio data to transcribe. This must be the binary content of a file in one of the supported media formats: - /// flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. + /// flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. /// /// The requested format of the transcription response data, which will influence the content and detail of the result. /// diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs index 0cf8ee9d3ce5..3d7945be012c 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs @@ -16,7 +16,7 @@ public partial class AudioTranslationOptions /// Initializes a new instance of AudioTranslationOptions. /// /// The audio data to translate. This must be the binary content of a file in one of the supported media formats: - /// flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. + /// flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. /// /// The requested format of the translation response data, which will influence the content and detail of the result. /// diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchChatExtensionConfiguration.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchChatExtensionConfiguration.Serialization.cs similarity index 79% rename from sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchChatExtensionConfiguration.Serialization.cs rename to sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchChatExtensionConfiguration.Serialization.cs index 5198f1881d9c..2abe9e10b305 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchChatExtensionConfiguration.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchChatExtensionConfiguration.Serialization.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +// + #nullable disable using System.Text.Json; @@ -8,7 +10,6 @@ namespace Azure.AI.OpenAI { - [CodeGenSuppress("global::Azure.Core.IUtf8JsonSerializable.Write", typeof(Utf8JsonWriter))] public partial class AzureCognitiveSearchChatExtensionConfiguration : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) @@ -16,18 +17,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(Type.ToString()); - - // Custom code note: everything *except* type goes into 'parameters' - writer.WriteStartObject("parameters"u8); - writer.WritePropertyName("endpoint"u8); writer.WriteStringValue(SearchEndpoint.AbsoluteUri); - writer.WriteString("key"u8, SearchKey); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(SearchKey); writer.WritePropertyName("indexName"u8); writer.WriteStringValue(IndexName); if (Optional.IsDefined(FieldMappingOptions)) { - writer.WritePropertyName("fieldMappings"u8); + writer.WritePropertyName("fieldsMapping"u8); writer.WriteObjectValue(FieldMappingOptions); } if (Optional.IsDefined(DocumentCount)) @@ -57,10 +55,9 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } if (Optional.IsDefined(EmbeddingKey)) { - writer.WriteString("embeddingKey"u8, EmbeddingKey); + writer.WritePropertyName("embeddingKey"u8); + writer.WriteStringValue(EmbeddingKey); } - // CUSTOM CODE NOTE: end of induced 'parameters' first, then the parent object - writer.WriteEndObject(); writer.WriteEndObject(); } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchChatExtensionConfiguration.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchChatExtensionConfiguration.cs index ec6088c145bf..e023060bf711 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchChatExtensionConfiguration.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchChatExtensionConfiguration.cs @@ -25,7 +25,7 @@ public partial class AzureCognitiveSearchChatExtensionConfiguration /// The API admin key to use with the specified Azure Cognitive Search endpoint. /// The name of the index to use as available in the referenced Azure Cognitive Search resource. /// , or is null. - internal AzureCognitiveSearchChatExtensionConfiguration(AzureChatExtensionType type, Uri searchEndpoint, string searchKey, string indexName) + public AzureCognitiveSearchChatExtensionConfiguration(AzureChatExtensionType type, Uri searchEndpoint, string searchKey, string indexName) { Argument.AssertNotNull(searchEndpoint, nameof(searchEndpoint)); Argument.AssertNotNull(searchKey, nameof(searchKey)); diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchIndexFieldMappingOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchIndexFieldMappingOptions.Serialization.cs similarity index 99% rename from sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchIndexFieldMappingOptions.Serialization.cs rename to sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchIndexFieldMappingOptions.Serialization.cs index 6e25ada2f36c..63322ef37e83 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureCognitiveSearchIndexFieldMappingOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchIndexFieldMappingOptions.Serialization.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +// + #nullable disable using System.Text.Json; diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchIndexFieldMappingOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchIndexFieldMappingOptions.cs index 118fca80f2c4..23a418083f33 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchIndexFieldMappingOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureCognitiveSearchIndexFieldMappingOptions.cs @@ -13,5 +13,41 @@ namespace Azure.AI.OpenAI /// Optional settings to control how fields are processed when using a configured Azure Cognitive Search resource. public partial class AzureCognitiveSearchIndexFieldMappingOptions { + /// Initializes a new instance of AzureCognitiveSearchIndexFieldMappingOptions. + public AzureCognitiveSearchIndexFieldMappingOptions() + { + ContentFieldNames = new ChangeTrackingList(); + VectorFieldNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of AzureCognitiveSearchIndexFieldMappingOptions. + /// The name of the index field to use as a title. + /// The name of the index field to use as a URL. + /// The name of the index field to use as a filepath. + /// The names of index fields that should be treated as content. + /// The separator pattern that content fields should use. + /// The names of fields that represent vector data. + internal AzureCognitiveSearchIndexFieldMappingOptions(string titleFieldName, string urlFieldName, string filepathFieldName, IList contentFieldNames, string contentFieldSeparator, IList vectorFieldNames) + { + TitleFieldName = titleFieldName; + UrlFieldName = urlFieldName; + FilepathFieldName = filepathFieldName; + ContentFieldNames = contentFieldNames; + ContentFieldSeparator = contentFieldSeparator; + VectorFieldNames = vectorFieldNames; + } + + /// The name of the index field to use as a title. + public string TitleFieldName { get; set; } + /// The name of the index field to use as a URL. + public string UrlFieldName { get; set; } + /// The name of the index field to use as a filepath. + public string FilepathFieldName { get; set; } + /// The names of index fields that should be treated as content. + public IList ContentFieldNames { get; } + /// The separator pattern that content fields should use. + public string ContentFieldSeparator { get; set; } + /// The names of fields that represent vector data. + public IList VectorFieldNames { get; } } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs index b73982221f51..8f3cbe8191c9 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs @@ -15,36 +15,54 @@ namespace Azure.AI.OpenAI /// Model factory for models. public static partial class AzureOpenAIModelFactory { - /// Initializes a new instance of Embeddings. - /// Embedding values for the prompts submitted in the request. - /// Usage counts for tokens input using the embeddings API. - /// A new instance for mocking. - public static Embeddings Embeddings(IEnumerable data = null, EmbeddingsUsage usage = null) + /// Initializes a new instance of AudioTranscriptionSegment. + /// The 0-based index of this segment within a transcription. + /// The time at which this segment started relative to the beginning of the transcribed audio. + /// The time at which this segment ended relative to the beginning of the transcribed audio. + /// The transcribed text that was part of this audio segment. + /// The temperature score associated with this audio segment. + /// The average log probability associated with this audio segment. + /// The compression ratio of this audio segment. + /// The probability of no speech detection within this audio segment. + /// The token IDs matching the transcribed text in this audio segment. + /// + /// The seek position associated with the processing of this audio segment. + /// Seek positions are expressed as hundredths of seconds. + /// The model may process several segments from a single seek position, so while the seek position will never represent + /// a later time than the segment's start, the segment's start may represent a significantly later time than the + /// segment's associated seek position. + /// + /// A new instance for mocking. + public static AudioTranscriptionSegment AudioTranscriptionSegment(int id = default, TimeSpan start = default, TimeSpan end = default, string text = null, float temperature = default, float averageLogProbability = default, float compressionRatio = default, float noSpeechProbability = default, IEnumerable tokens = null, int seek = default) { - data ??= new List(); + tokens ??= new List(); - return new Embeddings(data?.ToList(), usage); + return new AudioTranscriptionSegment(id, start, end, text, temperature, averageLogProbability, compressionRatio, noSpeechProbability, tokens?.ToList(), seek); } - /// Initializes a new instance of EmbeddingItem. - /// - /// List of embeddings value for the input prompt. These represent a measurement of the - /// vector-based relatedness of the provided input. + /// Initializes a new instance of AudioTranslationSegment. + /// The 0-based index of this segment within a translation. + /// The time at which this segment started relative to the beginning of the translated audio. + /// The time at which this segment ended relative to the beginning of the translated audio. + /// The translated text that was part of this audio segment. + /// The temperature score associated with this audio segment. + /// The average log probability associated with this audio segment. + /// The compression ratio of this audio segment. + /// The probability of no speech detection within this audio segment. + /// The token IDs matching the translated text in this audio segment. + /// + /// The seek position associated with the processing of this audio segment. + /// Seek positions are expressed as hundredths of seconds. + /// The model may process several segments from a single seek position, so while the seek position will never represent + /// a later time than the segment's start, the segment's start may represent a significantly later time than the + /// segment's associated seek position. /// - /// Index of the prompt to which the EmbeddingItem corresponds. - /// A new instance for mocking. - public static EmbeddingItem EmbeddingItem(ReadOnlyMemory embedding = default, int index = default) + /// A new instance for mocking. + public static AudioTranslationSegment AudioTranslationSegment(int id = default, TimeSpan start = default, TimeSpan end = default, string text = null, float temperature = default, float averageLogProbability = default, float compressionRatio = default, float noSpeechProbability = default, IEnumerable tokens = null, int seek = default) { - return new EmbeddingItem(embedding, index); - } + tokens ??= new List(); - /// Initializes a new instance of EmbeddingsUsage. - /// Number of tokens sent in the original request. - /// Total number of tokens transacted in this request/response. - /// A new instance for mocking. - public static EmbeddingsUsage EmbeddingsUsage(int promptTokens = default, int totalTokens = default) - { - return new EmbeddingsUsage(promptTokens, totalTokens); + return new AudioTranslationSegment(id, start, end, text, temperature, averageLogProbability, compressionRatio, noSpeechProbability, tokens?.ToList(), seek); } /// Initializes a new instance of Completions. @@ -214,54 +232,36 @@ public static ImageLocation ImageLocation(Uri url = null) return new ImageLocation(url); } - /// Initializes a new instance of AudioTranscriptionSegment. - /// The 0-based index of this segment within a transcription. - /// The time at which this segment started relative to the beginning of the transcribed audio. - /// The time at which this segment ended relative to the beginning of the transcribed audio. - /// The transcribed text that was part of this audio segment. - /// The temperature score associated with this audio segment. - /// The average log probability associated with this audio segment. - /// The compression ratio of this audio segment. - /// The probability of no speech detection within this audio segment. - /// The token IDs matching the transcribed text in this audio segment. - /// - /// The seek position associated with the processing of this audio segment. - /// Seek positions are expressed as hundredths of seconds. - /// The model may process several segments from a single seek position, so while the seek position will never represent - /// a later time than the segment's start, the segment's start may represent a significantly later time than the - /// segment's associated seek position. - /// - /// A new instance for mocking. - public static AudioTranscriptionSegment AudioTranscriptionSegment(int id = default, TimeSpan start = default, TimeSpan end = default, string text = null, float temperature = default, float averageLogProbability = default, float compressionRatio = default, float noSpeechProbability = default, IEnumerable tokens = null, int seek = default) + /// Initializes a new instance of Embeddings. + /// Embedding values for the prompts submitted in the request. + /// Usage counts for tokens input using the embeddings API. + /// A new instance for mocking. + public static Embeddings Embeddings(IEnumerable data = null, EmbeddingsUsage usage = null) { - tokens ??= new List(); + data ??= new List(); - return new AudioTranscriptionSegment(id, start, end, text, temperature, averageLogProbability, compressionRatio, noSpeechProbability, tokens?.ToList(), seek); + return new Embeddings(data?.ToList(), usage); } - /// Initializes a new instance of AudioTranslationSegment. - /// The 0-based index of this segment within a translation. - /// The time at which this segment started relative to the beginning of the translated audio. - /// The time at which this segment ended relative to the beginning of the translated audio. - /// The translated text that was part of this audio segment. - /// The temperature score associated with this audio segment. - /// The average log probability associated with this audio segment. - /// The compression ratio of this audio segment. - /// The probability of no speech detection within this audio segment. - /// The token IDs matching the translated text in this audio segment. - /// - /// The seek position associated with the processing of this audio segment. - /// Seek positions are expressed as hundredths of seconds. - /// The model may process several segments from a single seek position, so while the seek position will never represent - /// a later time than the segment's start, the segment's start may represent a significantly later time than the - /// segment's associated seek position. + /// Initializes a new instance of EmbeddingItem. + /// + /// List of embeddings value for the input prompt. These represent a measurement of the + /// vector-based relatedness of the provided input. /// - /// A new instance for mocking. - public static AudioTranslationSegment AudioTranslationSegment(int id = default, TimeSpan start = default, TimeSpan end = default, string text = null, float temperature = default, float averageLogProbability = default, float compressionRatio = default, float noSpeechProbability = default, IEnumerable tokens = null, int seek = default) + /// Index of the prompt to which the EmbeddingItem corresponds. + /// A new instance for mocking. + public static EmbeddingItem EmbeddingItem(ReadOnlyMemory embedding = default, int index = default) { - tokens ??= new List(); + return new EmbeddingItem(embedding, index); + } - return new AudioTranslationSegment(id, start, end, text, temperature, averageLogProbability, compressionRatio, noSpeechProbability, tokens?.ToList(), seek); + /// Initializes a new instance of EmbeddingsUsage. + /// Number of tokens sent in the original request. + /// Total number of tokens transacted in this request/response. + /// A new instance for mocking. + public static EmbeddingsUsage EmbeddingsUsage(int promptTokens = default, int totalTokens = default) + { + return new EmbeddingsUsage(promptTokens, totalTokens); } } } diff --git a/sdk/openai/Azure.AI.OpenAI/tsp-location.yaml b/sdk/openai/Azure.AI.OpenAI/tsp-location.yaml index ff3fb0810607..4a55b57e2add 100644 --- a/sdk/openai/Azure.AI.OpenAI/tsp-location.yaml +++ b/sdk/openai/Azure.AI.OpenAI/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/cognitiveservices/OpenAI.Inference -commit: a66833cbdebb0574ba012f814ab271a382a7c500 +commit: 42e2c0bcd77b0de6c523404668fa63511484d485 repo: Azure/azure-rest-api-specs