From 54e0a253c5e3bf1fd5214e4523d9c3fb283ba311 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 16 Oct 2024 02:59:41 +0000 Subject: [PATCH] CodeGen from PR 31022 in Azure/azure-rest-api-specs Merge 59a163b2e49f49cd9c1a445850b2126dfa31193c into ae950a4d68bd5bae23f85a8d575a213e9b0442d3 --- .../src/Generated/AliasesRestClient.cs | 2 +- .../src/Generated/DataSourcesRestClient.cs | 2 +- .../src/Generated/DocumentsRestClient.cs | 2 +- .../src/Generated/IndexersRestClient.cs | 2 +- .../src/Generated/IndexesRestClient.cs | 2 +- ...AIServicesAccountIdentity.Serialization.cs | 96 ++++++ .../Models/AIServicesAccountIdentity.cs | 57 ++++ .../AIServicesAccountKey.Serialization.cs | 84 ++++++ .../Generated/Models/AIServicesAccountKey.cs | 46 +++ ...ryQuantizationCompression.Serialization.cs | 31 +- .../Models/BinaryQuantizationCompression.cs | 3 +- .../Models/BlobIndexerParsingMode.cs | 3 + .../CognitiveServicesAccount.Serialization.cs | 2 + .../Models/CognitiveServicesAccount.cs | 2 +- .../Models/DebugInfo.Serialization.cs | 44 +++ .../src/Generated/Models/DebugInfo.cs | 28 ++ ...ntIntelligenceLayoutSkill.Serialization.cs | 181 ++++++++++++ .../Models/DocumentIntelligenceLayoutSkill.cs | 49 ++++ ...elligenceLayoutSkillMarkdownHeaderDepth.cs | 63 ++++ ...cumentIntelligenceLayoutSkillOutputMode.cs | 48 +++ .../Models/FacetResult.Serialization.cs | 29 +- .../src/Generated/Models/FacetResult.cs | 7 +- ...ngParametersConfiguration.Serialization.cs | 48 +++ .../Models/IndexingParametersConfiguration.cs | 10 +- .../Generated/Models/MarkdownHeaderDepth.cs | 63 ++++ .../Models/MarkdownParsingSubmode.cs | 51 ++++ .../src/Generated/Models/QueryAnswerType.cs | 2 +- .../src/Generated/Models/QueryCaptionType.cs | 2 +- .../src/Generated/Models/QueryDebugMode.cs | 11 +- .../QueryRewritesDebugInfo.Serialization.cs | 60 ++++ .../Models/QueryRewritesDebugInfo.cs | 35 +++ .../src/Generated/Models/QueryRewritesType.cs | 51 ++++ ...ryRewritesValuesDebugInfo.Serialization.cs | 56 ++++ .../Models/QueryRewritesValuesDebugInfo.cs | 35 +++ .../Models/RescoringOptions.Serialization.cs | 118 ++++++++ .../src/Generated/Models/RescoringOptions.cs | 36 +++ ...arQuantizationCompression.Serialization.cs | 24 ++ .../Models/ScalarQuantizationCompression.cs | 3 +- .../SearchDocumentsResult.Serialization.cs | 25 +- .../Generated/Models/SearchDocumentsResult.cs | 10 +- .../SearchIndexerSkill.Serialization.cs | 1 + .../Generated/Models/SearchIndexerSkill.cs | 2 +- .../Generated/Models/SearchIndexerSkillset.cs | 8 +- .../Models/SearchOptions.Serialization.cs | 16 + .../src/Generated/Models/SearchOptions.cs | 6 +- .../Models/SemanticQueryRewritesResultType.cs | 48 +++ ...wnVectorSearchCompression.Serialization.cs | 31 +- .../Models/UnknownVectorSearchCompression.cs | 3 +- .../VectorSearchCompression.Serialization.cs | 12 + .../Models/VectorSearchCompression.cs | 6 +- ...orSearchCompressionRescoreStorageMethod.cs | 51 ++++ .../VectorizableTextQuery.Serialization.cs | 18 +- .../Generated/Models/VectorizableTextQuery.cs | 6 +- .../src/Generated/SearchModelFactory.cs | 275 ++++++++++-------- .../src/Generated/SearchServiceRestClient.cs | 2 +- .../src/Generated/SkillsetsRestClient.cs | 2 +- .../src/Generated/SynonymMapsRestClient.cs | 2 +- .../Azure.Search.Documents/src/autorest.md | 6 +- 58 files changed, 1768 insertions(+), 150 deletions(-) create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.Serialization.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.Serialization.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.Serialization.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.Serialization.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillOutputMode.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownHeaderDepth.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownParsingSubmode.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.Serialization.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesType.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.Serialization.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.Serialization.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/SemanticQueryRewritesResultType.cs create mode 100644 sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompressionRescoreStorageMethod.cs diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs index 677bb77903b9..4d6b40140ad7 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs @@ -32,7 +32,7 @@ internal partial class AliasesRestClient /// The tracking ID sent with the request to help with debugging. /// Api Version. /// , , or is null. - public AliasesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public AliasesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/DataSourcesRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/DataSourcesRestClient.cs index 95d44366b9b2..92c11d867206 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/DataSourcesRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/DataSourcesRestClient.cs @@ -32,7 +32,7 @@ internal partial class DataSourcesRestClient /// The tracking ID sent with the request to help with debugging. /// Api Version. /// , , or is null. - public DataSourcesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public DataSourcesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/DocumentsRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/DocumentsRestClient.cs index 0d70b65884c2..985065d34e6e 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/DocumentsRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/DocumentsRestClient.cs @@ -36,7 +36,7 @@ internal partial class DocumentsRestClient /// Api Version. /// , , , or is null. /// is an empty string, and was expected to be non-empty. - public DocumentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string indexName, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public DocumentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string indexName, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/IndexersRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/IndexersRestClient.cs index 9f01d26b906f..685b624de797 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/IndexersRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/IndexersRestClient.cs @@ -33,7 +33,7 @@ internal partial class IndexersRestClient /// The tracking ID sent with the request to help with debugging. /// Api Version. /// , , or is null. - public IndexersRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public IndexersRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/IndexesRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/IndexesRestClient.cs index a1ef741d102c..8dfe31f111ef 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/IndexesRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/IndexesRestClient.cs @@ -32,7 +32,7 @@ internal partial class IndexesRestClient /// The tracking ID sent with the request to help with debugging. /// Api Version. /// , , or is null. - public IndexesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public IndexesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.Serialization.cs new file mode 100644 index 000000000000..a28372654f27 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.Serialization.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Search.Documents.Indexes.Models +{ + public partial class AIServicesAccountIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Identity != null) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity); + } + else + { + writer.WriteNull("identity"); + } + writer.WritePropertyName("subdomainUrl"u8); + writer.WriteStringValue(SubdomainUrl); + writer.WritePropertyName("@odata.type"u8); + writer.WriteStringValue(ODataType); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static AIServicesAccountIdentity DeserializeAIServicesAccountIdentity(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SearchIndexerDataIdentity identity = default; + string subdomainUrl = default; + string odataType = default; + string description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + identity = null; + continue; + } + identity = SearchIndexerDataIdentity.DeserializeSearchIndexerDataIdentity(property.Value); + continue; + } + if (property.NameEquals("subdomainUrl"u8)) + { + subdomainUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("@odata.type"u8)) + { + odataType = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new AIServicesAccountIdentity(odataType, description, identity, subdomainUrl); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AIServicesAccountIdentity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAIServicesAccountIdentity(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.cs new file mode 100644 index 000000000000..21d3f2861259 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountIdentity.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// The multi-region account of an Azure AI service resource that's attached to a skillset. + public partial class AIServicesAccountIdentity : CognitiveServicesAccount + { + /// Initializes a new instance of . + /// + /// The user-assigned managed identity used for connections to AI Service. If not specified, the system-assigned managed identity is used. On updates to the skillset, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this property is cleared. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The subdomain url for the corresponding AI Service. + /// is null. + public AIServicesAccountIdentity(SearchIndexerDataIdentity identity, string subdomainUrl) + { + Argument.AssertNotNull(subdomainUrl, nameof(subdomainUrl)); + + Identity = identity; + SubdomainUrl = subdomainUrl; + ODataType = "#Microsoft.Azure.Search.AIServicesByIdentity"; + } + + /// Initializes a new instance of . + /// A URI fragment specifying the type of Azure AI service resource attached to a skillset. + /// Description of the Azure AI service resource attached to a skillset. + /// + /// The user-assigned managed identity used for connections to AI Service. If not specified, the system-assigned managed identity is used. On updates to the skillset, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this property is cleared. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The subdomain url for the corresponding AI Service. + internal AIServicesAccountIdentity(string oDataType, string description, SearchIndexerDataIdentity identity, string subdomainUrl) : base(oDataType, description) + { + Identity = identity; + SubdomainUrl = subdomainUrl; + ODataType = oDataType ?? "#Microsoft.Azure.Search.AIServicesByIdentity"; + } + + /// + /// The user-assigned managed identity used for connections to AI Service. If not specified, the system-assigned managed identity is used. On updates to the skillset, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this property is cleared. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public SearchIndexerDataIdentity Identity { get; set; } + /// The subdomain url for the corresponding AI Service. + public string SubdomainUrl { get; set; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.Serialization.cs new file mode 100644 index 000000000000..7a4b7eb9f4c9 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.Serialization.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Search.Documents.Indexes.Models +{ + public partial class AIServicesAccountKey : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("subdomainUrl"u8); + writer.WriteStringValue(SubdomainUrl); + writer.WritePropertyName("@odata.type"u8); + writer.WriteStringValue(ODataType); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static AIServicesAccountKey DeserializeAIServicesAccountKey(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string subdomainUrl = default; + string odataType = default; + string description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("subdomainUrl"u8)) + { + subdomainUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("@odata.type"u8)) + { + odataType = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new AIServicesAccountKey(odataType, description, key, subdomainUrl); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AIServicesAccountKey FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAIServicesAccountKey(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.cs new file mode 100644 index 000000000000..9fc583eb0fd6 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/AIServicesAccountKey.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// The account key of an Azure AI service resource that's attached to a skillset, to be used with the resource's subdomain. + public partial class AIServicesAccountKey : CognitiveServicesAccount + { + /// Initializes a new instance of . + /// The key used to provision the Azure AI service resource attached to a skillset. + /// The subdomain url for the corresponding AI Service. + /// or is null. + public AIServicesAccountKey(string key, string subdomainUrl) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(subdomainUrl, nameof(subdomainUrl)); + + Key = key; + SubdomainUrl = subdomainUrl; + ODataType = "#Microsoft.Azure.Search.AIServicesByKey"; + } + + /// Initializes a new instance of . + /// A URI fragment specifying the type of Azure AI service resource attached to a skillset. + /// Description of the Azure AI service resource attached to a skillset. + /// The key used to provision the Azure AI service resource attached to a skillset. + /// The subdomain url for the corresponding AI Service. + internal AIServicesAccountKey(string oDataType, string description, string key, string subdomainUrl) : base(oDataType, description) + { + Key = key; + SubdomainUrl = subdomainUrl; + ODataType = oDataType ?? "#Microsoft.Azure.Search.AIServicesByKey"; + } + + /// The key used to provision the Azure AI service resource attached to a skillset. + public string Key { get; set; } + /// The subdomain url for the corresponding AI Service. + public string SubdomainUrl { get; set; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.Serialization.cs index fcbcaf9b841e..b9157d38df02 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.Serialization.cs @@ -36,6 +36,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("defaultOversampling"); } } + if (Optional.IsDefined(RescoringOptions)) + { + if (RescoringOptions != null) + { + writer.WritePropertyName("rescoringOptions"u8); + writer.WriteObjectValue(RescoringOptions); + } + else + { + writer.WriteNull("rescoringOptions"); + } + } if (Optional.IsDefined(TruncationDimension)) { if (TruncationDimension != null) @@ -61,6 +73,7 @@ internal static BinaryQuantizationCompression DeserializeBinaryQuantizationCompr VectorSearchCompressionKind kind = default; bool? rerankWithOriginalVectors = default; double? defaultOversampling = default; + RescoringOptions rescoringOptions = default; int? truncationDimension = default; foreach (var property in element.EnumerateObject()) { @@ -93,6 +106,16 @@ internal static BinaryQuantizationCompression DeserializeBinaryQuantizationCompr defaultOversampling = property.Value.GetDouble(); continue; } + if (property.NameEquals("rescoringOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rescoringOptions = null; + continue; + } + rescoringOptions = RescoringOptions.DeserializeRescoringOptions(property.Value); + continue; + } if (property.NameEquals("truncationDimension"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,7 +127,13 @@ internal static BinaryQuantizationCompression DeserializeBinaryQuantizationCompr continue; } } - return new BinaryQuantizationCompression(name, kind, rerankWithOriginalVectors, defaultOversampling, truncationDimension); + return new BinaryQuantizationCompression( + name, + kind, + rerankWithOriginalVectors, + defaultOversampling, + rescoringOptions, + truncationDimension); } /// Deserializes the model from a raw response. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.cs index 5744abba047c..fc8caec0912b 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/BinaryQuantizationCompression.cs @@ -27,8 +27,9 @@ public BinaryQuantizationCompression(string compressionName) : base(compressionN /// The name of the kind of compression method being configured for use with vector search. /// If set to true, once the ordered set of results calculated using compressed vectors are obtained, they will be reranked again by recalculating the full-precision similarity scores. This will improve recall at the expense of latency. /// Default oversampling factor. Oversampling will internally request more documents (specified by this multiplier) in the initial search. This increases the set of results that will be reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve recall at the expense of latency. + /// Contains the options for rescoring. /// The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save storage cost and improve search performance at the expense of recall. It should be only used for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no truncation. - internal BinaryQuantizationCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, int? truncationDimension) : base(compressionName, kind, rerankWithOriginalVectors, defaultOversampling, truncationDimension) + internal BinaryQuantizationCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, RescoringOptions rescoringOptions, int? truncationDimension) : base(compressionName, kind, rerankWithOriginalVectors, defaultOversampling, rescoringOptions, truncationDimension) { Kind = kind; } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/BlobIndexerParsingMode.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/BlobIndexerParsingMode.cs index 85eb9e9eb23f..a7a0e11f98aa 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/BlobIndexerParsingMode.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/BlobIndexerParsingMode.cs @@ -28,6 +28,7 @@ public BlobIndexerParsingMode(string value) private const string JsonValue = "json"; private const string JsonArrayValue = "jsonArray"; private const string JsonLinesValue = "jsonLines"; + private const string MarkdownValue = "markdown"; /// Set to default for normal file processing. public static BlobIndexerParsingMode Default { get; } = new BlobIndexerParsingMode(DefaultValue); @@ -41,6 +42,8 @@ public BlobIndexerParsingMode(string value) public static BlobIndexerParsingMode JsonArray { get; } = new BlobIndexerParsingMode(JsonArrayValue); /// Set to jsonLines to extract individual JSON entities, separated by a new line, as separate documents. public static BlobIndexerParsingMode JsonLines { get; } = new BlobIndexerParsingMode(JsonLinesValue); + /// Set to markdown to extract content from markdown files. + public static BlobIndexerParsingMode Markdown { get; } = new BlobIndexerParsingMode(MarkdownValue); /// Determines if two values are the same. public static bool operator ==(BlobIndexerParsingMode left, BlobIndexerParsingMode right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.Serialization.cs index 299341426c18..b9ce6451c3d4 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.Serialization.cs @@ -36,6 +36,8 @@ internal static CognitiveServicesAccount DeserializeCognitiveServicesAccount(Jso { switch (discriminator.GetString()) { + case "#Microsoft.Azure.Search.AIServicesByIdentity": return AIServicesAccountIdentity.DeserializeAIServicesAccountIdentity(element); + case "#Microsoft.Azure.Search.AIServicesByKey": return AIServicesAccountKey.DeserializeAIServicesAccountKey(element); case "#Microsoft.Azure.Search.CognitiveServicesByKey": return CognitiveServicesAccountKey.DeserializeCognitiveServicesAccountKey(element); case "#Microsoft.Azure.Search.DefaultCognitiveServices": return DefaultCognitiveServicesAccount.DeserializeDefaultCognitiveServicesAccount(element); } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs index 58a8ac32e2b6..d9a85ae2aab0 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/CognitiveServicesAccount.cs @@ -10,7 +10,7 @@ namespace Azure.Search.Documents.Indexes.Models /// /// Base type for describing any Azure AI service resource attached to a skillset. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// public partial class CognitiveServicesAccount { diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.Serialization.cs new file mode 100644 index 000000000000..31c08d33c7e2 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.Search.Documents.Models +{ + public partial class DebugInfo + { + internal static DebugInfo DeserializeDebugInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + QueryRewritesDebugInfo queryRewrites = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("queryRewrites"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queryRewrites = QueryRewritesDebugInfo.DeserializeQueryRewritesDebugInfo(property.Value); + continue; + } + } + return new DebugInfo(queryRewrites); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DebugInfo FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDebugInfo(document.RootElement); + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.cs new file mode 100644 index 000000000000..b50ff0c0537f --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DebugInfo.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Search.Documents.Models +{ + /// Contains debugging information that can be used to further explore your search results. + public partial class DebugInfo + { + /// Initializes a new instance of . + internal DebugInfo() + { + } + + /// Initializes a new instance of . + /// Contains debugging information specific to query rewrites. + internal DebugInfo(QueryRewritesDebugInfo queryRewrites) + { + QueryRewrites = queryRewrites; + } + + /// Contains debugging information specific to query rewrites. + public QueryRewritesDebugInfo QueryRewrites { get; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.Serialization.cs new file mode 100644 index 000000000000..99c9d068715e --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Search.Documents.Indexes.Models +{ + public partial class DocumentIntelligenceLayoutSkill : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(OutputMode)) + { + if (OutputMode != null) + { + writer.WritePropertyName("outputMode"u8); + writer.WriteStringValue(OutputMode.Value.ToString()); + } + else + { + writer.WriteNull("outputMode"); + } + } + if (Optional.IsDefined(MarkdownHeaderDepth)) + { + if (MarkdownHeaderDepth != null) + { + writer.WritePropertyName("markdownHeaderDepth"u8); + writer.WriteStringValue(MarkdownHeaderDepth.Value.ToString()); + } + else + { + writer.WriteNull("markdownHeaderDepth"); + } + } + writer.WritePropertyName("@odata.type"u8); + writer.WriteStringValue(ODataType); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Context)) + { + writer.WritePropertyName("context"u8); + writer.WriteStringValue(Context); + } + writer.WritePropertyName("inputs"u8); + writer.WriteStartArray(); + foreach (var item in Inputs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("outputs"u8); + writer.WriteStartArray(); + foreach (var item in Outputs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + + internal static DocumentIntelligenceLayoutSkill DeserializeDocumentIntelligenceLayoutSkill(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DocumentIntelligenceLayoutSkillOutputMode? outputMode = default; + DocumentIntelligenceLayoutSkillMarkdownHeaderDepth? markdownHeaderDepth = default; + string odataType = default; + string name = default; + string description = default; + string context = default; + IList inputs = default; + IList outputs = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("outputMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + outputMode = null; + continue; + } + outputMode = new DocumentIntelligenceLayoutSkillOutputMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("markdownHeaderDepth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + markdownHeaderDepth = null; + continue; + } + markdownHeaderDepth = new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(property.Value.GetString()); + continue; + } + if (property.NameEquals("@odata.type"u8)) + { + odataType = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("context"u8)) + { + context = property.Value.GetString(); + continue; + } + if (property.NameEquals("inputs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item)); + } + inputs = array; + continue; + } + if (property.NameEquals("outputs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item)); + } + outputs = array; + continue; + } + } + return new DocumentIntelligenceLayoutSkill( + odataType, + name, + description, + context, + inputs, + outputs, + outputMode, + markdownHeaderDepth); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DocumentIntelligenceLayoutSkill FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentIntelligenceLayoutSkill(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.cs new file mode 100644 index 000000000000..75eafce1323a --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkill.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// A skill that extracts content and layout information (as markdown), via Azure AI Services, from files within the enrichment pipeline. + public partial class DocumentIntelligenceLayoutSkill : SearchIndexerSkill + { + /// Initializes a new instance of . + /// Inputs of the skills could be a column in the source data set, or the output of an upstream skill. + /// The output of a skill is either a field in a search index, or a value that can be consumed as an input by another skill. + /// or is null. + public DocumentIntelligenceLayoutSkill(IEnumerable inputs, IEnumerable outputs) : base(inputs, outputs) + { + Argument.AssertNotNull(inputs, nameof(inputs)); + Argument.AssertNotNull(outputs, nameof(outputs)); + + ODataType = "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill"; + } + + /// Initializes a new instance of . + /// A URI fragment specifying the type of skill. + /// The name of the skill which uniquely identifies it within the skillset. A skill with no name defined will be given a default name of its 1-based index in the skills array, prefixed with the character '#'. + /// The description of the skill which describes the inputs, outputs, and usage of the skill. + /// Represents the level at which operations take place, such as the document root or document content (for example, /document or /document/content). The default is /document. + /// Inputs of the skills could be a column in the source data set, or the output of an upstream skill. + /// The output of a skill is either a field in a search index, or a value that can be consumed as an input by another skill. + /// Controls the cardinality of the output produced by the skill. Default is 'oneToMany'. + /// The depth of headers in the markdown output. Default is h6. + internal DocumentIntelligenceLayoutSkill(string oDataType, string name, string description, string context, IList inputs, IList outputs, DocumentIntelligenceLayoutSkillOutputMode? outputMode, DocumentIntelligenceLayoutSkillMarkdownHeaderDepth? markdownHeaderDepth) : base(oDataType, name, description, context, inputs, outputs) + { + OutputMode = outputMode; + MarkdownHeaderDepth = markdownHeaderDepth; + ODataType = oDataType ?? "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill"; + } + + /// Controls the cardinality of the output produced by the skill. Default is 'oneToMany'. + public DocumentIntelligenceLayoutSkillOutputMode? OutputMode { get; set; } + /// The depth of headers in the markdown output. Default is h6. + public DocumentIntelligenceLayoutSkillMarkdownHeaderDepth? MarkdownHeaderDepth { get; set; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.cs new file mode 100644 index 000000000000..b6b8060a33cf --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillMarkdownHeaderDepth.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// The depth of headers in the markdown output. Default is h6. + public readonly partial struct DocumentIntelligenceLayoutSkillMarkdownHeaderDepth : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string H1Value = "h1"; + private const string H2Value = "h2"; + private const string H3Value = "h3"; + private const string H4Value = "h4"; + private const string H5Value = "h5"; + private const string H6Value = "h6"; + + /// Header level 1. + public static DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H1 { get; } = new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(H1Value); + /// Header level 2. + public static DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H2 { get; } = new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(H2Value); + /// Header level 3. + public static DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H3 { get; } = new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(H3Value); + /// Header level 4. + public static DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H4 { get; } = new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(H4Value); + /// Header level 5. + public static DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H5 { get; } = new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(H5Value); + /// Header level 6. + public static DocumentIntelligenceLayoutSkillMarkdownHeaderDepth H6 { get; } = new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(H6Value); + /// Determines if two values are the same. + public static bool operator ==(DocumentIntelligenceLayoutSkillMarkdownHeaderDepth left, DocumentIntelligenceLayoutSkillMarkdownHeaderDepth right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentIntelligenceLayoutSkillMarkdownHeaderDepth left, DocumentIntelligenceLayoutSkillMarkdownHeaderDepth right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(string value) => new DocumentIntelligenceLayoutSkillMarkdownHeaderDepth(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentIntelligenceLayoutSkillMarkdownHeaderDepth other && Equals(other); + /// + public bool Equals(DocumentIntelligenceLayoutSkillMarkdownHeaderDepth other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillOutputMode.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillOutputMode.cs new file mode 100644 index 000000000000..50559c358b55 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/DocumentIntelligenceLayoutSkillOutputMode.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// Controls the cardinality of the output produced by the skill. Default is 'oneToMany'. + public readonly partial struct DocumentIntelligenceLayoutSkillOutputMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentIntelligenceLayoutSkillOutputMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OneToManyValue = "oneToMany"; + + /// Specify the deepest markdown header section to parse. + public static DocumentIntelligenceLayoutSkillOutputMode OneToMany { get; } = new DocumentIntelligenceLayoutSkillOutputMode(OneToManyValue); + /// Determines if two values are the same. + public static bool operator ==(DocumentIntelligenceLayoutSkillOutputMode left, DocumentIntelligenceLayoutSkillOutputMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentIntelligenceLayoutSkillOutputMode left, DocumentIntelligenceLayoutSkillOutputMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DocumentIntelligenceLayoutSkillOutputMode(string value) => new DocumentIntelligenceLayoutSkillOutputMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentIntelligenceLayoutSkillOutputMode other && Equals(other); + /// + public bool Equals(DocumentIntelligenceLayoutSkillOutputMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.Serialization.cs index 94a2ad5b3051..d40fe03b16fd 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.Serialization.cs @@ -19,6 +19,7 @@ internal static FacetResult DeserializeFacetResult(JsonElement element) return null; } long? count = default; + IReadOnlyDictionary> searchFacets = default; IReadOnlyDictionary additionalProperties = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -32,10 +33,36 @@ internal static FacetResult DeserializeFacetResult(JsonElement element) count = property.Value.GetInt64(); continue; } + if (property.NameEquals("@search.facets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary> dictionary = new Dictionary>(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DeserializeFacetResult(item)); + } + dictionary.Add(property0.Name, array); + } + } + searchFacets = dictionary; + continue; + } additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new FacetResult(count, additionalProperties); + return new FacetResult(count, searchFacets ?? new ChangeTrackingDictionary>(), additionalProperties); } /// Deserializes the model from a raw response. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.cs index 1d1e5251d686..fa48a3d346a9 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.cs @@ -15,19 +15,24 @@ public partial class FacetResult /// Initializes a new instance of . internal FacetResult() { + Facets = new ChangeTrackingDictionary>(); AdditionalProperties = new ChangeTrackingDictionary(); } /// Initializes a new instance of . /// The approximate count of documents falling within the bucket described by this facet. + /// The nested facet query results for the search operation, organized as a collection of buckets for each faceted field; null if the query did not contain any nested facets. /// Additional Properties. - internal FacetResult(long? count, IReadOnlyDictionary additionalProperties) + internal FacetResult(long? count, IReadOnlyDictionary> facets, IReadOnlyDictionary additionalProperties) { Count = count; + Facets = facets; AdditionalProperties = additionalProperties; } /// The approximate count of documents falling within the bucket described by this facet. public long? Count { get; } + /// The nested facet query results for the search operation, organized as a collection of buckets for each faceted field; null if the query did not contain any nested facets. + public IReadOnlyDictionary> Facets { get; } } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.Serialization.cs index 6179c10a859b..5dcb8ab792b7 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.Serialization.cs @@ -61,6 +61,30 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("firstLineContainsHeaders"u8); writer.WriteBooleanValue(FirstLineContainsHeaders.Value); } + if (Optional.IsDefined(MarkdownParsingSubmode)) + { + if (MarkdownParsingSubmode != null) + { + writer.WritePropertyName("markdownParsingSubmode"u8); + writer.WriteStringValue(MarkdownParsingSubmode.Value.ToString()); + } + else + { + writer.WriteNull("markdownParsingSubmode"); + } + } + if (Optional.IsDefined(MarkdownHeaderDepth)) + { + if (MarkdownHeaderDepth != null) + { + writer.WritePropertyName("markdownHeaderDepth"u8); + writer.WriteStringValue(MarkdownHeaderDepth.Value.ToString()); + } + else + { + writer.WriteNull("markdownHeaderDepth"); + } + } if (Optional.IsDefined(DocumentRoot)) { writer.WritePropertyName("documentRoot"u8); @@ -119,6 +143,8 @@ internal static IndexingParametersConfiguration DeserializeIndexingParametersCon string delimitedTextHeaders = default; string delimitedTextDelimiter = default; bool? firstLineContainsHeaders = default; + MarkdownParsingSubmode? markdownParsingSubmode = default; + MarkdownHeaderDepth? markdownHeaderDepth = default; string documentRoot = default; BlobIndexerDataToExtract? dataToExtract = default; BlobIndexerImageAction? imageAction = default; @@ -195,6 +221,26 @@ internal static IndexingParametersConfiguration DeserializeIndexingParametersCon firstLineContainsHeaders = property.Value.GetBoolean(); continue; } + if (property.NameEquals("markdownParsingSubmode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + markdownParsingSubmode = null; + continue; + } + markdownParsingSubmode = new MarkdownParsingSubmode(property.Value.GetString()); + continue; + } + if (property.NameEquals("markdownHeaderDepth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + markdownHeaderDepth = null; + continue; + } + markdownHeaderDepth = new MarkdownHeaderDepth(property.Value.GetString()); + continue; + } if (property.NameEquals("documentRoot"u8)) { documentRoot = property.Value.GetString(); @@ -263,6 +309,8 @@ internal static IndexingParametersConfiguration DeserializeIndexingParametersCon delimitedTextHeaders, delimitedTextDelimiter, firstLineContainsHeaders, + markdownParsingSubmode, + markdownHeaderDepth, documentRoot, dataToExtract, imageAction, diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.cs index d71817c7b4b5..65198da470e3 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/IndexingParametersConfiguration.cs @@ -28,6 +28,8 @@ public IndexingParametersConfiguration() /// For CSV blobs, specifies a comma-delimited list of column headers, useful for mapping source fields to destination fields in an index. /// For CSV blobs, specifies the end-of-line single-character delimiter for CSV files where each line starts a new document (for example, "|"). /// For CSV blobs, indicates that the first (non-blank) line of each blob contains headers. + /// Specifies the submode that will determine whether a markdown file will be parsed into exactly one search document or multiple search documents. Default is `oneToMany`. + /// Specifies the max header depth that will be considered while grouping markdown content. Default is `h6`. /// For JSON arrays, given a structured or semi-structured document, you can specify a path to the array using this property. /// Specifies the data to extract from Azure blob storage and tells the indexer which data to extract from image content when "imageAction" is set to a value other than "none". This applies to embedded image content in a .PDF or other application, or image files such as .jpg and .png, in Azure blobs. /// Determines how to process embedded images and image files in Azure blob storage. Setting the "imageAction" configuration to any value other than "none" requires that a skillset also be attached to that indexer. @@ -36,7 +38,7 @@ public IndexingParametersConfiguration() /// Specifies the environment in which the indexer should execute. /// Increases the timeout beyond the 5-minute default for Azure SQL database data sources, specified in the format "hh:mm:ss". /// Additional Properties. - internal IndexingParametersConfiguration(BlobIndexerParsingMode? parsingMode, string excludedFileNameExtensions, string indexedFileNameExtensions, bool? failOnUnsupportedContentType, bool? failOnUnprocessableDocument, bool? indexStorageMetadataOnlyForOversizedDocuments, string delimitedTextHeaders, string delimitedTextDelimiter, bool? firstLineContainsHeaders, string documentRoot, BlobIndexerDataToExtract? dataToExtract, BlobIndexerImageAction? imageAction, bool? allowSkillsetToReadFileData, BlobIndexerPdfTextRotationAlgorithm? pdfTextRotationAlgorithm, IndexerExecutionEnvironment? executionEnvironment, string queryTimeout, IDictionary additionalProperties) + internal IndexingParametersConfiguration(BlobIndexerParsingMode? parsingMode, string excludedFileNameExtensions, string indexedFileNameExtensions, bool? failOnUnsupportedContentType, bool? failOnUnprocessableDocument, bool? indexStorageMetadataOnlyForOversizedDocuments, string delimitedTextHeaders, string delimitedTextDelimiter, bool? firstLineContainsHeaders, MarkdownParsingSubmode? markdownParsingSubmode, MarkdownHeaderDepth? markdownHeaderDepth, string documentRoot, BlobIndexerDataToExtract? dataToExtract, BlobIndexerImageAction? imageAction, bool? allowSkillsetToReadFileData, BlobIndexerPdfTextRotationAlgorithm? pdfTextRotationAlgorithm, IndexerExecutionEnvironment? executionEnvironment, string queryTimeout, IDictionary additionalProperties) { ParsingMode = parsingMode; ExcludedFileNameExtensions = excludedFileNameExtensions; @@ -47,6 +49,8 @@ internal IndexingParametersConfiguration(BlobIndexerParsingMode? parsingMode, st DelimitedTextHeaders = delimitedTextHeaders; DelimitedTextDelimiter = delimitedTextDelimiter; FirstLineContainsHeaders = firstLineContainsHeaders; + MarkdownParsingSubmode = markdownParsingSubmode; + MarkdownHeaderDepth = markdownHeaderDepth; DocumentRoot = documentRoot; DataToExtract = dataToExtract; ImageAction = imageAction; @@ -75,6 +79,10 @@ internal IndexingParametersConfiguration(BlobIndexerParsingMode? parsingMode, st public string DelimitedTextDelimiter { get; set; } /// For CSV blobs, indicates that the first (non-blank) line of each blob contains headers. public bool? FirstLineContainsHeaders { get; set; } + /// Specifies the submode that will determine whether a markdown file will be parsed into exactly one search document or multiple search documents. Default is `oneToMany`. + public MarkdownParsingSubmode? MarkdownParsingSubmode { get; set; } + /// Specifies the max header depth that will be considered while grouping markdown content. Default is `h6`. + public MarkdownHeaderDepth? MarkdownHeaderDepth { get; set; } /// For JSON arrays, given a structured or semi-structured document, you can specify a path to the array using this property. public string DocumentRoot { get; set; } /// Specifies the data to extract from Azure blob storage and tells the indexer which data to extract from image content when "imageAction" is set to a value other than "none". This applies to embedded image content in a .PDF or other application, or image files such as .jpg and .png, in Azure blobs. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownHeaderDepth.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownHeaderDepth.cs new file mode 100644 index 000000000000..eb933891ce05 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownHeaderDepth.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// Specifies the max header depth that will be considered while grouping markdown content. Default is `h6`. + public readonly partial struct MarkdownHeaderDepth : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MarkdownHeaderDepth(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string H1Value = "h1"; + private const string H2Value = "h2"; + private const string H3Value = "h3"; + private const string H4Value = "h4"; + private const string H5Value = "h5"; + private const string H6Value = "h6"; + + /// Indicates that headers up to a level of h1 will be considered while grouping markdown content. + public static MarkdownHeaderDepth H1 { get; } = new MarkdownHeaderDepth(H1Value); + /// Indicates that headers up to a level of h2 will be considered while grouping markdown content. + public static MarkdownHeaderDepth H2 { get; } = new MarkdownHeaderDepth(H2Value); + /// Indicates that headers up to a level of h3 will be considered while grouping markdown content. + public static MarkdownHeaderDepth H3 { get; } = new MarkdownHeaderDepth(H3Value); + /// Indicates that headers up to a level of h4 will be considered while grouping markdown content. + public static MarkdownHeaderDepth H4 { get; } = new MarkdownHeaderDepth(H4Value); + /// Indicates that headers up to a level of h5 will be considered while grouping markdown content. + public static MarkdownHeaderDepth H5 { get; } = new MarkdownHeaderDepth(H5Value); + /// Indicates that headers up to a level of h6 will be considered while grouping markdown content. This is the default. + public static MarkdownHeaderDepth H6 { get; } = new MarkdownHeaderDepth(H6Value); + /// Determines if two values are the same. + public static bool operator ==(MarkdownHeaderDepth left, MarkdownHeaderDepth right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MarkdownHeaderDepth left, MarkdownHeaderDepth right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MarkdownHeaderDepth(string value) => new MarkdownHeaderDepth(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MarkdownHeaderDepth other && Equals(other); + /// + public bool Equals(MarkdownHeaderDepth other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownParsingSubmode.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownParsingSubmode.cs new file mode 100644 index 000000000000..f272b7fc8e97 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/MarkdownParsingSubmode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// Specifies the submode that will determine whether a markdown file will be parsed into exactly one search document or multiple search documents. Default is `oneToMany`. + public readonly partial struct MarkdownParsingSubmode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MarkdownParsingSubmode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OneToManyValue = "oneToMany"; + private const string OneToOneValue = "oneToOne"; + + /// Indicates that each section of the markdown file (up to a specified depth) will be parsed into individual search documents. This can result in a single markdown file producing multiple search documents. This is the default sub-mode. + public static MarkdownParsingSubmode OneToMany { get; } = new MarkdownParsingSubmode(OneToManyValue); + /// Indicates that each markdown file will be parsed into a single search document. + public static MarkdownParsingSubmode OneToOne { get; } = new MarkdownParsingSubmode(OneToOneValue); + /// Determines if two values are the same. + public static bool operator ==(MarkdownParsingSubmode left, MarkdownParsingSubmode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MarkdownParsingSubmode left, MarkdownParsingSubmode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MarkdownParsingSubmode(string value) => new MarkdownParsingSubmode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MarkdownParsingSubmode other && Equals(other); + /// + public bool Equals(MarkdownParsingSubmode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryAnswerType.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryAnswerType.cs index 0f0cd8f4faf0..814f115eedbf 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryAnswerType.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryAnswerType.cs @@ -10,7 +10,7 @@ namespace Azure.Search.Documents.Models { - /// This parameter is only valid if the query type is `semantic`. If set, the query returns answers extracted from key passages in the highest ranked documents. The number of answers returned can be configured by appending the pipe character `|` followed by the `count-<number of answers>` option after the answers parameter value, such as `extractive|count-3`. Default count is 1. The confidence threshold can be configured by appending the pipe character `|` followed by the `threshold-<confidence threshold>` option after the answers parameter value, such as `extractive|threshold-0.9`. Default threshold is 0.7. + /// This parameter is only valid if the query type is `semantic`. If set, the query returns answers extracted from key passages in the highest ranked documents. The number of answers returned can be configured by appending the pipe character `|` followed by the `count-<number of answers>` option after the answers parameter value, such as `extractive|count-3`. Default count is 1. The confidence threshold can be configured by appending the pipe character `|` followed by the `threshold-<confidence threshold>` option after the answers parameter value, such as `extractive|threshold-0.9`. Default threshold is 0.7. The maximum character length of answers can be configured by appending the pipe character '|' followed by the 'count-<number of maximum character length>', such as 'extractive|maxcharlength-600'. public readonly partial struct QueryAnswerType : IEquatable { private readonly string _value; diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryCaptionType.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryCaptionType.cs index c663d22c8e60..f15e06988591 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryCaptionType.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryCaptionType.cs @@ -10,7 +10,7 @@ namespace Azure.Search.Documents.Models { - /// This parameter is only valid if the query type is `semantic`. If set, the query returns captions extracted from key passages in the highest ranked documents. When Captions is set to `extractive`, highlighting is enabled by default, and can be configured by appending the pipe character `|` followed by the `highlight-<true/false>` option, such as `extractive|highlight-true`. Defaults to `None`. + /// This parameter is only valid if the query type is `semantic`. If set, the query returns captions extracted from key passages in the highest ranked documents. When Captions is set to `extractive`, highlighting is enabled by default, and can be configured by appending the pipe character `|` followed by the `highlight-<true/false>` option, such as `extractive|highlight-true`. Defaults to `None`. The maximum character length of captions can be configured by appending the pipe character '|' followed by the 'count-<number of maximum character length>', such as 'extractive|maxcharlength-600'. public readonly partial struct QueryCaptionType : IEquatable { private readonly string _value; diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryDebugMode.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryDebugMode.cs index b16ba6570892..28bc67685efc 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryDebugMode.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryDebugMode.cs @@ -10,7 +10,7 @@ namespace Azure.Search.Documents.Models { - /// Enables a debugging tool that can be used to further explore your search results. + /// Enables a debugging tool that can be used to further explore your search results. You can enable multiple debug modes simultaneously by separating them with a | character, for example: semantic|queryRewrites. public readonly partial struct QueryDebugMode : IEquatable { private readonly string _value; @@ -24,11 +24,20 @@ public QueryDebugMode(string value) private const string DisabledValue = "disabled"; private const string SemanticValue = "semantic"; + private const string VectorValue = "vector"; + private const string QueryRewritesValue = "queryRewrites"; + private const string AllValue = "all"; /// No query debugging information will be returned. public static QueryDebugMode Disabled { get; } = new QueryDebugMode(DisabledValue); /// Allows the user to further explore their reranked results. public static QueryDebugMode Semantic { get; } = new QueryDebugMode(SemanticValue); + /// Allows the user to further explore their hybrid and vector query results. + public static QueryDebugMode Vector { get; } = new QueryDebugMode(VectorValue); + /// Allows the user to explore the list of query rewrites generated for their search request. + public static QueryDebugMode QueryRewrites { get; } = new QueryDebugMode(QueryRewritesValue); + /// Turn on all debug options. + public static QueryDebugMode All { get; } = new QueryDebugMode(AllValue); /// Determines if two values are the same. public static bool operator ==(QueryDebugMode left, QueryDebugMode right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.Serialization.cs new file mode 100644 index 000000000000..ff03080d8132 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Search.Documents.Models +{ + public partial class QueryRewritesDebugInfo + { + internal static QueryRewritesDebugInfo DeserializeQueryRewritesDebugInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + QueryRewritesValuesDebugInfo text = default; + IReadOnlyList vectors = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + text = QueryRewritesValuesDebugInfo.DeserializeQueryRewritesValuesDebugInfo(property.Value); + continue; + } + if (property.NameEquals("vectors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QueryRewritesValuesDebugInfo.DeserializeQueryRewritesValuesDebugInfo(item)); + } + vectors = array; + continue; + } + } + return new QueryRewritesDebugInfo(text, vectors ?? new ChangeTrackingList()); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static QueryRewritesDebugInfo FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueryRewritesDebugInfo(document.RootElement); + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.cs new file mode 100644 index 000000000000..29f0f869191e --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesDebugInfo.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Search.Documents.Models +{ + /// Contains debugging information specific to query rewrites. + public partial class QueryRewritesDebugInfo + { + /// Initializes a new instance of . + internal QueryRewritesDebugInfo() + { + Vectors = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of query rewrites generated for the text query. + /// List of query rewrites generated for the vectorizable text queries. + internal QueryRewritesDebugInfo(QueryRewritesValuesDebugInfo text, IReadOnlyList vectors) + { + Text = text; + Vectors = vectors; + } + + /// List of query rewrites generated for the text query. + public QueryRewritesValuesDebugInfo Text { get; } + /// List of query rewrites generated for the vectorizable text queries. + public IReadOnlyList Vectors { get; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesType.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesType.cs new file mode 100644 index 000000000000..021ee136c23d --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Search.Documents.Models +{ + /// This parameter is only valid if the query type is `semantic`. When QueryRewrites is set to `generative`, the query terms are sent to a generate model which will produce 10 (default) rewrites to help increase the recall of the request. The requested count can be configured by appending the pipe character `|` followed by the `count-<number of rewrites>` option, such as `generative|count-3`. Defaults to `None`. + public readonly partial struct QueryRewritesType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QueryRewritesType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "none"; + private const string GenerativeValue = "generative"; + + /// Do not generate additional query rewrites for this query. + public static QueryRewritesType None { get; } = new QueryRewritesType(NoneValue); + /// Generate alternative query terms to increase the recall of a search request. + public static QueryRewritesType Generative { get; } = new QueryRewritesType(GenerativeValue); + /// Determines if two values are the same. + public static bool operator ==(QueryRewritesType left, QueryRewritesType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QueryRewritesType left, QueryRewritesType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator QueryRewritesType(string value) => new QueryRewritesType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QueryRewritesType other && Equals(other); + /// + public bool Equals(QueryRewritesType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.Serialization.cs new file mode 100644 index 000000000000..a1d641a36434 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Search.Documents.Models +{ + public partial class QueryRewritesValuesDebugInfo + { + internal static QueryRewritesValuesDebugInfo DeserializeQueryRewritesValuesDebugInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string inputQuery = default; + IReadOnlyList rewrites = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("inputQuery"u8)) + { + inputQuery = property.Value.GetString(); + continue; + } + if (property.NameEquals("rewrites"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + rewrites = array; + continue; + } + } + return new QueryRewritesValuesDebugInfo(inputQuery, rewrites ?? new ChangeTrackingList()); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static QueryRewritesValuesDebugInfo FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueryRewritesValuesDebugInfo(document.RootElement); + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.cs new file mode 100644 index 000000000000..953d64ae6719 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/QueryRewritesValuesDebugInfo.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Search.Documents.Models +{ + /// Contains debugging information specific to query rewrites. + public partial class QueryRewritesValuesDebugInfo + { + /// Initializes a new instance of . + internal QueryRewritesValuesDebugInfo() + { + Rewrites = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The input text to the generative query rewriting model. There may be cases where the user query and the input to the generative model are not identical. + /// List of query rewrites. + internal QueryRewritesValuesDebugInfo(string inputQuery, IReadOnlyList rewrites) + { + InputQuery = inputQuery; + Rewrites = rewrites; + } + + /// The input text to the generative query rewriting model. There may be cases where the user query and the input to the generative model are not identical. + public string InputQuery { get; } + /// List of query rewrites. + public IReadOnlyList Rewrites { get; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.Serialization.cs new file mode 100644 index 000000000000..4dc692a0a327 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Search.Documents.Indexes.Models +{ + public partial class RescoringOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(EnableRescoring)) + { + if (EnableRescoring != null) + { + writer.WritePropertyName("enableRescoring"u8); + writer.WriteBooleanValue(EnableRescoring.Value); + } + else + { + writer.WriteNull("enableRescoring"); + } + } + if (Optional.IsDefined(DefaultOversampling)) + { + if (DefaultOversampling != null) + { + writer.WritePropertyName("defaultOversampling"u8); + writer.WriteNumberValue(DefaultOversampling.Value); + } + else + { + writer.WriteNull("defaultOversampling"); + } + } + if (Optional.IsDefined(RescoreStorageMethod)) + { + if (RescoreStorageMethod != null) + { + writer.WritePropertyName("rescoreStorageMethod"u8); + writer.WriteStringValue(RescoreStorageMethod.Value.ToString()); + } + else + { + writer.WriteNull("rescoreStorageMethod"); + } + } + writer.WriteEndObject(); + } + + internal static RescoringOptions DeserializeRescoringOptions(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enableRescoring = default; + double? defaultOversampling = default; + VectorSearchCompressionRescoreStorageMethod? rescoreStorageMethod = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enableRescoring"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + enableRescoring = null; + continue; + } + enableRescoring = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("defaultOversampling"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + defaultOversampling = null; + continue; + } + defaultOversampling = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("rescoreStorageMethod"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rescoreStorageMethod = null; + continue; + } + rescoreStorageMethod = new VectorSearchCompressionRescoreStorageMethod(property.Value.GetString()); + continue; + } + } + return new RescoringOptions(enableRescoring, defaultOversampling, rescoreStorageMethod); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RescoringOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRescoringOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.cs new file mode 100644 index 000000000000..e267c291cf03 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/RescoringOptions.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Search.Documents.Indexes.Models +{ + /// Contains the options for rescoring. + public partial class RescoringOptions + { + /// Initializes a new instance of . + public RescoringOptions() + { + } + + /// Initializes a new instance of . + /// If set to true, after the initial search on the compressed vectors, the similarity scores are recalculated using the full-precision vectors. This will improve recall at the expense of latency. + /// Default oversampling factor. Oversampling retrieves a greater set of potential documents to offset the resolution loss due to quantization. This increases the set of results that will be rescored on full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when 'enableRescoring' is true. Higher values improve recall at the expense of latency. + /// Controls the storage method for original vectors. This setting is immutable. + internal RescoringOptions(bool? enableRescoring, double? defaultOversampling, VectorSearchCompressionRescoreStorageMethod? rescoreStorageMethod) + { + EnableRescoring = enableRescoring; + DefaultOversampling = defaultOversampling; + RescoreStorageMethod = rescoreStorageMethod; + } + + /// If set to true, after the initial search on the compressed vectors, the similarity scores are recalculated using the full-precision vectors. This will improve recall at the expense of latency. + public bool? EnableRescoring { get; set; } + /// Default oversampling factor. Oversampling retrieves a greater set of potential documents to offset the resolution loss due to quantization. This increases the set of results that will be rescored on full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when 'enableRescoring' is true. Higher values improve recall at the expense of latency. + public double? DefaultOversampling { get; set; } + /// Controls the storage method for original vectors. This setting is immutable. + public VectorSearchCompressionRescoreStorageMethod? RescoreStorageMethod { get; set; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.Serialization.cs index 4aa40f5a5007..2b9bbefaa19b 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.Serialization.cs @@ -41,6 +41,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("defaultOversampling"); } } + if (Optional.IsDefined(RescoringOptions)) + { + if (RescoringOptions != null) + { + writer.WritePropertyName("rescoringOptions"u8); + writer.WriteObjectValue(RescoringOptions); + } + else + { + writer.WriteNull("rescoringOptions"); + } + } if (Optional.IsDefined(TruncationDimension)) { if (TruncationDimension != null) @@ -67,6 +79,7 @@ internal static ScalarQuantizationCompression DeserializeScalarQuantizationCompr VectorSearchCompressionKind kind = default; bool? rerankWithOriginalVectors = default; double? defaultOversampling = default; + RescoringOptions rescoringOptions = default; int? truncationDimension = default; foreach (var property in element.EnumerateObject()) { @@ -108,6 +121,16 @@ internal static ScalarQuantizationCompression DeserializeScalarQuantizationCompr defaultOversampling = property.Value.GetDouble(); continue; } + if (property.NameEquals("rescoringOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rescoringOptions = null; + continue; + } + rescoringOptions = RescoringOptions.DeserializeRescoringOptions(property.Value); + continue; + } if (property.NameEquals("truncationDimension"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -124,6 +147,7 @@ internal static ScalarQuantizationCompression DeserializeScalarQuantizationCompr kind, rerankWithOriginalVectors, defaultOversampling, + rescoringOptions, truncationDimension, scalarQuantizationParameters); } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.cs index 1b12f256d8d0..fa10f9817a63 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/ScalarQuantizationCompression.cs @@ -27,9 +27,10 @@ public ScalarQuantizationCompression(string compressionName) : base(compressionN /// The name of the kind of compression method being configured for use with vector search. /// If set to true, once the ordered set of results calculated using compressed vectors are obtained, they will be reranked again by recalculating the full-precision similarity scores. This will improve recall at the expense of latency. /// Default oversampling factor. Oversampling will internally request more documents (specified by this multiplier) in the initial search. This increases the set of results that will be reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve recall at the expense of latency. + /// Contains the options for rescoring. /// The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save storage cost and improve search performance at the expense of recall. It should be only used for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no truncation. /// Contains the parameters specific to Scalar Quantization. - internal ScalarQuantizationCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, int? truncationDimension, ScalarQuantizationParameters parameters) : base(compressionName, kind, rerankWithOriginalVectors, defaultOversampling, truncationDimension) + internal ScalarQuantizationCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, RescoringOptions rescoringOptions, int? truncationDimension, ScalarQuantizationParameters parameters) : base(compressionName, kind, rerankWithOriginalVectors, defaultOversampling, rescoringOptions, truncationDimension) { Parameters = parameters; Kind = kind; diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.Serialization.cs index 7c024b535490..7a32b94b3d23 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.Serialization.cs @@ -22,11 +22,13 @@ internal static SearchDocumentsResult DeserializeSearchDocumentsResult(JsonEleme double? searchCoverage = default; IReadOnlyDictionary> searchFacets = default; IReadOnlyList searchAnswers = default; + DebugInfo searchDebugInfo = default; SearchOptions searchNextPageParameters = default; IReadOnlyList value = default; string odataNextLink = default; SemanticErrorReason? searchSemanticPartialResponseReason = default; SemanticSearchResultsType? searchSemanticPartialResponseType = default; + SemanticQueryRewritesResultType? searchSemanticQueryRewritesResultType = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("@odata.count"u8)) @@ -88,6 +90,16 @@ internal static SearchDocumentsResult DeserializeSearchDocumentsResult(JsonEleme searchAnswers = array; continue; } + if (property.NameEquals("@search.debugInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + searchDebugInfo = null; + continue; + } + searchDebugInfo = DebugInfo.DeserializeDebugInfo(property.Value); + continue; + } if (property.NameEquals("@search.nextPageParameters"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -130,17 +142,28 @@ internal static SearchDocumentsResult DeserializeSearchDocumentsResult(JsonEleme searchSemanticPartialResponseType = new SemanticSearchResultsType(property.Value.GetString()); continue; } + if (property.NameEquals("@search.semanticQueryRewritesResultType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + searchSemanticQueryRewritesResultType = new SemanticQueryRewritesResultType(property.Value.GetString()); + continue; + } } return new SearchDocumentsResult( odataCount, searchCoverage, searchFacets ?? new ChangeTrackingDictionary>(), searchAnswers ?? new ChangeTrackingList(), + searchDebugInfo, searchNextPageParameters, value, odataNextLink, searchSemanticPartialResponseReason, - searchSemanticPartialResponseType); + searchSemanticPartialResponseType, + searchSemanticQueryRewritesResultType); } /// Deserializes the model from a raw response. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.cs index dd01afb9b556..1e3b5acb2fff 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchDocumentsResult.cs @@ -27,22 +27,26 @@ internal SearchDocumentsResult(IEnumerable results) /// A value indicating the percentage of the index that was included in the query, or null if minimumCoverage was not specified in the request. /// The facet query results for the search operation, organized as a collection of buckets for each faceted field; null if the query did not include any facet expressions. /// The answers query results for the search operation; null if the answers query parameter was not specified or set to 'none'. + /// Debug information that applies to the search results as a whole. /// Continuation JSON payload returned when the query can't return all the requested results in a single response. You can use this JSON along with @odata.nextLink to formulate another POST Search request to get the next part of the search response. /// The sequence of results returned by the query. /// Continuation URL returned when the query can't return all the requested results in a single response. You can use this URL to formulate another GET or POST Search request to get the next part of the search response. Make sure to use the same verb (GET or POST) as the request that produced this response. /// Reason that a partial response was returned for a semantic ranking request. /// Type of partial response that was returned for a semantic ranking request. - internal SearchDocumentsResult(long? count, double? coverage, IReadOnlyDictionary> facets, IReadOnlyList answers, SearchOptions nextPageParameters, IReadOnlyList results, string nextLink, SemanticErrorReason? semanticPartialResponseReason, SemanticSearchResultsType? semanticPartialResponseType) + /// Type of query rewrite that was used to retrieve documents. + internal SearchDocumentsResult(long? count, double? coverage, IReadOnlyDictionary> facets, IReadOnlyList answers, DebugInfo debugInfo, SearchOptions nextPageParameters, IReadOnlyList results, string nextLink, SemanticErrorReason? semanticPartialResponseReason, SemanticSearchResultsType? semanticPartialResponseType, SemanticQueryRewritesResultType? semanticQueryRewritesResultType) { Count = count; Coverage = coverage; Facets = facets; Answers = answers; + DebugInfo = debugInfo; NextPageParameters = nextPageParameters; Results = results; NextLink = nextLink; SemanticPartialResponseReason = semanticPartialResponseReason; SemanticPartialResponseType = semanticPartialResponseType; + SemanticQueryRewritesResultType = semanticQueryRewritesResultType; } /// The total count of results found by the search operation, or null if the count was not requested. If present, the count may be greater than the number of results in this response. This can happen if you use the $top or $skip parameters, or if the query can't return all the requested documents in a single response. @@ -53,6 +57,8 @@ internal SearchDocumentsResult(long? count, double? coverage, IReadOnlyDictionar public IReadOnlyDictionary> Facets { get; } /// The answers query results for the search operation; null if the answers query parameter was not specified or set to 'none'. public IReadOnlyList Answers { get; } + /// Debug information that applies to the search results as a whole. + public DebugInfo DebugInfo { get; } /// Continuation JSON payload returned when the query can't return all the requested results in a single response. You can use this JSON along with @odata.nextLink to formulate another POST Search request to get the next part of the search response. public SearchOptions NextPageParameters { get; } /// The sequence of results returned by the query. @@ -63,5 +69,7 @@ internal SearchDocumentsResult(long? count, double? coverage, IReadOnlyDictionar public SemanticErrorReason? SemanticPartialResponseReason { get; } /// Type of partial response that was returned for a semantic ranking request. public SemanticSearchResultsType? SemanticPartialResponseType { get; } + /// Type of query rewrite that was used to retrieve documents. + public SemanticQueryRewritesResultType? SemanticQueryRewritesResultType { get; } } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.Serialization.cs index ab55a8bad84a..d755e1859971 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.Serialization.cs @@ -77,6 +77,7 @@ internal static SearchIndexerSkill DeserializeSearchIndexerSkill(JsonElement ele case "#Microsoft.Skills.Text.V3.SentimentSkill": return SentimentSkillV3.DeserializeSentimentSkillV3(element); case "#Microsoft.Skills.Util.ConditionalSkill": return ConditionalSkill.DeserializeConditionalSkill(element); case "#Microsoft.Skills.Util.DocumentExtractionSkill": return DocumentExtractionSkill.DeserializeDocumentExtractionSkill(element); + case "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill": return DocumentIntelligenceLayoutSkill.DeserializeDocumentIntelligenceLayoutSkill(element); case "#Microsoft.Skills.Util.ShaperSkill": return ShaperSkill.DeserializeShaperSkill(element); case "#Microsoft.Skills.Vision.ImageAnalysisSkill": return ImageAnalysisSkill.DeserializeImageAnalysisSkill(element); case "#Microsoft.Skills.Vision.OcrSkill": return OcrSkill.DeserializeOcrSkill(element); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.cs index 654052bfd6d7..bf57982dd95d 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkill.cs @@ -14,7 +14,7 @@ namespace Azure.Search.Documents.Indexes.Models /// /// Base type for skills. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , , , , , , , , and . /// public partial class SearchIndexerSkill { diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkillset.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkillset.cs index fdcb717b4b16..764d79fd01c7 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkillset.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchIndexerSkillset.cs @@ -19,7 +19,7 @@ public partial class SearchIndexerSkillset /// /// A list of skills in the skillset. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , , , , , , , , and . /// /// or is null. public SearchIndexerSkillset(string name, IEnumerable skills) @@ -37,12 +37,12 @@ public SearchIndexerSkillset(string name, IEnumerable skills /// /// A list of skills in the skillset. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , , , , , , , , and . /// /// /// Details about the Azure AI service to be used when running skills. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// /// Definition of additional projections to Azure blob, table, or files, of enriched data. /// Definition of additional projections to secondary search index(es). @@ -67,7 +67,7 @@ internal SearchIndexerSkillset(string name, string description, IList /// Details about the Azure AI service to be used when running skills. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// public CognitiveServicesAccount CognitiveServicesAccount { get; set; } /// Definition of additional projections to Azure blob, table, or files, of enriched data. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.Serialization.cs index 0cbedf7f74d1..ca278763d892 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.Serialization.cs @@ -174,6 +174,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("captions"u8); writer.WriteStringValue(QueryCaptionRaw); } + if (Optional.IsDefined(QueryRewrites)) + { + writer.WritePropertyName("queryRewrites"u8); + writer.WriteStringValue(QueryRewrites.Value.ToString()); + } if (Optional.IsDefined(SemanticFieldsRaw)) { writer.WritePropertyName("semanticFields"u8); @@ -236,6 +241,7 @@ internal static SearchOptions DeserializeSearchOptions(JsonElement element) string semanticQuery = default; string answers = default; string captions = default; + QueryRewritesType? queryRewrites = default; string semanticFields = default; IList vectorQueries = default; VectorFilterMode? vectorFilterMode = default; @@ -449,6 +455,15 @@ internal static SearchOptions DeserializeSearchOptions(JsonElement element) captions = property.Value.GetString(); continue; } + if (property.NameEquals("queryRewrites"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queryRewrites = new QueryRewritesType(property.Value.GetString()); + continue; + } if (property.NameEquals("semanticFields"u8)) { semanticFields = property.Value.GetString(); @@ -516,6 +531,7 @@ internal static SearchOptions DeserializeSearchOptions(JsonElement element) semanticQuery, answers, captions, + queryRewrites, semanticFields, vectorQueries ?? new ChangeTrackingList(), vectorFilterMode, diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.cs index 3294808d5c87..117c0e32276a 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchOptions.cs @@ -50,6 +50,7 @@ public SearchOptions() /// Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different queries between the base retrieval and ranking phase, and the L2 semantic phase. /// A value that specifies whether answers should be returned as part of the search response. /// A value that specifies whether captions should be returned as part of the search response. + /// A value that specifies whether query rewrites should be generated to augment the search query. /// The comma-separated list of field names used for semantic ranking. /// /// The query parameters for vector and hybrid search queries. @@ -58,7 +59,7 @@ public SearchOptions() /// /// Determines whether or not filters are applied before or after the vector search is performed. Default is 'preFilter' for new indexes. /// The query parameters to configure hybrid search behaviors. - internal SearchOptions(bool? includeTotalCount, IList facets, string filter, string highlightFieldsRaw, string highlightPostTag, string highlightPreTag, double? minimumCoverage, string orderByRaw, SearchQueryType? queryType, ScoringStatistics? scoringStatistics, string sessionId, IList scoringParameters, string scoringProfile, QueryDebugMode? debug, string searchText, string searchFieldsRaw, SearchMode? searchMode, QueryLanguage? queryLanguage, QuerySpellerType? querySpeller, string selectRaw, int? skip, int? size, string semanticConfigurationName, SemanticErrorMode? semanticErrorMode, int? semanticMaxWaitInMilliseconds, string semanticQuery, string queryAnswerRaw, string queryCaptionRaw, string semanticFieldsRaw, IList vectorQueries, VectorFilterMode? filterMode, HybridSearch hybridSearch) + internal SearchOptions(bool? includeTotalCount, IList facets, string filter, string highlightFieldsRaw, string highlightPostTag, string highlightPreTag, double? minimumCoverage, string orderByRaw, SearchQueryType? queryType, ScoringStatistics? scoringStatistics, string sessionId, IList scoringParameters, string scoringProfile, QueryDebugMode? debug, string searchText, string searchFieldsRaw, SearchMode? searchMode, QueryLanguage? queryLanguage, QuerySpellerType? querySpeller, string selectRaw, int? skip, int? size, string semanticConfigurationName, SemanticErrorMode? semanticErrorMode, int? semanticMaxWaitInMilliseconds, string semanticQuery, string queryAnswerRaw, string queryCaptionRaw, QueryRewritesType? queryRewrites, string semanticFieldsRaw, IList vectorQueries, VectorFilterMode? filterMode, HybridSearch hybridSearch) { IncludeTotalCount = includeTotalCount; Facets = facets; @@ -88,6 +89,7 @@ internal SearchOptions(bool? includeTotalCount, IList facets, string fil SemanticQuery = semanticQuery; QueryAnswerRaw = queryAnswerRaw; QueryCaptionRaw = queryCaptionRaw; + QueryRewrites = queryRewrites; SemanticFieldsRaw = semanticFieldsRaw; VectorQueries = vectorQueries; FilterMode = filterMode; @@ -111,6 +113,8 @@ internal SearchOptions(bool? includeTotalCount, IList facets, string fil public SearchMode? SearchMode { get; set; } /// The number of search results to skip. This value cannot be greater than 100,000. If you need to scan documents in sequence, but cannot use skip due to this limitation, consider using orderby on a totally-ordered key and filter with a range query instead. public int? Skip { get; set; } + /// A value that specifies whether query rewrites should be generated to augment the search query. + public QueryRewritesType? QueryRewrites { get; set; } /// The query parameters to configure hybrid search behaviors. public HybridSearch HybridSearch { get; set; } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SemanticQueryRewritesResultType.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SemanticQueryRewritesResultType.cs new file mode 100644 index 000000000000..c62707a49a1e --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SemanticQueryRewritesResultType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Search.Documents.Models +{ + /// Type of query rewrite that was used for this request. + public readonly partial struct SemanticQueryRewritesResultType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SemanticQueryRewritesResultType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OriginalQueryOnlyValue = "originalQueryOnly"; + + /// Query rewrites were not successfully generated for this request. Only the original query was used to retrieve the results. + public static SemanticQueryRewritesResultType OriginalQueryOnly { get; } = new SemanticQueryRewritesResultType(OriginalQueryOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(SemanticQueryRewritesResultType left, SemanticQueryRewritesResultType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SemanticQueryRewritesResultType left, SemanticQueryRewritesResultType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SemanticQueryRewritesResultType(string value) => new SemanticQueryRewritesResultType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SemanticQueryRewritesResultType other && Equals(other); + /// + public bool Equals(SemanticQueryRewritesResultType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.Serialization.cs index 30bd51bddf5a..0e7edefbd8f3 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.Serialization.cs @@ -37,6 +37,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("defaultOversampling"); } } + if (Optional.IsDefined(RescoringOptions)) + { + if (RescoringOptions != null) + { + writer.WritePropertyName("rescoringOptions"u8); + writer.WriteObjectValue(RescoringOptions); + } + else + { + writer.WriteNull("rescoringOptions"); + } + } if (Optional.IsDefined(TruncationDimension)) { if (TruncationDimension != null) @@ -62,6 +74,7 @@ internal static UnknownVectorSearchCompression DeserializeUnknownVectorSearchCom VectorSearchCompressionKind kind = "Unknown"; bool? rerankWithOriginalVectors = default; double? defaultOversampling = default; + RescoringOptions rescoringOptions = default; int? truncationDimension = default; foreach (var property in element.EnumerateObject()) { @@ -94,6 +107,16 @@ internal static UnknownVectorSearchCompression DeserializeUnknownVectorSearchCom defaultOversampling = property.Value.GetDouble(); continue; } + if (property.NameEquals("rescoringOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rescoringOptions = null; + continue; + } + rescoringOptions = RescoringOptions.DeserializeRescoringOptions(property.Value); + continue; + } if (property.NameEquals("truncationDimension"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -105,7 +128,13 @@ internal static UnknownVectorSearchCompression DeserializeUnknownVectorSearchCom continue; } } - return new UnknownVectorSearchCompression(name, kind, rerankWithOriginalVectors, defaultOversampling, truncationDimension); + return new UnknownVectorSearchCompression( + name, + kind, + rerankWithOriginalVectors, + defaultOversampling, + rescoringOptions, + truncationDimension); } /// Deserializes the model from a raw response. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.cs index 93e86095b5e3..612fd27720b5 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/UnknownVectorSearchCompression.cs @@ -17,8 +17,9 @@ internal partial class UnknownVectorSearchCompression : VectorSearchCompression /// The name of the kind of compression method being configured for use with vector search. /// If set to true, once the ordered set of results calculated using compressed vectors are obtained, they will be reranked again by recalculating the full-precision similarity scores. This will improve recall at the expense of latency. /// Default oversampling factor. Oversampling will internally request more documents (specified by this multiplier) in the initial search. This increases the set of results that will be reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve recall at the expense of latency. + /// Contains the options for rescoring. /// The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save storage cost and improve search performance at the expense of recall. It should be only used for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no truncation. - internal UnknownVectorSearchCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, int? truncationDimension) : base(compressionName, kind, rerankWithOriginalVectors, defaultOversampling, truncationDimension) + internal UnknownVectorSearchCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, RescoringOptions rescoringOptions, int? truncationDimension) : base(compressionName, kind, rerankWithOriginalVectors, defaultOversampling, rescoringOptions, truncationDimension) { Kind = kind; } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.Serialization.cs index 1a51ff1767ad..690f77d5b99d 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.Serialization.cs @@ -37,6 +37,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("defaultOversampling"); } } + if (Optional.IsDefined(RescoringOptions)) + { + if (RescoringOptions != null) + { + writer.WritePropertyName("rescoringOptions"u8); + writer.WriteObjectValue(RescoringOptions); + } + else + { + writer.WriteNull("rescoringOptions"); + } + } if (Optional.IsDefined(TruncationDimension)) { if (TruncationDimension != null) diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.cs index b5d297016c01..d0b140a9f607 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompression.cs @@ -31,13 +31,15 @@ protected VectorSearchCompression(string compressionName) /// The name of the kind of compression method being configured for use with vector search. /// If set to true, once the ordered set of results calculated using compressed vectors are obtained, they will be reranked again by recalculating the full-precision similarity scores. This will improve recall at the expense of latency. /// Default oversampling factor. Oversampling will internally request more documents (specified by this multiplier) in the initial search. This increases the set of results that will be reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve recall at the expense of latency. + /// Contains the options for rescoring. /// The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save storage cost and improve search performance at the expense of recall. It should be only used for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no truncation. - internal VectorSearchCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, int? truncationDimension) + internal VectorSearchCompression(string compressionName, VectorSearchCompressionKind kind, bool? rerankWithOriginalVectors, double? defaultOversampling, RescoringOptions rescoringOptions, int? truncationDimension) { CompressionName = compressionName; Kind = kind; RerankWithOriginalVectors = rerankWithOriginalVectors; DefaultOversampling = defaultOversampling; + RescoringOptions = rescoringOptions; TruncationDimension = truncationDimension; } /// The name of the kind of compression method being configured for use with vector search. @@ -46,6 +48,8 @@ internal VectorSearchCompression(string compressionName, VectorSearchCompression public bool? RerankWithOriginalVectors { get; set; } /// Default oversampling factor. Oversampling will internally request more documents (specified by this multiplier) in the initial search. This increases the set of results that will be reranked using recomputed similarity scores from full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This parameter can only be set when rerankWithOriginalVectors is true. Higher values improve recall at the expense of latency. public double? DefaultOversampling { get; set; } + /// Contains the options for rescoring. + public RescoringOptions RescoringOptions { get; set; } /// The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of the vectors and the amount of data that needs to be transferred during search. This can save storage cost and improve search performance at the expense of recall. It should be only used for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no truncation. public int? TruncationDimension { get; set; } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompressionRescoreStorageMethod.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompressionRescoreStorageMethod.cs new file mode 100644 index 000000000000..6a745f14d47c --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorSearchCompressionRescoreStorageMethod.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// The storage method for the original full-precision vectors used for rescoring and internal index operations. + public readonly partial struct VectorSearchCompressionRescoreStorageMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VectorSearchCompressionRescoreStorageMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PreserveOriginalsValue = "preserveOriginals"; + private const string DiscardOriginalsValue = "discardOriginals"; + + /// This option preserves the original full-precision vectors. Choose this option for maximum flexibility and highest quality of compressed search results. This consumes more storage but allows for rescoring and oversampling. + public static VectorSearchCompressionRescoreStorageMethod PreserveOriginals { get; } = new VectorSearchCompressionRescoreStorageMethod(PreserveOriginalsValue); + /// This option discards the original full-precision vectors. Choose this option for maximum storage savings. Since this option does not allow for rescoring and oversampling, it will often cause slight to moderate reductions in quality. + public static VectorSearchCompressionRescoreStorageMethod DiscardOriginals { get; } = new VectorSearchCompressionRescoreStorageMethod(DiscardOriginalsValue); + /// Determines if two values are the same. + public static bool operator ==(VectorSearchCompressionRescoreStorageMethod left, VectorSearchCompressionRescoreStorageMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VectorSearchCompressionRescoreStorageMethod left, VectorSearchCompressionRescoreStorageMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VectorSearchCompressionRescoreStorageMethod(string value) => new VectorSearchCompressionRescoreStorageMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VectorSearchCompressionRescoreStorageMethod other && Equals(other); + /// + public bool Equals(VectorSearchCompressionRescoreStorageMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.Serialization.cs index af85c828e77a..7bce595957c2 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.Serialization.cs @@ -17,6 +17,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); + if (Optional.IsDefined(QueryRewrites)) + { + writer.WritePropertyName("queryRewrites"u8); + writer.WriteStringValue(QueryRewrites.Value.ToString()); + } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(KNearestNeighborsCount)) @@ -64,6 +69,7 @@ internal static VectorizableTextQuery DeserializeVectorizableTextQuery(JsonEleme return null; } string text = default; + QueryRewritesType? queryRewrites = default; VectorQueryKind kind = default; int? k = default; string fields = default; @@ -79,6 +85,15 @@ internal static VectorizableTextQuery DeserializeVectorizableTextQuery(JsonEleme text = property.Value.GetString(); continue; } + if (property.NameEquals("queryRewrites"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queryRewrites = new QueryRewritesType(property.Value.GetString()); + continue; + } if (property.NameEquals("kind"u8)) { kind = new VectorQueryKind(property.Value.GetString()); @@ -149,7 +164,8 @@ internal static VectorizableTextQuery DeserializeVectorizableTextQuery(JsonEleme weight, threshold, filterOverride, - text); + text, + queryRewrites); } /// Deserializes the model from a raw response. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.cs index ebd0d209a0cf..c72e86c1ceb3 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/VectorizableTextQuery.cs @@ -37,10 +37,14 @@ public VectorizableTextQuery(string text) /// /// The OData filter expression to apply to this specific vector query. If no filter expression is defined at the vector level, the expression defined in the top level filter parameter is used instead. /// The text to be vectorized to perform a vector search query. - internal VectorizableTextQuery(VectorQueryKind kind, int? kNearestNeighborsCount, string fieldsRaw, bool? exhaustive, double? oversampling, float? weight, VectorThreshold threshold, string filterOverride, string text) : base(kind, kNearestNeighborsCount, fieldsRaw, exhaustive, oversampling, weight, threshold, filterOverride) + /// Can be configured to let a generative model rewrite the query before sending it to be vectorized. + internal VectorizableTextQuery(VectorQueryKind kind, int? kNearestNeighborsCount, string fieldsRaw, bool? exhaustive, double? oversampling, float? weight, VectorThreshold threshold, string filterOverride, string text, QueryRewritesType? queryRewrites) : base(kind, kNearestNeighborsCount, fieldsRaw, exhaustive, oversampling, weight, threshold, filterOverride) { Text = text; + QueryRewrites = queryRewrites; Kind = kind; } + /// Can be configured to let a generative model rewrite the query before sending it to be vectorized. + public QueryRewritesType? QueryRewrites { get; set; } } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/SearchModelFactory.cs b/sdk/search/Azure.Search.Documents/src/Generated/SearchModelFactory.cs index 89d13de57587..15d3056d77f1 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/SearchModelFactory.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/SearchModelFactory.cs @@ -15,122 +15,6 @@ namespace Azure.Search.Documents.Models /// Model factory for models. public static partial class SearchModelFactory { - /// Initializes a new instance of . - /// The score value represents how relevant the answer is to the query relative to other answers returned for the query. - /// The key of the document the answer was extracted from. - /// The text passage extracted from the document contents as the answer. - /// Same text passage as in the Text property with highlighted text phrases most relevant to the query. - /// Additional Properties. - /// A new instance for mocking. - public static QueryAnswerResult QueryAnswerResult(double? score = null, string key = null, string text = null, string highlights = null, IReadOnlyDictionary additionalProperties = null) - { - additionalProperties ??= new Dictionary(); - - return new QueryAnswerResult(score, key, text, highlights, additionalProperties); - } - - /// Initializes a new instance of . - /// A representative text passage extracted from the document most relevant to the search query. - /// Same text passage as in the Text property with highlighted phrases most relevant to the query. - /// Additional Properties. - /// A new instance for mocking. - public static QueryCaptionResult QueryCaptionResult(string text = null, string highlights = null, IReadOnlyDictionary additionalProperties = null) - { - additionalProperties ??= new Dictionary(); - - return new QueryCaptionResult(text, highlights, additionalProperties); - } - - /// Initializes a new instance of . - /// Contains debugging information specific to semantic ranking requests. - /// Contains debugging information specific to vector and hybrid search. - /// A new instance for mocking. - public static DocumentDebugInfo DocumentDebugInfo(SemanticDebugInfo semantic = null, VectorsDebugInfo vectors = null) - { - return new DocumentDebugInfo(semantic, vectors); - } - - /// Initializes a new instance of . - /// The title field that was sent to the semantic enrichment process, as well as how it was used. - /// The content fields that were sent to the semantic enrichment process, as well as how they were used. - /// The keyword fields that were sent to the semantic enrichment process, as well as how they were used. - /// The raw concatenated strings that were sent to the semantic enrichment process. - /// A new instance for mocking. - public static SemanticDebugInfo SemanticDebugInfo(QueryResultDocumentSemanticField titleField = null, IEnumerable contentFields = null, IEnumerable keywordFields = null, QueryResultDocumentRerankerInput rerankerInput = null) - { - contentFields ??= new List(); - keywordFields ??= new List(); - - return new SemanticDebugInfo(titleField, contentFields?.ToList(), keywordFields?.ToList(), rerankerInput); - } - - /// Initializes a new instance of . - /// The name of the field that was sent to the semantic enrichment process. - /// The way the field was used for the semantic enrichment process (fully used, partially used, or unused). - /// A new instance for mocking. - public static QueryResultDocumentSemanticField QueryResultDocumentSemanticField(string name = null, SemanticFieldState? state = null) - { - return new QueryResultDocumentSemanticField(name, state); - } - - /// Initializes a new instance of . - /// The raw string for the title field that was used for semantic enrichment. - /// The raw concatenated strings for the content fields that were used for semantic enrichment. - /// The raw concatenated strings for the keyword fields that were used for semantic enrichment. - /// A new instance for mocking. - public static QueryResultDocumentRerankerInput QueryResultDocumentRerankerInput(string title = null, string content = null, string keywords = null) - { - return new QueryResultDocumentRerankerInput(title, content, keywords); - } - - /// Initializes a new instance of . - /// The breakdown of subscores of the document prior to the chosen result set fusion/combination method such as RRF. - /// A new instance for mocking. - public static VectorsDebugInfo VectorsDebugInfo(QueryResultDocumentSubscores subscores = null) - { - return new VectorsDebugInfo(subscores); - } - - /// Initializes a new instance of . - /// The BM25 or Classic score for the text portion of the query. - /// The vector similarity and @search.score values for each vector query. - /// The BM25 or Classic score for the text portion of the query. - /// A new instance for mocking. - public static QueryResultDocumentSubscores QueryResultDocumentSubscores(TextResult text = null, IEnumerable> vectors = null, double? documentBoost = null) - { - vectors ??= new List>(); - - return new QueryResultDocumentSubscores(text, vectors?.ToList(), documentBoost); - } - - /// Initializes a new instance of . - /// The BM25 or Classic score for the text portion of the query. - /// A new instance for mocking. - public static TextResult TextResult(double? searchScore = null) - { - return new TextResult(searchScore); - } - - /// Initializes a new instance of . - /// The @search.score value that is calculated from the vector similarity score. This is the score that's visible in a pure single-field single-vector query. - /// The vector similarity score for this document. Note this is the canonical definition of similarity metric, not the 'distance' version. For example, cosine similarity instead of cosine distance. - /// A new instance for mocking. - public static SingleVectorFieldResult SingleVectorFieldResult(double? searchScore = null, double? vectorSimilarity = null) - { - return new SingleVectorFieldResult(searchScore, vectorSimilarity); - } - - /// Initializes a new instance of . - /// A value indicating the percentage of the index that was considered by the autocomplete request, or null if minimumCoverage was not specified in the request. - /// The list of returned Autocompleted items. - /// A new instance for mocking. - public static AutocompleteResults AutocompleteResults(double? coverage = null, IEnumerable results = null) - { - results ??= new List(); - - return new AutocompleteResults(coverage, results?.ToList()); - } - /// Initializes a new instance of . /// Overall indexer status. /// The result of the most recent or an in-progress indexer execution. @@ -262,5 +146,164 @@ public static SearchServiceLimits SearchServiceLimits(int? maxFieldsPerIndex = n { return new SearchServiceLimits(maxFieldsPerIndex, maxFieldNestingDepthPerIndex, maxComplexCollectionFieldsPerIndex, maxComplexObjectsInCollectionsPerDocument, maxStoragePerIndexInBytes); } + + /// Initializes a new instance of . + /// The approximate count of documents falling within the bucket described by this facet. + /// The nested facet query results for the search operation, organized as a collection of buckets for each faceted field; null if the query did not contain any nested facets. + /// Additional Properties. + /// A new instance for mocking. + public static FacetResult FacetResult(long? count = null, IReadOnlyDictionary> facets = null, IReadOnlyDictionary additionalProperties = null) + { + facets ??= new Dictionary>(); + additionalProperties ??= new Dictionary(); + + return new FacetResult(count, facets, additionalProperties); + } + + /// Initializes a new instance of . + /// The score value represents how relevant the answer is to the query relative to other answers returned for the query. + /// The key of the document the answer was extracted from. + /// The text passage extracted from the document contents as the answer. + /// Same text passage as in the Text property with highlighted text phrases most relevant to the query. + /// Additional Properties. + /// A new instance for mocking. + public static QueryAnswerResult QueryAnswerResult(double? score = null, string key = null, string text = null, string highlights = null, IReadOnlyDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new QueryAnswerResult(score, key, text, highlights, additionalProperties); + } + + /// Initializes a new instance of . + /// Contains debugging information specific to query rewrites. + /// A new instance for mocking. + public static DebugInfo DebugInfo(QueryRewritesDebugInfo queryRewrites = null) + { + return new DebugInfo(queryRewrites); + } + + /// Initializes a new instance of . + /// List of query rewrites generated for the text query. + /// List of query rewrites generated for the vectorizable text queries. + /// A new instance for mocking. + public static QueryRewritesDebugInfo QueryRewritesDebugInfo(QueryRewritesValuesDebugInfo text = null, IEnumerable vectors = null) + { + vectors ??= new List(); + + return new QueryRewritesDebugInfo(text, vectors?.ToList()); + } + + /// Initializes a new instance of . + /// The input text to the generative query rewriting model. There may be cases where the user query and the input to the generative model are not identical. + /// List of query rewrites. + /// A new instance for mocking. + public static QueryRewritesValuesDebugInfo QueryRewritesValuesDebugInfo(string inputQuery = null, IEnumerable rewrites = null) + { + rewrites ??= new List(); + + return new QueryRewritesValuesDebugInfo(inputQuery, rewrites?.ToList()); + } + + /// Initializes a new instance of . + /// A representative text passage extracted from the document most relevant to the search query. + /// Same text passage as in the Text property with highlighted phrases most relevant to the query. + /// Additional Properties. + /// A new instance for mocking. + public static QueryCaptionResult QueryCaptionResult(string text = null, string highlights = null, IReadOnlyDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new QueryCaptionResult(text, highlights, additionalProperties); + } + + /// Initializes a new instance of . + /// Contains debugging information specific to semantic ranking requests. + /// Contains debugging information specific to vector and hybrid search. + /// A new instance for mocking. + public static DocumentDebugInfo DocumentDebugInfo(SemanticDebugInfo semantic = null, VectorsDebugInfo vectors = null) + { + return new DocumentDebugInfo(semantic, vectors); + } + + /// Initializes a new instance of . + /// The title field that was sent to the semantic enrichment process, as well as how it was used. + /// The content fields that were sent to the semantic enrichment process, as well as how they were used. + /// The keyword fields that were sent to the semantic enrichment process, as well as how they were used. + /// The raw concatenated strings that were sent to the semantic enrichment process. + /// A new instance for mocking. + public static SemanticDebugInfo SemanticDebugInfo(QueryResultDocumentSemanticField titleField = null, IEnumerable contentFields = null, IEnumerable keywordFields = null, QueryResultDocumentRerankerInput rerankerInput = null) + { + contentFields ??= new List(); + keywordFields ??= new List(); + + return new SemanticDebugInfo(titleField, contentFields?.ToList(), keywordFields?.ToList(), rerankerInput); + } + + /// Initializes a new instance of . + /// The name of the field that was sent to the semantic enrichment process. + /// The way the field was used for the semantic enrichment process (fully used, partially used, or unused). + /// A new instance for mocking. + public static QueryResultDocumentSemanticField QueryResultDocumentSemanticField(string name = null, SemanticFieldState? state = null) + { + return new QueryResultDocumentSemanticField(name, state); + } + + /// Initializes a new instance of . + /// The raw string for the title field that was used for semantic enrichment. + /// The raw concatenated strings for the content fields that were used for semantic enrichment. + /// The raw concatenated strings for the keyword fields that were used for semantic enrichment. + /// A new instance for mocking. + public static QueryResultDocumentRerankerInput QueryResultDocumentRerankerInput(string title = null, string content = null, string keywords = null) + { + return new QueryResultDocumentRerankerInput(title, content, keywords); + } + + /// Initializes a new instance of . + /// The breakdown of subscores of the document prior to the chosen result set fusion/combination method such as RRF. + /// A new instance for mocking. + public static VectorsDebugInfo VectorsDebugInfo(QueryResultDocumentSubscores subscores = null) + { + return new VectorsDebugInfo(subscores); + } + + /// Initializes a new instance of . + /// The BM25 or Classic score for the text portion of the query. + /// The vector similarity and @search.score values for each vector query. + /// The BM25 or Classic score for the text portion of the query. + /// A new instance for mocking. + public static QueryResultDocumentSubscores QueryResultDocumentSubscores(TextResult text = null, IEnumerable> vectors = null, double? documentBoost = null) + { + vectors ??= new List>(); + + return new QueryResultDocumentSubscores(text, vectors?.ToList(), documentBoost); + } + + /// Initializes a new instance of . + /// The BM25 or Classic score for the text portion of the query. + /// A new instance for mocking. + public static TextResult TextResult(double? searchScore = null) + { + return new TextResult(searchScore); + } + + /// Initializes a new instance of . + /// The @search.score value that is calculated from the vector similarity score. This is the score that's visible in a pure single-field single-vector query. + /// The vector similarity score for this document. Note this is the canonical definition of similarity metric, not the 'distance' version. For example, cosine similarity instead of cosine distance. + /// A new instance for mocking. + public static SingleVectorFieldResult SingleVectorFieldResult(double? searchScore = null, double? vectorSimilarity = null) + { + return new SingleVectorFieldResult(searchScore, vectorSimilarity); + } + + /// Initializes a new instance of . + /// A value indicating the percentage of the index that was considered by the autocomplete request, or null if minimumCoverage was not specified in the request. + /// The list of returned Autocompleted items. + /// A new instance for mocking. + public static AutocompleteResults AutocompleteResults(double? coverage = null, IEnumerable results = null) + { + results ??= new List(); + + return new AutocompleteResults(coverage, results?.ToList()); + } } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/SearchServiceRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/SearchServiceRestClient.cs index d7739d04f62b..73a203e6242d 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/SearchServiceRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/SearchServiceRestClient.cs @@ -32,7 +32,7 @@ internal partial class SearchServiceRestClient /// The tracking ID sent with the request to help with debugging. /// Api Version. /// , , or is null. - public SearchServiceRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public SearchServiceRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/SkillsetsRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/SkillsetsRestClient.cs index f7992be07d4f..13912b326429 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/SkillsetsRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/SkillsetsRestClient.cs @@ -33,7 +33,7 @@ internal partial class SkillsetsRestClient /// The tracking ID sent with the request to help with debugging. /// Api Version. /// , , or is null. - public SkillsetsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public SkillsetsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/Generated/SynonymMapsRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/SynonymMapsRestClient.cs index 9247e8a18f76..33b657759e49 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/SynonymMapsRestClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/SynonymMapsRestClient.cs @@ -32,7 +32,7 @@ internal partial class SynonymMapsRestClient /// The tracking ID sent with the request to help with debugging. /// Api Version. /// , , or is null. - public SynonymMapsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-09-01-preview") + public SynonymMapsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/search/Azure.Search.Documents/src/autorest.md b/sdk/search/Azure.Search.Documents/src/autorest.md index 46360ffa182b..1afb4d4778f0 100644 --- a/sdk/search/Azure.Search.Documents/src/autorest.md +++ b/sdk/search/Azure.Search.Documents/src/autorest.md @@ -10,9 +10,8 @@ See the [Contributing guidelines](https://github.com/Azure/azure-sdk-for-net/blo ## Swagger Source(s) ```yaml title: SearchServiceClient -input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/4b7fbd8b842b509a0330f20260821dd844328dff/specification/search/data-plane/Azure.Search/preview/2024-09-01-preview/searchindex.json - - https://github.com/Azure/azure-rest-api-specs/blob/4b7fbd8b842b509a0330f20260821dd844328dff/specification/search/data-plane/Azure.Search/preview/2024-09-01-preview/searchservice.json +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/search/data-plane/Azure.Search/readme.md generation1-convenience-client: true deserialize-null-collection-as-null-value: true ``` @@ -529,3 +528,4 @@ directive: "modelAsString": false } ``` +