From ce7f50c5ee8bb4391d3981e5d5b6c595008d9c8f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 20 Mar 2025 13:35:41 +0000 Subject: [PATCH] CodeGen from PR 33248 in Azure/azure-rest-api-specs Merge ab5bd84ef4c3a219de9448388996596cf2436f5c into 5e8cee065823486e7d457bef724344b118cd50ef --- .../api/Azure.AI.Projects.net8.0.cs | 50 +++++++++---- .../api/Azure.AI.Projects.netstandard2.0.cs | 50 +++++++++---- ...=> AISearchIndexResource.Serialization.cs} | 72 +++++++++++++------ ...exResource.cs => AISearchIndexResource.cs} | 37 +++++++--- .../src/Generated/AzureAISearchQueryType.cs | 60 ++++++++++++++++ .../AzureAISearchResource.Serialization.cs | 8 +-- .../src/Generated/AzureAISearchResource.cs | 6 +- sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 8 files changed, 221 insertions(+), 64 deletions(-) rename sdk/ai/Azure.AI.Projects/src/Generated/{IndexResource.Serialization.cs => AISearchIndexResource.Serialization.cs} (58%) rename sdk/ai/Azure.AI.Projects/src/Generated/{IndexResource.cs => AISearchIndexResource.cs} (58%) create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchQueryType.cs diff --git a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs index ab0745857eef..3c4e11d68e5f 100644 --- a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs +++ b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs @@ -563,6 +563,21 @@ public static partial class AIProjectsModelFactory public static Azure.AI.Projects.VectorStoreStaticChunkingStrategyResponse VectorStoreStaticChunkingStrategyResponse(Azure.AI.Projects.VectorStoreStaticChunkingStrategyOptions @static = null) { throw null; } public static Azure.AI.Projects.WorkspaceProperties WorkspaceProperties(string applicationInsights = null) { throw null; } } + public partial class AISearchIndexResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AISearchIndexResource(string indexConnectionId, string indexName, Azure.AI.Projects.AzureAISearchQueryType queryType, int topK, string filter) { } + public string Filter { get { throw null; } set { } } + public string IndexConnectionId { get { throw null; } set { } } + public string IndexName { get { throw null; } set { } } + public Azure.AI.Projects.AzureAISearchQueryType QueryType { get { throw null; } set { } } + public int TopK { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AISearchIndexResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AISearchIndexResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class AOAIModelConfig : Azure.AI.Projects.TargetModelConfig, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AOAIModelConfig(string azureEndpoint, string apiKey, string azureDeployment) { } @@ -598,10 +613,31 @@ public enum AuthenticationType Custom = 3, None = 4, } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AzureAISearchQueryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AzureAISearchQueryType(string value) { throw null; } + public static Azure.AI.Projects.AzureAISearchQueryType Semantic { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType Simple { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType Vector { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType VectorSemanticHybrid { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType VectorSimpleHybrid { get { throw null; } } + public bool Equals(Azure.AI.Projects.AzureAISearchQueryType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Projects.AzureAISearchQueryType left, Azure.AI.Projects.AzureAISearchQueryType right) { throw null; } + public static implicit operator Azure.AI.Projects.AzureAISearchQueryType (string value) { throw null; } + public static bool operator !=(Azure.AI.Projects.AzureAISearchQueryType left, Azure.AI.Projects.AzureAISearchQueryType right) { throw null; } + public override string ToString() { throw null; } + } public partial class AzureAISearchResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AzureAISearchResource() { } - public System.Collections.Generic.IList IndexList { get { throw null; } } + public System.Collections.Generic.IList IndexList { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureAISearchResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1164,18 +1200,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class IndexResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public IndexResource(string indexConnectionId, string indexName) { } - public string IndexConnectionId { get { throw null; } set { } } - public string IndexName { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Projects.IndexResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Projects.IndexResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public abstract partial class InputData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected InputData() { } diff --git a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs index ab0745857eef..3c4e11d68e5f 100644 --- a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs +++ b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs @@ -563,6 +563,21 @@ public static partial class AIProjectsModelFactory public static Azure.AI.Projects.VectorStoreStaticChunkingStrategyResponse VectorStoreStaticChunkingStrategyResponse(Azure.AI.Projects.VectorStoreStaticChunkingStrategyOptions @static = null) { throw null; } public static Azure.AI.Projects.WorkspaceProperties WorkspaceProperties(string applicationInsights = null) { throw null; } } + public partial class AISearchIndexResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AISearchIndexResource(string indexConnectionId, string indexName, Azure.AI.Projects.AzureAISearchQueryType queryType, int topK, string filter) { } + public string Filter { get { throw null; } set { } } + public string IndexConnectionId { get { throw null; } set { } } + public string IndexName { get { throw null; } set { } } + public Azure.AI.Projects.AzureAISearchQueryType QueryType { get { throw null; } set { } } + public int TopK { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AISearchIndexResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AISearchIndexResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class AOAIModelConfig : Azure.AI.Projects.TargetModelConfig, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AOAIModelConfig(string azureEndpoint, string apiKey, string azureDeployment) { } @@ -598,10 +613,31 @@ public enum AuthenticationType Custom = 3, None = 4, } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AzureAISearchQueryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AzureAISearchQueryType(string value) { throw null; } + public static Azure.AI.Projects.AzureAISearchQueryType Semantic { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType Simple { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType Vector { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType VectorSemanticHybrid { get { throw null; } } + public static Azure.AI.Projects.AzureAISearchQueryType VectorSimpleHybrid { get { throw null; } } + public bool Equals(Azure.AI.Projects.AzureAISearchQueryType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Projects.AzureAISearchQueryType left, Azure.AI.Projects.AzureAISearchQueryType right) { throw null; } + public static implicit operator Azure.AI.Projects.AzureAISearchQueryType (string value) { throw null; } + public static bool operator !=(Azure.AI.Projects.AzureAISearchQueryType left, Azure.AI.Projects.AzureAISearchQueryType right) { throw null; } + public override string ToString() { throw null; } + } public partial class AzureAISearchResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AzureAISearchResource() { } - public System.Collections.Generic.IList IndexList { get { throw null; } } + public System.Collections.Generic.IList IndexList { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureAISearchResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1164,18 +1200,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class IndexResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public IndexResource(string indexConnectionId, string indexName) { } - public string IndexConnectionId { get { throw null; } set { } } - public string IndexName { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Projects.IndexResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Projects.IndexResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public abstract partial class InputData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected InputData() { } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/IndexResource.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AISearchIndexResource.Serialization.cs similarity index 58% rename from sdk/ai/Azure.AI.Projects/src/Generated/IndexResource.Serialization.cs rename to sdk/ai/Azure.AI.Projects/src/Generated/AISearchIndexResource.Serialization.cs index baadd6b9e843..7384a5f10a64 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/IndexResource.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AISearchIndexResource.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Projects { - public partial class IndexResource : IUtf8JsonSerializable, IJsonModel + public partial class AISearchIndexResource : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(IndexResource)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support writing '{format}' format."); } writer.WritePropertyName("index_connection_id"u8); writer.WriteStringValue(IndexConnectionId); writer.WritePropertyName("index_name"u8); writer.WriteStringValue(IndexName); + writer.WritePropertyName("query_type"u8); + writer.WriteStringValue(QueryType.ToString()); + writer.WritePropertyName("top_k"u8); + writer.WriteNumberValue(TopK); + writer.WritePropertyName("filter"u8); + writer.WriteStringValue(Filter); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -55,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - IndexResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AISearchIndexResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(IndexResource)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIndexResource(document.RootElement, options); + return DeserializeAISearchIndexResource(document.RootElement, options); } - internal static IndexResource DeserializeIndexResource(JsonElement element, ModelReaderWriterOptions options = null) + internal static AISearchIndexResource DeserializeAISearchIndexResource(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -77,6 +83,9 @@ internal static IndexResource DeserializeIndexResource(JsonElement element, Mode } string indexConnectionId = default; string indexName = default; + AzureAISearchQueryType queryType = default; + int topK = default; + string filter = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,52 +100,73 @@ internal static IndexResource DeserializeIndexResource(JsonElement element, Mode indexName = property.Value.GetString(); continue; } + if (property.NameEquals("query_type"u8)) + { + queryType = new AzureAISearchQueryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("top_k"u8)) + { + topK = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("filter"u8)) + { + filter = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new IndexResource(indexConnectionId, indexName, serializedAdditionalRawData); + return new AISearchIndexResource( + indexConnectionId, + indexName, + queryType, + topK, + filter, + serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(IndexResource)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support writing '{options.Format}' format."); } } - IndexResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AISearchIndexResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeIndexResource(document.RootElement, options); + return DeserializeAISearchIndexResource(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(IndexResource)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AISearchIndexResource)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static IndexResource FromResponse(Response response) + internal static AISearchIndexResource FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeIndexResource(document.RootElement); + return DeserializeAISearchIndexResource(document.RootElement); } /// Convert into a . diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/IndexResource.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AISearchIndexResource.cs similarity index 58% rename from sdk/ai/Azure.AI.Projects/src/Generated/IndexResource.cs rename to sdk/ai/Azure.AI.Projects/src/Generated/AISearchIndexResource.cs index 40abed475999..18f1c7a35cb0 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/IndexResource.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AISearchIndexResource.cs @@ -10,8 +10,8 @@ namespace Azure.AI.Projects { - /// A Index resource. - public partial class IndexResource + /// A AI Search Index resource. + public partial class AISearchIndexResource { /// /// Keeps track of any properties unknown to the library. @@ -45,32 +45,45 @@ public partial class IndexResource /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// An index connection id in an IndexResource attached to this agent. /// The name of an index in an IndexResource attached to this agent. - /// or is null. - public IndexResource(string indexConnectionId, string indexName) + /// Type of query in an AIIndexResource attached to this agent. + /// Number of documents to retrieve from search and present to the model. + /// Odata filter string for search resource. + /// , or is null. + public AISearchIndexResource(string indexConnectionId, string indexName, AzureAISearchQueryType queryType, int topK, string filter) { Argument.AssertNotNull(indexConnectionId, nameof(indexConnectionId)); Argument.AssertNotNull(indexName, nameof(indexName)); + Argument.AssertNotNull(filter, nameof(filter)); IndexConnectionId = indexConnectionId; IndexName = indexName; + QueryType = queryType; + TopK = topK; + Filter = filter; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// An index connection id in an IndexResource attached to this agent. /// The name of an index in an IndexResource attached to this agent. + /// Type of query in an AIIndexResource attached to this agent. + /// Number of documents to retrieve from search and present to the model. + /// Odata filter string for search resource. /// Keeps track of any properties unknown to the library. - internal IndexResource(string indexConnectionId, string indexName, IDictionary serializedAdditionalRawData) + internal AISearchIndexResource(string indexConnectionId, string indexName, AzureAISearchQueryType queryType, int topK, string filter, IDictionary serializedAdditionalRawData) { IndexConnectionId = indexConnectionId; IndexName = indexName; + QueryType = queryType; + TopK = topK; + Filter = filter; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal IndexResource() + /// Initializes a new instance of for deserialization. + internal AISearchIndexResource() { } @@ -78,5 +91,11 @@ internal IndexResource() public string IndexConnectionId { get; set; } /// The name of an index in an IndexResource attached to this agent. public string IndexName { get; set; } + /// Type of query in an AIIndexResource attached to this agent. + public AzureAISearchQueryType QueryType { get; set; } + /// Number of documents to retrieve from search and present to the model. + public int TopK { get; set; } + /// Odata filter string for search resource. + public string Filter { get; set; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchQueryType.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchQueryType.cs new file mode 100644 index 000000000000..731f00c9211f --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchQueryType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Projects +{ + /// Available query types for Azure AI Search tool. + public readonly partial struct AzureAISearchQueryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureAISearchQueryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SimpleValue = "simple"; + private const string SemanticValue = "semantic"; + private const string VectorValue = "vector"; + private const string VectorSimpleHybridValue = "vector_simple_hybrid"; + private const string VectorSemanticHybridValue = "vector_semantic_hybrid"; + + /// Query type `simple`. + public static AzureAISearchQueryType Simple { get; } = new AzureAISearchQueryType(SimpleValue); + /// Query type `semantic`. + public static AzureAISearchQueryType Semantic { get; } = new AzureAISearchQueryType(SemanticValue); + /// Query type `vector`. + public static AzureAISearchQueryType Vector { get; } = new AzureAISearchQueryType(VectorValue); + /// Query type `vector_simple_hybrid`. + public static AzureAISearchQueryType VectorSimpleHybrid { get; } = new AzureAISearchQueryType(VectorSimpleHybridValue); + /// Query type `vector_semantic_hybrid`. + public static AzureAISearchQueryType VectorSemanticHybrid { get; } = new AzureAISearchQueryType(VectorSemanticHybridValue); + /// Determines if two values are the same. + public static bool operator ==(AzureAISearchQueryType left, AzureAISearchQueryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureAISearchQueryType left, AzureAISearchQueryType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AzureAISearchQueryType(string value) => new AzureAISearchQueryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureAISearchQueryType other && Equals(other); + /// + public bool Equals(AzureAISearchQueryType 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/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.Serialization.cs index b44b79394d20..b9273cf56651 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.Serialization.cs @@ -81,7 +81,7 @@ internal static AzureAISearchResource DeserializeAzureAISearchResource(JsonEleme { return null; } - IList indexes = default; + IList indexes = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -92,10 +92,10 @@ internal static AzureAISearchResource DeserializeAzureAISearchResource(JsonEleme { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(IndexResource.DeserializeIndexResource(item, options)); + array.Add(AISearchIndexResource.DeserializeAISearchIndexResource(item, options)); } indexes = array; continue; @@ -106,7 +106,7 @@ internal static AzureAISearchResource DeserializeAzureAISearchResource(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new AzureAISearchResource(indexes ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new AzureAISearchResource(indexes ?? new ChangeTrackingList(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.cs index 2aaaf6746d8b..9ecdd9b7a676 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureAISearchResource.cs @@ -48,7 +48,7 @@ public partial class AzureAISearchResource /// Initializes a new instance of . public AzureAISearchResource() { - IndexList = new ChangeTrackingList(); + IndexList = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -57,7 +57,7 @@ public AzureAISearchResource() /// resource attached to the agent. /// /// Keeps track of any properties unknown to the library. - internal AzureAISearchResource(IList indexList, IDictionary serializedAdditionalRawData) + internal AzureAISearchResource(IList indexList, IDictionary serializedAdditionalRawData) { IndexList = indexList; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -67,6 +67,6 @@ internal AzureAISearchResource(IList indexList, IDictionary - public IList IndexList { get; } + public IList IndexList { get; } } } diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index 485b84ac6b17..e9b33a98bcae 100644 --- a/sdk/ai/Azure.AI.Projects/tsp-location.yaml +++ b/sdk/ai/Azure.AI.Projects/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Azure.AI.Projects -commit: 5e8cee065823486e7d457bef724344b118cd50ef +commit: 0ad24521f919803567e7e97cff025683b82bb9fa repo: Azure/azure-rest-api-specs additionalDirectories: