From 28b9aab74a72127d29dda8214941f37c97f34304 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Fri, 22 Nov 2024 13:37:16 -0800 Subject: [PATCH 01/18] Add first draft --- .../Custom/Agent/AzureFunctionDefinition.cs | 49 ++++++ .../src/Generated/AIProjectsModelFactory.cs | 4 +- .../Azure.AI.Projects/src/Generated/Agent.cs | 6 +- .../Generated/AgentsNamedToolChoiceType.cs | 4 +- .../AzureFunctionBinding.Serialization.cs | 133 +++++++++++++++ .../src/Generated/AzureFunctionBinding.cs | 69 ++++++++ .../AzureFunctionDefinition.Serialization.cs | 158 ++++++++++++++++++ .../src/Generated/AzureFunctionDefinition.cs | 86 ++++++++++ ...AzureFunctionStorageQueue.Serialization.cs | 150 +++++++++++++++++ .../Generated/AzureFunctionStorageQueue.cs | 82 +++++++++ ...ureFunctionToolDefinition.Serialization.cs | 134 +++++++++++++++ .../Generated/AzureFunctionToolDefinition.cs | 44 +++++ .../AzureStorageQueueBinding.Serialization.cs | 134 +++++++++++++++ .../src/Generated/AzureStorageQueueBinding.cs | 44 +++++ .../Generated/CodeInterpreterToolResource.cs | 4 +- .../src/Generated/CreateAgentRequest.cs | 4 +- .../src/Generated/CreateRunRequest.cs | 4 +- .../Generated/CreateThreadAndRunRequest.cs | 4 +- .../src/Generated/FileSearchToolResource.cs | 12 +- ...osoftFabricToolDefinition.Serialization.cs | 12 +- .../MicrosoftFabricToolDefinition.cs | 20 +-- .../src/Generated/RequiredToolCall.cs | 2 +- ...epMicrosoftFabricToolCall.Serialization.cs | 10 +- .../RunStepMicrosoftFabricToolCall.cs | 2 +- .../RunStepToolCall.Serialization.cs | 2 +- .../src/Generated/RunStepToolCall.cs | 2 +- .../src/Generated/RunStepToolCallDetails.cs | 6 +- .../src/Generated/ThreadRun.cs | 6 +- .../src/Generated/ToolConnectionList.cs | 2 +- .../Generated/ToolDefinition.Serialization.cs | 3 +- .../src/Generated/ToolDefinition.cs | 2 +- .../src/Generated/ToolResources.cs | 4 +- ...knownAzureFunctionBinding.Serialization.cs | 126 ++++++++++++++ .../Generated/UnknownAzureFunctionBinding.cs | 28 ++++ .../src/Generated/UpdateAgentRequest.cs | 4 +- .../src/Generated/VectorStoreFileError.cs | 2 +- .../tests/AIProjectsTestEnvironment.cs | 1 + sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 38 files changed, 1300 insertions(+), 61 deletions(-) create mode 100644 sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionDefinition.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionDefinition.cs new file mode 100644 index 0000000000000..0eaf15d633719 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionDefinition.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.Projects +{ + [CodeGenSuppress("AzureFunctionDefinition", typeof(InternalFunctionDefinition))] + public partial class AzureFunctionDefinition + { + /// + public string Name => InternalFunction.Name; + + /// + public string Description => InternalFunction.Description; + + /// + public BinaryData Parameters => InternalFunction.Parameters; + + /// The definition of the function that the function tool should call. + internal InternalFunctionDefinition InternalFunction { get; set; } + + /// + /// Initializes a new instance of AzureFunctionDefinition. + /// + /// The name of the Azure function to be called. + /// A description of what the Azure function does, used by the model to choose when and how to call the function. + /// Input storage queue. + /// Output storage queue. + /// The parameters the Azure functions accepts, described as a JSON Schema object. + /// , or is null. + public AzureFunctionDefinition(string name, string description, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, BinaryData parameters) + : this(new InternalFunctionDefinition(name, description, parameters, serializedAdditionalRawData: null), inputBinding: inputBinding, outputBinding: outputBinding) + { + } + + /// + public override bool Equals(object obj) + => (obj is AzureFunctionDefinition toolDefinition && Name == toolDefinition.Name); + + /// + public override int GetHashCode() => InternalFunction.GetHashCode(); + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs index ca30fab8a0366..ffc91302e1c5e 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs @@ -253,7 +253,7 @@ public static RunStepMessageCreationReference RunStepMessageCreationReference(st /// /// A list of tool call details for this run step. /// 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 . /// /// A new instance for mocking. public static RunStepToolCallDetails RunStepToolCallDetails(IEnumerable toolCalls = null) @@ -348,7 +348,7 @@ public static RunStepMicrosoftFabricToolCall RunStepMicrosoftFabricToolCall(stri { microsoftFabric ??= new Dictionary(); - return new RunStepMicrosoftFabricToolCall("microsoft_fabric", id, serializedAdditionalRawData: null, microsoftFabric); + return new RunStepMicrosoftFabricToolCall("fabric_aiskill", id, serializedAdditionalRawData: null, microsoftFabric); } /// Initializes a new instance of . diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs index 51f05f61a7b8c..ea5ad0df0decc 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs @@ -56,7 +56,7 @@ public partial class Agent /// /// The collection of tools enabled for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -104,7 +104,7 @@ internal Agent(string id, DateTimeOffset createdAt, string name, string descript /// /// The collection of tools enabled for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -162,7 +162,7 @@ internal Agent() /// /// The collection of tools enabled for the agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AgentsNamedToolChoiceType.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AgentsNamedToolChoiceType.cs index 1fce40ad472d6..e9371e9da0586 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AgentsNamedToolChoiceType.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AgentsNamedToolChoiceType.cs @@ -26,7 +26,7 @@ public AgentsNamedToolChoiceType(string value) private const string CodeInterpreterValue = "code_interpreter"; private const string FileSearchValue = "file_search"; private const string BingGroundingValue = "bing_grounding"; - private const string MicrosoftFabricValue = "microsoft_fabric"; + private const string MicrosoftFabricValue = "fabric_aiskill"; private const string SharepointValue = "sharepoint_grounding"; private const string AzureAISearchValue = "azure_ai_search"; @@ -38,7 +38,7 @@ public AgentsNamedToolChoiceType(string value) public static AgentsNamedToolChoiceType FileSearch { get; } = new AgentsNamedToolChoiceType(FileSearchValue); /// Tool type `bing_grounding`. public static AgentsNamedToolChoiceType BingGrounding { get; } = new AgentsNamedToolChoiceType(BingGroundingValue); - /// Tool type `microsoft_fabric`. + /// Tool type `fabric_aiskill`. public static AgentsNamedToolChoiceType MicrosoftFabric { get; } = new AgentsNamedToolChoiceType(MicrosoftFabricValue); /// Tool type `sharepoint_grounding`. public static AgentsNamedToolChoiceType Sharepoint { get; } = new AgentsNamedToolChoiceType(SharepointValue); diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs new file mode 100644 index 0000000000000..a9ce253d16993 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + [PersistableModelProxy(typeof(UnknownAzureFunctionBinding))] + public partial class AzureFunctionBinding : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// 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; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureFunctionBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionBinding(document.RootElement, options); + } + + internal static AzureFunctionBinding DeserializeAzureFunctionBinding(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "storage_queue": return AzureStorageQueueBinding.DeserializeAzureStorageQueueBinding(element, options); + } + } + return UnknownAzureFunctionBinding.DeserializeUnknownAzureFunctionBinding(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(AzureFunctionBinding)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureFunctionBinding(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AzureFunctionBinding FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureFunctionBinding(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs new file mode 100644 index 0000000000000..9b69be69cb44a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// + /// The Azure function binding + /// 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 . + /// + public abstract partial class AzureFunctionBinding + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected AzureFunctionBinding() + { + } + + /// Initializes a new instance of . + /// The type of binding. + /// Keeps track of any properties unknown to the library. + internal AzureFunctionBinding(string type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of binding. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.Serialization.cs new file mode 100644 index 0000000000000..2bf449af09543 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class AzureFunctionDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// 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; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionDefinition)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("function"u8); + writer.WriteObjectValue(InternalFunction, options); + writer.WritePropertyName("input_binding"u8); + writer.WriteObjectValue(InputBinding, options); + writer.WritePropertyName("output_binding"u8); + writer.WriteObjectValue(OutputBinding, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionDefinition(document.RootElement, options); + } + + internal static AzureFunctionDefinition DeserializeAzureFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalFunctionDefinition function = default; + AzureStorageQueueBinding inputBinding = default; + AzureStorageQueueBinding outputBinding = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("function"u8)) + { + function = InternalFunctionDefinition.DeserializeInternalFunctionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("input_binding"u8)) + { + inputBinding = AzureStorageQueueBinding.DeserializeAzureStorageQueueBinding(property.Value, options); + continue; + } + if (property.NameEquals("output_binding"u8)) + { + outputBinding = AzureStorageQueueBinding.DeserializeAzureStorageQueueBinding(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureFunctionDefinition(function, inputBinding, outputBinding, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(AzureFunctionDefinition)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureFunctionDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AzureFunctionDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureFunctionDefinition(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs new file mode 100644 index 0000000000000..9063e85e8c4d2 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// The definition of Azure function. + public partial class AzureFunctionDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The definition of azure function and its parameters. + /// Input storage queue. + /// Output storage queue. + /// , or is null. + public AzureFunctionDefinition(InternalFunctionDefinition internalFunction, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding) + { + Argument.AssertNotNull(internalFunction, nameof(internalFunction)); + Argument.AssertNotNull(inputBinding, nameof(inputBinding)); + Argument.AssertNotNull(outputBinding, nameof(outputBinding)); + + InternalFunction = internalFunction; + InputBinding = inputBinding; + OutputBinding = outputBinding; + } + + /// Initializes a new instance of . + /// The definition of azure function and its parameters. + /// Input storage queue. + /// Output storage queue. + /// Keeps track of any properties unknown to the library. + internal AzureFunctionDefinition(InternalFunctionDefinition internalFunction, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, IDictionary serializedAdditionalRawData) + { + InternalFunction = internalFunction; + InputBinding = inputBinding; + OutputBinding = outputBinding; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureFunctionDefinition() + { + } + /// Input storage queue. + public AzureStorageQueueBinding InputBinding { get; set; } + /// Output storage queue. + public AzureStorageQueueBinding OutputBinding { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs new file mode 100644 index 0000000000000..745777a4bb18a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class AzureFunctionStorageQueue : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// 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; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("queue_service_uri"u8); + writer.WriteStringValue(StorageQueueUri); + writer.WritePropertyName("queue_name"u8); + writer.WriteStringValue(QueueName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureFunctionStorageQueue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionStorageQueue(document.RootElement, options); + } + + internal static AzureFunctionStorageQueue DeserializeAzureFunctionStorageQueue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string queueServiceUri = default; + string queueName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("queue_service_uri"u8)) + { + queueServiceUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("queue_name"u8)) + { + queueName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureFunctionStorageQueue(queueServiceUri, queueName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(AzureFunctionStorageQueue)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionStorageQueue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureFunctionStorageQueue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AzureFunctionStorageQueue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureFunctionStorageQueue(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs new file mode 100644 index 0000000000000..3d3e0b45d42de --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// The structure for keeping storage queue name and URI. + public partial class AzureFunctionStorageQueue + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The URI of an Azure function storage queue. + /// The name of an Azure function storage queue. + /// or is null. + public AzureFunctionStorageQueue(string storageQueueUri, string queueName) + { + Argument.AssertNotNull(storageQueueUri, nameof(storageQueueUri)); + Argument.AssertNotNull(queueName, nameof(queueName)); + + StorageQueueUri = storageQueueUri; + QueueName = queueName; + } + + /// Initializes a new instance of . + /// The URI of an Azure function storage queue. + /// The name of an Azure function storage queue. + /// Keeps track of any properties unknown to the library. + internal AzureFunctionStorageQueue(string storageQueueUri, string queueName, IDictionary serializedAdditionalRawData) + { + StorageQueueUri = storageQueueUri; + QueueName = queueName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureFunctionStorageQueue() + { + } + + /// The URI of an Azure function storage queue. + public string StorageQueueUri { get; set; } + /// The name of an Azure function storage queue. + public string QueueName { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs new file mode 100644 index 0000000000000..0515abf2f6cf7 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class AzureFunctionToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("azure_function"u8); + writer.WriteObjectValue(AzureFunction, options); + } + + AzureFunctionToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionToolDefinition(document.RootElement, options); + } + + internal static AzureFunctionToolDefinition DeserializeAzureFunctionToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureFunctionDefinition azureFunction = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azure_function"u8)) + { + azureFunction = AzureFunctionDefinition.DeserializeAzureFunctionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureFunctionToolDefinition(type, serializedAdditionalRawData, azureFunction); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(AzureFunctionToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureFunctionToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AzureFunctionToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureFunctionToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs new file mode 100644 index 0000000000000..1a6d339a85886 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// The input definition information for a azure function tool as used to configure an agent. + public partial class AzureFunctionToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The definition of the concrete function that the function tool should call. + /// is null. + public AzureFunctionToolDefinition(AzureFunctionDefinition azureFunction) + { + Argument.AssertNotNull(azureFunction, nameof(azureFunction)); + + Type = "azure_function"; + AzureFunction = azureFunction; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The definition of the concrete function that the function tool should call. + internal AzureFunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, AzureFunctionDefinition azureFunction) : base(type, serializedAdditionalRawData) + { + AzureFunction = azureFunction; + } + + /// Initializes a new instance of for deserialization. + internal AzureFunctionToolDefinition() + { + } + + /// The definition of the concrete function that the function tool should call. + public AzureFunctionDefinition AzureFunction { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs new file mode 100644 index 0000000000000..e8f8f9edba5e3 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class AzureStorageQueueBinding : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureStorageQueueBinding)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("storage_queue"u8); + writer.WriteObjectValue(StorageQueue, options); + } + + AzureStorageQueueBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureStorageQueueBinding)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureStorageQueueBinding(document.RootElement, options); + } + + internal static AzureStorageQueueBinding DeserializeAzureStorageQueueBinding(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureFunctionStorageQueue storageQueue = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storage_queue"u8)) + { + storageQueue = AzureFunctionStorageQueue.DeserializeAzureFunctionStorageQueue(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureStorageQueueBinding(type, serializedAdditionalRawData, storageQueue); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(AzureStorageQueueBinding)} does not support writing '{options.Format}' format."); + } + } + + AzureStorageQueueBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureStorageQueueBinding(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureStorageQueueBinding)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AzureStorageQueueBinding FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureStorageQueueBinding(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs new file mode 100644 index 0000000000000..7f3593f0fa407 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// The definition of input or output queue for Azure function. + public partial class AzureStorageQueueBinding : AzureFunctionBinding + { + /// Initializes a new instance of . + /// Storage queue. + /// is null. + public AzureStorageQueueBinding(AzureFunctionStorageQueue storageQueue) + { + Argument.AssertNotNull(storageQueue, nameof(storageQueue)); + + Type = "storage_queue"; + StorageQueue = storageQueue; + } + + /// Initializes a new instance of . + /// The type of binding. + /// Keeps track of any properties unknown to the library. + /// Storage queue. + internal AzureStorageQueueBinding(string type, IDictionary serializedAdditionalRawData, AzureFunctionStorageQueue storageQueue) : base(type, serializedAdditionalRawData) + { + StorageQueue = storageQueue; + } + + /// Initializes a new instance of for deserialization. + internal AzureStorageQueueBinding() + { + } + + /// Storage queue. + public AzureFunctionStorageQueue StorageQueue { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CodeInterpreterToolResource.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CodeInterpreterToolResource.cs index 1e49d70a3a98c..5eebfab8f0852 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CodeInterpreterToolResource.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CodeInterpreterToolResource.cs @@ -57,7 +57,7 @@ public CodeInterpreterToolResource() /// A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files /// associated with the tool. /// - /// The data sources to be used. This option is mutually exclusive with fileIds. + /// The data sources to be used. This option is mutually exclusive with the `fileIds` property. /// Keeps track of any properties unknown to the library. internal CodeInterpreterToolResource(IList fileIds, IList dataSources, IDictionary serializedAdditionalRawData) { @@ -71,7 +71,7 @@ internal CodeInterpreterToolResource(IList fileIds, IList public IList FileIds { get; } - /// The data sources to be used. This option is mutually exclusive with fileIds. + /// The data sources to be used. This option is mutually exclusive with the `fileIds` property. public IList DataSources { get; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs index 606b205632601..1f51e5beb380b 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs @@ -65,7 +65,7 @@ internal CreateAgentRequest(string model) /// /// The collection of tools to enable for the new agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -115,7 +115,7 @@ internal CreateAgentRequest() /// /// The collection of tools to enable for the new agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs index b47736e413ebf..2b07343d4fa92 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs @@ -70,7 +70,7 @@ internal CreateRunRequest(string assistantId) /// /// The overridden list of enabled tools that the agent should use to run the thread. /// 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 . /// /// /// If `true`, returns a stream of events that happen during the Run as server-sent events, @@ -143,7 +143,7 @@ internal CreateRunRequest() /// /// The overridden list of enabled tools that the agent should use to run the thread. /// 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 IReadOnlyList OverrideTools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs index 1a002dd86bdd3..f3129e4a93ddc 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs @@ -65,7 +65,7 @@ internal CreateThreadAndRunRequest(string assistantId) /// /// The overridden list of enabled tools the agent should use to run the thread. /// 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 . /// /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. /// @@ -134,7 +134,7 @@ internal CreateThreadAndRunRequest() /// /// The overridden list of enabled tools the agent should use to run the thread. /// 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 IReadOnlyList OverrideTools { get; } /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/FileSearchToolResource.cs b/sdk/ai/Azure.AI.Projects/src/Generated/FileSearchToolResource.cs index da9f6a2ceb26e..9dc2301d67eaa 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/FileSearchToolResource.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/FileSearchToolResource.cs @@ -58,9 +58,9 @@ public FileSearchToolResource() /// store attached to the agent. /// /// - /// The list of vector store configuration objects from Azure. This list is limited to one - /// element. The only element of this list contains - /// the list of azure asset IDs used by the search tool. + /// The list of vector store configuration objects from Azure. + /// This list is limited to one element. + /// The only element of this list contains the list of azure asset IDs used by the search tool. /// /// Keeps track of any properties unknown to the library. internal FileSearchToolResource(IList vectorStoreIds, IList vectorStores, IDictionary serializedAdditionalRawData) @@ -76,9 +76,9 @@ internal FileSearchToolResource(IList vectorStoreIds, IList public IList VectorStoreIds { get; } /// - /// The list of vector store configuration objects from Azure. This list is limited to one - /// element. The only element of this list contains - /// the list of azure asset IDs used by the search tool. + /// The list of vector store configuration objects from Azure. + /// This list is limited to one element. + /// The only element of this list contains the list of azure asset IDs used by the search tool. /// public IList VectorStores { get; } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs index 74fb6c1c1968a..ad1aecac60134 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs @@ -35,8 +35,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("microsoft_fabric"u8); - writer.WriteObjectValue(MicrosoftFabric, options); + writer.WritePropertyName("fabric_aiskill"u8); + writer.WriteObjectValue(FabricAiskill, options); } MicrosoftFabricToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -59,15 +59,15 @@ internal static MicrosoftFabricToolDefinition DeserializeMicrosoftFabricToolDefi { return null; } - ToolConnectionList microsoftFabric = default; + ToolConnectionList fabricAiskill = default; string type = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("microsoft_fabric"u8)) + if (property.NameEquals("fabric_aiskill"u8)) { - microsoftFabric = ToolConnectionList.DeserializeToolConnectionList(property.Value, options); + fabricAiskill = ToolConnectionList.DeserializeToolConnectionList(property.Value, options); continue; } if (property.NameEquals("type"u8)) @@ -81,7 +81,7 @@ internal static MicrosoftFabricToolDefinition DeserializeMicrosoftFabricToolDefi } } serializedAdditionalRawData = rawDataDictionary; - return new MicrosoftFabricToolDefinition(type, serializedAdditionalRawData, microsoftFabric); + return new MicrosoftFabricToolDefinition(type, serializedAdditionalRawData, fabricAiskill); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.cs index fb886ddbd8693..f62e63d2f7f01 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/MicrosoftFabricToolDefinition.cs @@ -14,23 +14,23 @@ namespace Azure.AI.Projects public partial class MicrosoftFabricToolDefinition : ToolDefinition { /// Initializes a new instance of . - /// The list of connections used by the Microsoft Fabric tool. - /// is null. - public MicrosoftFabricToolDefinition(ToolConnectionList microsoftFabric) + /// The list of connections used by the Microsoft Fabric tool. + /// is null. + public MicrosoftFabricToolDefinition(ToolConnectionList fabricAiskill) { - Argument.AssertNotNull(microsoftFabric, nameof(microsoftFabric)); + Argument.AssertNotNull(fabricAiskill, nameof(fabricAiskill)); - Type = "microsoft_fabric"; - MicrosoftFabric = microsoftFabric; + Type = "fabric_aiskill"; + FabricAiskill = fabricAiskill; } /// Initializes a new instance of . /// The object type. /// Keeps track of any properties unknown to the library. - /// The list of connections used by the Microsoft Fabric tool. - internal MicrosoftFabricToolDefinition(string type, IDictionary serializedAdditionalRawData, ToolConnectionList microsoftFabric) : base(type, serializedAdditionalRawData) + /// The list of connections used by the Microsoft Fabric tool. + internal MicrosoftFabricToolDefinition(string type, IDictionary serializedAdditionalRawData, ToolConnectionList fabricAiskill) : base(type, serializedAdditionalRawData) { - MicrosoftFabric = microsoftFabric; + FabricAiskill = fabricAiskill; } /// Initializes a new instance of for deserialization. @@ -39,6 +39,6 @@ internal MicrosoftFabricToolDefinition() } /// The list of connections used by the Microsoft Fabric tool. - public ToolConnectionList MicrosoftFabric { get; set; } + public ToolConnectionList FabricAiskill { get; set; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RequiredToolCall.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RequiredToolCall.cs index f9e94be0b0fd9..abeb4d7c18ec5 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RequiredToolCall.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/RequiredToolCall.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Projects { /// - /// An abstract representation a a tool invocation needed by the model to continue a run. + /// An abstract representation of a tool invocation needed by the model to continue a run. /// 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 . /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs index e4cbd4acd5903..1b3f42907d655 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs @@ -35,7 +35,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("microsoft_fabric"u8); + writer.WritePropertyName("fabric_aiskill"u8); writer.WriteStartObject(); foreach (var item in MicrosoftFabric) { @@ -65,21 +65,21 @@ internal static RunStepMicrosoftFabricToolCall DeserializeRunStepMicrosoftFabric { return null; } - IReadOnlyDictionary microsoftFabric = default; + IReadOnlyDictionary fabricAiskill = default; string type = default; string id = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("microsoft_fabric"u8)) + if (property.NameEquals("fabric_aiskill"u8)) { Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } - microsoftFabric = dictionary; + fabricAiskill = dictionary; continue; } if (property.NameEquals("type"u8)) @@ -98,7 +98,7 @@ internal static RunStepMicrosoftFabricToolCall DeserializeRunStepMicrosoftFabric } } serializedAdditionalRawData = rawDataDictionary; - return new RunStepMicrosoftFabricToolCall(type, id, serializedAdditionalRawData, microsoftFabric); + return new RunStepMicrosoftFabricToolCall(type, id, serializedAdditionalRawData, fabricAiskill); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.cs index 15f664c26464a..b212127c06057 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepMicrosoftFabricToolCall.cs @@ -25,7 +25,7 @@ internal RunStepMicrosoftFabricToolCall(string id, IReadOnlyDictionary /// An abstract representation of a detailed tool call as recorded within a run step for an existing run. /// 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 abstract partial class RunStepToolCall { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepToolCallDetails.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepToolCallDetails.cs index f5a2490363ac0..f734d2d76efe3 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepToolCallDetails.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepToolCallDetails.cs @@ -18,7 +18,7 @@ public partial class RunStepToolCallDetails : RunStepDetails /// /// A list of tool call details for this run step. /// 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 . /// /// is null. internal RunStepToolCallDetails(IEnumerable toolCalls) @@ -35,7 +35,7 @@ internal RunStepToolCallDetails(IEnumerable toolCalls) /// /// A list of tool call details for this run step. /// 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 . /// internal RunStepToolCallDetails(RunStepType type, IDictionary serializedAdditionalRawData, IReadOnlyList toolCalls) : base(type, serializedAdditionalRawData) { @@ -50,7 +50,7 @@ internal RunStepToolCallDetails() /// /// A list of tool call details for this run step. /// 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 IReadOnlyList ToolCalls { get; } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs index e3aa03d008e09..e900ea19d9fe2 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs @@ -57,7 +57,7 @@ public partial class ThreadRun /// /// The overridden enabled tools used for this agent thread run. /// 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 . /// /// The Unix timestamp, in seconds, representing when this object was created. /// The Unix timestamp, in seconds, representing when this item expires. @@ -124,7 +124,7 @@ internal ThreadRun(string id, string threadId, string assistantId, RunStatus sta /// /// The overridden enabled tools used for this agent thread run. /// 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 . /// /// The Unix timestamp, in seconds, representing when this object was created. /// The Unix timestamp, in seconds, representing when this item expires. @@ -207,7 +207,7 @@ internal ThreadRun() /// /// The overridden enabled tools used for this agent thread run. /// 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 IReadOnlyList Tools { get; } /// The Unix timestamp, in seconds, representing when this object was created. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ToolConnectionList.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ToolConnectionList.cs index f0969e099cd39..9b4fec134cef8 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ToolConnectionList.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ToolConnectionList.cs @@ -10,7 +10,7 @@ namespace Azure.AI.Projects { - /// A set of connection resources currently used by either the `bing_grounding`, `microsoft_fabric`, or `sharepoint_grounding` tools. + /// A set of connection resources currently used by either the `bing_grounding`, `fabric_aiskill`, or `sharepoint_grounding` tools. public partial class ToolConnectionList { /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs index 6a49db04a1eff..4d414a891908c 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs @@ -78,11 +78,12 @@ internal static ToolDefinition DeserializeToolDefinition(JsonElement element, Mo switch (discriminator.GetString()) { case "azure_ai_search": return AzureAISearchToolDefinition.DeserializeAzureAISearchToolDefinition(element, options); + case "azure_function": return AzureFunctionToolDefinition.DeserializeAzureFunctionToolDefinition(element, options); case "bing_grounding": return BingGroundingToolDefinition.DeserializeBingGroundingToolDefinition(element, options); case "code_interpreter": return CodeInterpreterToolDefinition.DeserializeCodeInterpreterToolDefinition(element, options); + case "fabric_aiskill": return MicrosoftFabricToolDefinition.DeserializeMicrosoftFabricToolDefinition(element, options); case "file_search": return FileSearchToolDefinition.DeserializeFileSearchToolDefinition(element, options); case "function": return FunctionToolDefinition.DeserializeFunctionToolDefinition(element, options); - case "microsoft_fabric": return MicrosoftFabricToolDefinition.DeserializeMicrosoftFabricToolDefinition(element, options); case "sharepoint_grounding": return SharepointToolDefinition.DeserializeSharepointToolDefinition(element, options); } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs index f55e424751739..d6ebe82f65fff 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Projects /// /// An abstract representation of an input tool definition that an agent can use. /// 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 abstract partial class ToolDefinition { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ToolResources.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ToolResources.cs index 28193fd49d85d..f3bc125c78b5c 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ToolResources.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ToolResources.cs @@ -55,7 +55,7 @@ public ToolResources() } /// Initializes a new instance of . - /// Resources to be used by the `code_interpreter tool` consisting of file IDs. + /// Resources to be used by the `code_interpreter` tool consisting of file IDs. /// Resources to be used by the `file_search` tool consisting of vector store IDs. /// Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. /// Keeps track of any properties unknown to the library. @@ -67,7 +67,7 @@ internal ToolResources(CodeInterpreterToolResource codeInterpreter, FileSearchTo _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Resources to be used by the `code_interpreter tool` consisting of file IDs. + /// Resources to be used by the `code_interpreter` tool consisting of file IDs. public CodeInterpreterToolResource CodeInterpreter { get; set; } /// Resources to be used by the `file_search` tool consisting of vector store IDs. public FileSearchToolResource FileSearch { get; set; } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs new file mode 100644 index 0000000000000..23ba0a6949ba2 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + internal partial class UnknownAzureFunctionBinding : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AzureFunctionBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionBinding(document.RootElement, options); + } + + internal static UnknownAzureFunctionBinding DeserializeUnknownAzureFunctionBinding(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAzureFunctionBinding(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(AzureFunctionBinding)} does not support writing '{options.Format}' format."); + } + } + + AzureFunctionBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureFunctionBinding(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAzureFunctionBinding FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAzureFunctionBinding(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs new file mode 100644 index 0000000000000..2abeeba1afb0e --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Unknown version of AzureFunctionBinding. + internal partial class UnknownAzureFunctionBinding : AzureFunctionBinding + { + /// Initializes a new instance of . + /// The type of binding. + /// Keeps track of any properties unknown to the library. + internal UnknownAzureFunctionBinding(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAzureFunctionBinding() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs index 518491348498e..20d36641d6a5a 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs @@ -60,7 +60,7 @@ internal UpdateAgentRequest() /// /// The modified collection of tools to enable for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, @@ -105,7 +105,7 @@ internal UpdateAgentRequest(string model, string name, string description, strin /// /// The modified collection of tools to enable for the agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/VectorStoreFileError.cs b/sdk/ai/Azure.AI.Projects/src/Generated/VectorStoreFileError.cs index cd886e226df38..05eefeb612967 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/VectorStoreFileError.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/VectorStoreFileError.cs @@ -10,7 +10,7 @@ namespace Azure.AI.Projects { - /// Details on the error that may have ocurred while processing a file for this vector store. + /// Details on the error that may have occurred while processing a file for this vector store. public partial class VectorStoreFileError { /// diff --git a/sdk/ai/Azure.AI.Projects/tests/AIProjectsTestEnvironment.cs b/sdk/ai/Azure.AI.Projects/tests/AIProjectsTestEnvironment.cs index 9e97874fba9c6..79be1bc28e73f 100644 --- a/sdk/ai/Azure.AI.Projects/tests/AIProjectsTestEnvironment.cs +++ b/sdk/ai/Azure.AI.Projects/tests/AIProjectsTestEnvironment.cs @@ -10,5 +10,6 @@ public class AIProjectsTestEnvironment : TestEnvironment public string AzureAICONNECTIONSTRING => GetRecordedVariable("PROJECT_CONNECTION_STRING"); public string BINGCONNECTIONNAME => GetRecordedVariable("BING_CONNECTION_NAME"); public string MODELDEPLOYMENTNAME => GetRecordedVariable("MODEL_DEPLOYMENT_NAME"); + public string STORAGE_QUEUE_URI => GetRecordedVariable("STORAGE_QUEUE_URI"); } } diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index 3e09002b2b166..2c17cf7e39fea 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: a2c91a2b8411848584eda2c60d1b36d4e45b55e6 +commit: 278d3a9448aafdc6ded4f28ff5c8a50d3abef519 repo: Azure/azure-rest-api-specs additionalDirectories: From 74283e9dfa10b02d031a4a0378a46010153e95c1 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:24:52 -0800 Subject: [PATCH 02/18] draft --- .../src/Generated/AzureFunctionDefinition.cs | 2 +- .../Agent/Sample_Agent_Azure_Functions.cs | 125 ++++++++++++++++++ 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs index 9063e85e8c4d2..cbd7c4bcf342d 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs @@ -50,7 +50,7 @@ public partial class AzureFunctionDefinition /// Input storage queue. /// Output storage queue. /// , or is null. - public AzureFunctionDefinition(InternalFunctionDefinition internalFunction, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding) + internal AzureFunctionDefinition(InternalFunctionDefinition internalFunction, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding) { Argument.AssertNotNull(internalFunction, nameof(internalFunction)); Argument.AssertNotNull(inputBinding, nameof(inputBinding)); diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs new file mode 100644 index 0000000000000..c0f632084cb32 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.AI.Inference; +using Azure.Core.TestFramework; +using Microsoft.VisualStudio.TestPlatform.Utilities; +using NUnit.Framework; + +namespace Azure.AI.Projects.Tests; + +public partial class Sample_Agent_Azure_Functions : SamplesBase +{ + [Test] + public async Task AzureFunctionCallingExample() + { + var connectionString = TestEnvironment.AzureAICONNECTIONSTRING; + var storageQueueUri = TestEnvironment.STORAGE_QUEUE_URI; + AgentsClient client = new(connectionString, new DefaultAzureCredential()); + + #region Snippet:AzureFunctionsDefineFunctionTools + // Example of Azure Function + AzureFunctionToolDefinition azureFnTool = new( + azureFunction: new AzureFunctionDefinition( + name: "foo", + description: "Get answers from the foo bot.", + inputBinding: new AzureStorageQueueBinding( + new AzureFunctionStorageQueue( + queueName: "azure-function-foo-input", + storageQueueUri: storageQueueUri + ) + ), + outputBinding: new AzureStorageQueueBinding( + new AzureFunctionStorageQueue( + queueName: "azure-function-tool-output", + storageQueueUri: storageQueueUri + ) + ), + parameters: BinaryData.FromObjectAsJson( + new + { + Type = "object", + Properties = new + { + query = new + { + Type = "string", + Description = "The question to ask.", + }, + outputqueueuri = new + { + Type = "string", + Description = "The full output queue uri." + } + }, + }, + new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase } + ) + ) + ); + #endregion + + #region Snippet:AzureFunctionsCreateAgentWithFunctionTools + // note: parallel function calling is only supported with newer models like gpt-4-1106-preview + Response agentResponse = await client.CreateAgentAsync( + model: "gpt-4-1106-preview", + name: "SDK Test Agent - Functions", + instructions: "You are a weather bot. Use the provided functions to help answer questions. " + + "Customize your responses to the user's preferences as much as possible and use friendly " + + "nicknames for cities whenever possible.", + tools: new List { azureFnTool } + ); + Agent agent = agentResponse.Value; + #endregion + + Response threadResponse = await client.CreateThreadAsync(); + AgentThread thread = threadResponse.Value; + + Response messageResponse = await client.CreateMessageAsync( + thread.Id, + MessageRole.User, + "What is the most prevalent element in the universe? What would foo say?"); + ThreadMessage message = messageResponse.Value; + + Response runResponse = await client.CreateRunAsync(thread, agent); + + #region Snippet:AzureFunctionsHandlePollingWithRequiredAction + do + { + await Task.Delay(TimeSpan.FromMilliseconds(500)); + runResponse = await client.GetRunAsync(thread.Id, runResponse.Value.Id); + } + while (runResponse.Value.Status == RunStatus.Queued + || runResponse.Value.Status == RunStatus.InProgress); + #endregion + + Response> afterRunMessagesResponse + = await client.GetMessagesAsync(thread.Id); + IReadOnlyList messages = afterRunMessagesResponse.Value.Data; + + // Note: messages iterate from newest to oldest, with the messages[0] being the most recent + foreach (ThreadMessage threadMessage in messages) + { + Console.Write($"{threadMessage.CreatedAt:yyyy-MM-dd HH:mm:ss} - {threadMessage.Role,10}: "); + foreach (MessageContent contentItem in threadMessage.ContentItems) + { + if (contentItem is MessageTextContent textItem) + { + Console.Write(textItem.Text); + } + else if (contentItem is MessageImageFileContent imageFileItem) + { + Console.Write($" Date: Fri, 22 Nov 2024 17:52:54 -0800 Subject: [PATCH 03/18] Check in funxtional sample --- .../Agent/Sample_Agent_Azure_Functions.cs | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs index c0f632084cb32..1ed567f232fe9 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -4,13 +4,12 @@ #nullable disable using System; -using System.Collections; using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using Azure.AI.Inference; +using Azure.Core; +using Azure.Core.Pipeline; using Azure.Core.TestFramework; -using Microsoft.VisualStudio.TestPlatform.Utilities; using NUnit.Framework; namespace Azure.AI.Projects.Tests; @@ -22,7 +21,10 @@ public async Task AzureFunctionCallingExample() { var connectionString = TestEnvironment.AzureAICONNECTIONSTRING; var storageQueueUri = TestEnvironment.STORAGE_QUEUE_URI; - AgentsClient client = new(connectionString, new DefaultAzureCredential()); + // Add experimental headers policy + AIProjectClientOptions clientOptions = new(); + clientOptions.AddPolicy(new ExperimentalHeaderPolicy(), HttpPipelinePosition.PerCall); + AgentsClient client = new(connectionString, new DefaultAzureCredential(), clientOptions); #region Snippet:AzureFunctionsDefineFunctionTools // Example of Azure Function @@ -67,9 +69,8 @@ public async Task AzureFunctionCallingExample() #endregion #region Snippet:AzureFunctionsCreateAgentWithFunctionTools - // note: parallel function calling is only supported with newer models like gpt-4-1106-preview Response agentResponse = await client.CreateAgentAsync( - model: "gpt-4-1106-preview", + model: "gpt-4", name: "SDK Test Agent - Functions", instructions: "You are a weather bot. Use the provided functions to help answer questions. " + "Customize your responses to the user's preferences as much as possible and use friendly " @@ -122,4 +123,17 @@ Response> afterRunMessagesResponse } } } + private class ExperimentalHeaderPolicy : HttpPipelinePolicy + { + public override void Process(HttpMessage message, ReadOnlyMemory pipeline) + { + message.Request.Headers.Add("x-ms-enable-preview", "true"); + ProcessNext(message, pipeline); + } + public override ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory pipeline) + { + message.Request.Headers.Add("x-ms-enable-preview", "true"); + return ProcessNextAsync(message, pipeline); + } + } } From b7e6b504d7bef493aaf5b8182f6f411c151e2af7 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:06:28 -0800 Subject: [PATCH 04/18] Generate code and create and example for Azure function --- sdk/ai/Azure.AI.Projects/README.md | 78 +++++++++++++++++++ .../api/Azure.AI.Projects.net8.0.cs | 52 ++++++++++++- .../api/Azure.AI.Projects.netstandard2.0.cs | 52 ++++++++++++- ...tion.cs => AzureFunctionToolDefinition.cs} | 20 ++--- ...ureFunctionToolDefinition.Serialization.cs | 6 +- .../Generated/AzureFunctionToolDefinition.cs | 20 +---- ...lAzureFunctionDefinition.Serialization.cs} | 44 +++++------ ....cs => InternalAzureFunctionDefinition.cs} | 29 +++---- .../Agent/Sample_Agent_Azure_Functions.cs | 76 +++++++++--------- sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 10 files changed, 271 insertions(+), 108 deletions(-) rename sdk/ai/Azure.AI.Projects/src/Custom/Agent/{AzureFunctionDefinition.cs => AzureFunctionToolDefinition.cs} (56%) rename sdk/ai/Azure.AI.Projects/src/Generated/{AzureFunctionDefinition.Serialization.cs => InternalAzureFunctionDefinition.Serialization.cs} (66%) rename sdk/ai/Azure.AI.Projects/src/Generated/{AzureFunctionDefinition.cs => InternalAzureFunctionDefinition.cs} (68%) diff --git a/sdk/ai/Azure.AI.Projects/README.md b/sdk/ai/Azure.AI.Projects/README.md index 289cf65ef2063..1389c37e406d1 100644 --- a/sdk/ai/Azure.AI.Projects/README.md +++ b/sdk/ai/Azure.AI.Projects/README.md @@ -20,6 +20,7 @@ Use the AI Projects client library to: - [Retrieve messages](#retrieve-messages) - [File search](#file-search) - [Function call](#function-call) + - [Azure function call](#azure-function-call) - [Troubleshooting](#troubleshooting) - [Next steps](#next-steps) - [Contributing](#contributing) @@ -347,6 +348,83 @@ while (runResponse.Value.Status == RunStatus.Queued || runResponse.Value.Status == RunStatus.InProgress); ``` +#### Azure function call +We also can use Azure Function from inside the agent. In the example below we are calling function "foo", which responds "Bar". In this example we create `AzureFunctionToolDefinition` object, with the function name, description, input and output queues, followed by function parameters. +```C# Snippet:AzureFunctionsDefineFunctionTools +AzureFunctionToolDefinition azureFnTool = new( + name: "foo", + description: "Get answers from the foo bot.", + inputBinding: new AzureStorageQueueBinding( + new AzureFunctionStorageQueue( + queueName: "azure-function-foo-input", + storageQueueUri: storageQueueUri + ) + ), + outputBinding: new AzureStorageQueueBinding( + new AzureFunctionStorageQueue( + queueName: "azure-function-tool-output", + storageQueueUri: storageQueueUri + ) + ), + parameters: BinaryData.FromObjectAsJson( + new + { + Type = "object", + Properties = new + { + query = new + { + Type = "string", + Description = "The question to ask.", + }, + outputqueueuri = new + { + Type = "string", + Description = "The full output queue uri." + } + }, + }, + new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase } + ) +); +``` + +Note that in this scenario we are asking agent to supply storage queue URI to the azure function whenever it is called. +```C# Snippet:AzureFunctionsCreateAgentWithFunctionTools +Response agentResponse = await client.CreateAgentAsync( + model: "gpt-4", + name: "azure-function-agent-foo", + instructions: "You are a helpful support agent. Use the provided function any " + + "time the prompt contains the string 'What would foo say?'. When you invoke " + + "the function, ALWAYS specify the output queue uri parameter as " + + $"'{storageQueueUri}/azure-function-tool-output'. Always responds with " + + "\"Foo says\" and then the response from the tool.", + tools: new List { azureFnTool } + ); +Agent agent = agentResponse.Value; +``` + +After we have created a message with request to ask "What would foo say?", we need to wait while the run is in queued, in progress or requires action states. +```C# Snippet:AzureFunctionsHandlePollingWithRequiredAction +Response messageResponse = await client.CreateMessageAsync( + thread.Id, + MessageRole.User, + "What is the most prevalent element in the universe? What would foo say?"); +ThreadMessage message = messageResponse.Value; + +Response runResponse = await client.CreateRunAsync(thread, agent); + +do +{ + await Task.Delay(TimeSpan.FromMilliseconds(500)); + runResponse = await client.GetRunAsync(thread.Id, runResponse.Value.Id); +} +while (runResponse.Value.Status == RunStatus.Queued + || runResponse.Value.Status == RunStatus.InProgress + || runResponse.Value.Status == RunStatus.RequiresAction); +``` + + ## Troubleshooting Any operation that fails will throw a [RequestFailedException][RequestFailedException]. The exception's `code` will hold the HTTP response status code. The exception's `message` contains a detailed message that may be helpful in diagnosing the issue: 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 b9ce4b3003051..f1950434b2ef4 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 @@ -609,6 +609,54 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 AzureFunctionBinding : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AzureFunctionBinding() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureFunctionBinding 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.AzureFunctionBinding 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 AzureFunctionStorageQueue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureFunctionStorageQueue(string storageQueueUri, string queueName) { } + public string QueueName { get { throw null; } set { } } + public string StorageQueueUri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureFunctionStorageQueue 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.AzureFunctionStorageQueue 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 AzureFunctionToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureFunctionToolDefinition(string name, string description, Azure.AI.Projects.AzureStorageQueueBinding inputBinding, Azure.AI.Projects.AzureStorageQueueBinding outputBinding, System.BinaryData parameters) { } + public string Description { get { throw null; } } + public string Name { get { throw null; } } + public System.BinaryData Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureFunctionToolDefinition 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.AzureFunctionToolDefinition 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 AzureStorageQueueBinding : Azure.AI.Projects.AzureFunctionBinding, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureStorageQueueBinding(Azure.AI.Projects.AzureFunctionStorageQueue storageQueue) { } + public Azure.AI.Projects.AzureFunctionStorageQueue StorageQueue { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureStorageQueueBinding 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.AzureStorageQueueBinding 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 BingGroundingToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public BingGroundingToolDefinition(Azure.AI.Projects.ToolConnectionList bingGrounding) { } @@ -1430,8 +1478,8 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write } public partial class MicrosoftFabricToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public MicrosoftFabricToolDefinition(Azure.AI.Projects.ToolConnectionList microsoftFabric) { } - public Azure.AI.Projects.ToolConnectionList MicrosoftFabric { get { throw null; } set { } } + public MicrosoftFabricToolDefinition(Azure.AI.Projects.ToolConnectionList fabricAiskill) { } + public Azure.AI.Projects.ToolConnectionList FabricAiskill { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.MicrosoftFabricToolDefinition 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) { } 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 b9ce4b3003051..f1950434b2ef4 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 @@ -609,6 +609,54 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 AzureFunctionBinding : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AzureFunctionBinding() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureFunctionBinding 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.AzureFunctionBinding 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 AzureFunctionStorageQueue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureFunctionStorageQueue(string storageQueueUri, string queueName) { } + public string QueueName { get { throw null; } set { } } + public string StorageQueueUri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureFunctionStorageQueue 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.AzureFunctionStorageQueue 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 AzureFunctionToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureFunctionToolDefinition(string name, string description, Azure.AI.Projects.AzureStorageQueueBinding inputBinding, Azure.AI.Projects.AzureStorageQueueBinding outputBinding, System.BinaryData parameters) { } + public string Description { get { throw null; } } + public string Name { get { throw null; } } + public System.BinaryData Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureFunctionToolDefinition 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.AzureFunctionToolDefinition 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 AzureStorageQueueBinding : Azure.AI.Projects.AzureFunctionBinding, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureStorageQueueBinding(Azure.AI.Projects.AzureFunctionStorageQueue storageQueue) { } + public Azure.AI.Projects.AzureFunctionStorageQueue StorageQueue { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AzureStorageQueueBinding 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.AzureStorageQueueBinding 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 BingGroundingToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public BingGroundingToolDefinition(Azure.AI.Projects.ToolConnectionList bingGrounding) { } @@ -1430,8 +1478,8 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write } public partial class MicrosoftFabricToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public MicrosoftFabricToolDefinition(Azure.AI.Projects.ToolConnectionList microsoftFabric) { } - public Azure.AI.Projects.ToolConnectionList MicrosoftFabric { get { throw null; } set { } } + public MicrosoftFabricToolDefinition(Azure.AI.Projects.ToolConnectionList fabricAiskill) { } + public Azure.AI.Projects.ToolConnectionList FabricAiskill { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.MicrosoftFabricToolDefinition 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) { } diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs similarity index 56% rename from sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionDefinition.cs rename to sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs index 0eaf15d633719..7a264a5d15717 100644 --- a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs @@ -10,20 +10,20 @@ namespace Azure.AI.Projects { - [CodeGenSuppress("AzureFunctionDefinition", typeof(InternalFunctionDefinition))] - public partial class AzureFunctionDefinition + [CodeGenSuppress("AzureFunctionToolDefinition", typeof(InternalAzureFunctionDefinition))] + public partial class AzureFunctionToolDefinition { /// - public string Name => InternalFunction.Name; + public string Name => InternalAzureFunction.Function.Name; /// - public string Description => InternalFunction.Description; + public string Description => InternalAzureFunction.Function.Description; /// - public BinaryData Parameters => InternalFunction.Parameters; + public BinaryData Parameters => InternalAzureFunction.Function.Parameters; /// The definition of the function that the function tool should call. - internal InternalFunctionDefinition InternalFunction { get; set; } + internal InternalAzureFunctionDefinition InternalAzureFunction { get; set; } /// /// Initializes a new instance of AzureFunctionDefinition. @@ -34,16 +34,16 @@ public partial class AzureFunctionDefinition /// Output storage queue. /// The parameters the Azure functions accepts, described as a JSON Schema object. /// , or is null. - public AzureFunctionDefinition(string name, string description, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, BinaryData parameters) - : this(new InternalFunctionDefinition(name, description, parameters, serializedAdditionalRawData: null), inputBinding: inputBinding, outputBinding: outputBinding) + public AzureFunctionToolDefinition(string name, string description, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, BinaryData parameters) + : this(type: "azure_function", serializedAdditionalRawData: null, new InternalAzureFunctionDefinition(new InternalFunctionDefinition(name, description, parameters, serializedAdditionalRawData: null), inputBinding: inputBinding, outputBinding: outputBinding)) { } /// public override bool Equals(object obj) - => (obj is AzureFunctionDefinition toolDefinition && Name == toolDefinition.Name); + => (obj is AzureFunctionToolDefinition toolDefinition && Name == toolDefinition.Name); /// - public override int GetHashCode() => InternalFunction.GetHashCode(); + public override int GetHashCode() => InternalAzureFunction.GetHashCode(); } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs index 0515abf2f6cf7..2e12aa3406334 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.Serialization.cs @@ -36,7 +36,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("azure_function"u8); - writer.WriteObjectValue(AzureFunction, options); + writer.WriteObjectValue(InternalAzureFunction, options); } AzureFunctionToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -59,7 +59,7 @@ internal static AzureFunctionToolDefinition DeserializeAzureFunctionToolDefiniti { return null; } - AzureFunctionDefinition azureFunction = default; + InternalAzureFunctionDefinition azureFunction = default; string type = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -67,7 +67,7 @@ internal static AzureFunctionToolDefinition DeserializeAzureFunctionToolDefiniti { if (property.NameEquals("azure_function"u8)) { - azureFunction = AzureFunctionDefinition.DeserializeAzureFunctionDefinition(property.Value, options); + azureFunction = InternalAzureFunctionDefinition.DeserializeInternalAzureFunctionDefinition(property.Value, options); continue; } if (property.NameEquals("type"u8)) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs index 1a6d339a85886..87032b76e501d 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionToolDefinition.cs @@ -13,32 +13,18 @@ namespace Azure.AI.Projects /// The input definition information for a azure function tool as used to configure an agent. public partial class AzureFunctionToolDefinition : ToolDefinition { - /// Initializes a new instance of . - /// The definition of the concrete function that the function tool should call. - /// is null. - public AzureFunctionToolDefinition(AzureFunctionDefinition azureFunction) - { - Argument.AssertNotNull(azureFunction, nameof(azureFunction)); - - Type = "azure_function"; - AzureFunction = azureFunction; - } - /// Initializes a new instance of . /// The object type. /// Keeps track of any properties unknown to the library. - /// The definition of the concrete function that the function tool should call. - internal AzureFunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, AzureFunctionDefinition azureFunction) : base(type, serializedAdditionalRawData) + /// The definition of the concrete function that the function tool should call. + internal AzureFunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, InternalAzureFunctionDefinition internalAzureFunction) : base(type, serializedAdditionalRawData) { - AzureFunction = azureFunction; + InternalAzureFunction = internalAzureFunction; } /// Initializes a new instance of for deserialization. internal AzureFunctionToolDefinition() { } - - /// The definition of the concrete function that the function tool should call. - public AzureFunctionDefinition AzureFunction { get; set; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.Serialization.cs similarity index 66% rename from sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.Serialization.cs rename to sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.Serialization.cs index 2bf449af09543..d5c3f8a769923 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Projects { - public partial class AzureFunctionDefinition : IUtf8JsonSerializable, IJsonModel + internal partial class InternalAzureFunctionDefinition : 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,14 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(AzureFunctionDefinition)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support writing '{format}' format."); } writer.WritePropertyName("function"u8); - writer.WriteObjectValue(InternalFunction, options); + writer.WriteObjectValue(Function, options); writer.WritePropertyName("input_binding"u8); writer.WriteObjectValue(InputBinding, options); writer.WritePropertyName("output_binding"u8); @@ -57,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AzureFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + InternalAzureFunctionDefinition 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(AzureFunctionDefinition)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAzureFunctionDefinition(document.RootElement, options); + return DeserializeInternalAzureFunctionDefinition(document.RootElement, options); } - internal static AzureFunctionDefinition DeserializeAzureFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) + internal static InternalAzureFunctionDefinition DeserializeInternalAzureFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -105,46 +105,46 @@ internal static AzureFunctionDefinition DeserializeAzureFunctionDefinition(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new AzureFunctionDefinition(function, inputBinding, outputBinding, serializedAdditionalRawData); + return new InternalAzureFunctionDefinition(function, inputBinding, outputBinding, 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(AzureFunctionDefinition)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support writing '{options.Format}' format."); } } - AzureFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + InternalAzureFunctionDefinition 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); - return DeserializeAzureFunctionDefinition(document.RootElement, options); + return DeserializeInternalAzureFunctionDefinition(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AzureFunctionDefinition)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} 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 AzureFunctionDefinition FromResponse(Response response) + internal static InternalAzureFunctionDefinition FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeAzureFunctionDefinition(document.RootElement); + return DeserializeInternalAzureFunctionDefinition(document.RootElement); } /// Convert into a . diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs similarity index 68% rename from sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs rename to sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs index cbd7c4bcf342d..e6d5e343ed5bc 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Projects { /// The definition of Azure function. - public partial class AzureFunctionDefinition + internal partial class InternalAzureFunctionDefinition { /// /// Keeps track of any properties unknown to the library. @@ -45,39 +45,42 @@ public partial class AzureFunctionDefinition /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The definition of azure function and its parameters. + /// Initializes a new instance of . + /// The definition of azure function and its parameters. /// Input storage queue. /// Output storage queue. - /// , or is null. - internal AzureFunctionDefinition(InternalFunctionDefinition internalFunction, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding) + /// , or is null. + public InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding) { - Argument.AssertNotNull(internalFunction, nameof(internalFunction)); + Argument.AssertNotNull(function, nameof(function)); Argument.AssertNotNull(inputBinding, nameof(inputBinding)); Argument.AssertNotNull(outputBinding, nameof(outputBinding)); - InternalFunction = internalFunction; + Function = function; InputBinding = inputBinding; OutputBinding = outputBinding; } - /// Initializes a new instance of . - /// The definition of azure function and its parameters. + /// Initializes a new instance of . + /// The definition of azure function and its parameters. /// Input storage queue. /// Output storage queue. /// Keeps track of any properties unknown to the library. - internal AzureFunctionDefinition(InternalFunctionDefinition internalFunction, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, IDictionary serializedAdditionalRawData) + internal InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, IDictionary serializedAdditionalRawData) { - InternalFunction = internalFunction; + Function = function; InputBinding = inputBinding; OutputBinding = outputBinding; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal AzureFunctionDefinition() + /// Initializes a new instance of for deserialization. + internal InternalAzureFunctionDefinition() { } + + /// The definition of azure function and its parameters. + public InternalFunctionDefinition Function { get; set; } /// Input storage queue. public AzureStorageQueueBinding InputBinding { get; set; } /// Output storage queue. diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs index 1ed567f232fe9..22de2be4da9b4 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -27,43 +27,40 @@ public async Task AzureFunctionCallingExample() AgentsClient client = new(connectionString, new DefaultAzureCredential(), clientOptions); #region Snippet:AzureFunctionsDefineFunctionTools - // Example of Azure Function AzureFunctionToolDefinition azureFnTool = new( - azureFunction: new AzureFunctionDefinition( - name: "foo", - description: "Get answers from the foo bot.", - inputBinding: new AzureStorageQueueBinding( - new AzureFunctionStorageQueue( - queueName: "azure-function-foo-input", - storageQueueUri: storageQueueUri - ) - ), - outputBinding: new AzureStorageQueueBinding( - new AzureFunctionStorageQueue( - queueName: "azure-function-tool-output", - storageQueueUri: storageQueueUri - ) - ), - parameters: BinaryData.FromObjectAsJson( - new + name: "foo", + description: "Get answers from the foo bot.", + inputBinding: new AzureStorageQueueBinding( + new AzureFunctionStorageQueue( + queueName: "azure-function-foo-input", + storageQueueUri: storageQueueUri + ) + ), + outputBinding: new AzureStorageQueueBinding( + new AzureFunctionStorageQueue( + queueName: "azure-function-tool-output", + storageQueueUri: storageQueueUri + ) + ), + parameters: BinaryData.FromObjectAsJson( + new + { + Type = "object", + Properties = new { - Type = "object", - Properties = new + query = new { - query = new - { - Type = "string", - Description = "The question to ask.", - }, - outputqueueuri = new - { - Type = "string", - Description = "The full output queue uri." - } + Type = "string", + Description = "The question to ask.", }, + outputqueueuri = new + { + Type = "string", + Description = "The full output queue uri." + } }, - new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase } - ) + }, + new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase } ) ); #endregion @@ -71,10 +68,12 @@ public async Task AzureFunctionCallingExample() #region Snippet:AzureFunctionsCreateAgentWithFunctionTools Response agentResponse = await client.CreateAgentAsync( model: "gpt-4", - name: "SDK Test Agent - Functions", - instructions: "You are a weather bot. Use the provided functions to help answer questions. " - + "Customize your responses to the user's preferences as much as possible and use friendly " - + "nicknames for cities whenever possible.", + name: "azure-function-agent-foo", + instructions: "You are a helpful support agent. Use the provided function any " + + "time the prompt contains the string 'What would foo say?'. When you invoke " + + "the function, ALWAYS specify the output queue uri parameter as " + + $"'{storageQueueUri}/azure-function-tool-output'. Always responds with " + + "\"Foo says\" and then the response from the tool.", tools: new List { azureFnTool } ); Agent agent = agentResponse.Value; @@ -83,6 +82,7 @@ public async Task AzureFunctionCallingExample() Response threadResponse = await client.CreateThreadAsync(); AgentThread thread = threadResponse.Value; + #region Snippet:AzureFunctionsHandlePollingWithRequiredAction Response messageResponse = await client.CreateMessageAsync( thread.Id, MessageRole.User, @@ -91,14 +91,14 @@ public async Task AzureFunctionCallingExample() Response runResponse = await client.CreateRunAsync(thread, agent); - #region Snippet:AzureFunctionsHandlePollingWithRequiredAction do { await Task.Delay(TimeSpan.FromMilliseconds(500)); runResponse = await client.GetRunAsync(thread.Id, runResponse.Value.Id); } while (runResponse.Value.Status == RunStatus.Queued - || runResponse.Value.Status == RunStatus.InProgress); + || runResponse.Value.Status == RunStatus.InProgress + || runResponse.Value.Status == RunStatus.RequiresAction); #endregion Response> afterRunMessagesResponse diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index 2c17cf7e39fea..76275c4ac3da5 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: 278d3a9448aafdc6ded4f28ff5c8a50d3abef519 +commit: d4b732b6c7f7a20c9eb1dcf68014581272e592df repo: Azure/azure-rest-api-specs additionalDirectories: From 0b5b81825da9f9c896b15818217384674c6c2b80 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:47:26 -0800 Subject: [PATCH 05/18] Fix --- .../Samples/Agent/Sample_Agent_Azure_Functions.cs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs index 22de2be4da9b4..53987e8373d7d 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -23,7 +23,7 @@ public async Task AzureFunctionCallingExample() var storageQueueUri = TestEnvironment.STORAGE_QUEUE_URI; // Add experimental headers policy AIProjectClientOptions clientOptions = new(); - clientOptions.AddPolicy(new ExperimentalHeaderPolicy(), HttpPipelinePosition.PerCall); + clientOptions.AddPolicy(new CustomHeadersPolicy(), HttpPipelinePosition.PerCall); AgentsClient client = new(connectionString, new DefaultAzureCredential(), clientOptions); #region Snippet:AzureFunctionsDefineFunctionTools @@ -123,17 +123,4 @@ Response> afterRunMessagesResponse } } } - private class ExperimentalHeaderPolicy : HttpPipelinePolicy - { - public override void Process(HttpMessage message, ReadOnlyMemory pipeline) - { - message.Request.Headers.Add("x-ms-enable-preview", "true"); - ProcessNext(message, pipeline); - } - public override ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory pipeline) - { - message.Request.Headers.Add("x-ms-enable-preview", "true"); - return ProcessNextAsync(message, pipeline); - } - } } From 0ebd687b75cba316620efaae4f6845a2c8a34712 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:11:31 -0800 Subject: [PATCH 06/18] Generate new code and port parallel run --- .../src/Custom/Agent/AIClientModelFactory.cs | 2 +- .../Custom/Agent/AgentsClient.Streaming.cs | 8 +++++-- .../src/Custom/Agent/AgentsClient.cs | 4 ++-- .../Agent/Streaming/StreamingUpdateReason.cs | 2 +- .../Azure.AI.Projects/src/Generated/Agent.cs | 6 ++--- .../src/Generated/AgentStreamEvent.cs | 2 +- .../src/Generated/AgentsClient.cs | 24 ++++++++++++------- .../Generated/AzureFunctionStorageQueue.cs | 6 ++--- .../src/Generated/CreateAgentRequest.cs | 4 ++-- .../CreateRunRequest.Serialization.cs | 16 +++++++++++++ .../src/Generated/CreateRunRequest.cs | 10 +++++--- ...CreateThreadAndRunRequest.Serialization.cs | 16 +++++++++++++ .../Generated/CreateThreadAndRunRequest.cs | 10 +++++--- .../InternalAzureFunctionDefinition.cs | 12 +++++----- .../src/Generated/RunStreamEvent.cs | 2 +- .../src/Generated/ThreadRun.Serialization.cs | 15 ++++-------- .../src/Generated/ThreadRun.cs | 14 ++++++----- .../src/Generated/ToolDefinition.cs | 2 +- .../src/Generated/UpdateAgentRequest.cs | 4 ++-- .../Agent/Sample_Agent_Azure_Functions.cs | 5 +--- sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 21 files changed, 105 insertions(+), 61 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AIClientModelFactory.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AIClientModelFactory.cs index 2a226baaaad29..a7cee4f50d0ef 100644 --- a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AIClientModelFactory.cs +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AIClientModelFactory.cs @@ -133,7 +133,7 @@ public static ThreadRun ThreadRun(string id = null, string threadId = null, stri tools ??= new List(); metadata ??= new Dictionary(); - return new ThreadRun(id, @object: null, threadId, agentId, status, requiredAction, lastError, model, instructions, tools.ToList(), createdAt, expiresAt, startedAt, completedAt, cancelledAt, failedAt, incompleteDetails, usage, temperature, topP, maxPromptTokens, maxCompletionTokens, truncationStrategy, toolChoice, responseFormat, metadata, toolResources, parallelToolCalls, serializedAdditionalRawData: null); + return new ThreadRun(id, @object: null, threadId, agentId, status, requiredAction, lastError, model, instructions, tools.ToList(), createdAt, expiresAt, startedAt, completedAt, cancelledAt, failedAt, incompleteDetails, usage, temperature, topP, maxPromptTokens, maxCompletionTokens, truncationStrategy, toolChoice, responseFormat, metadata, toolResources, parallelToolCalls ?? true, serializedAdditionalRawData: null); } /// Initializes a new instance of . diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.Streaming.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.Streaming.cs index 8180b0ab46968..e7a0213989de8 100644 --- a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.Streaming.cs +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.Streaming.cs @@ -52,12 +52,13 @@ public partial class AgentsClient /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. #pragma warning disable AZC0015 // Unexpected client method return type. - public virtual AsyncCollectionResult CreateRunStreamingAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + public virtual AsyncCollectionResult CreateRunStreamingAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) #pragma warning restore AZC0015 // Unexpected client method return type. { Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); @@ -78,6 +79,7 @@ public virtual AsyncCollectionResult CreateRunStreamingAsync(st truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), null); RequestContext context = FromCancellationToken(cancellationToken); @@ -126,12 +128,13 @@ async Task sendRequestAsync() => /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. #pragma warning disable AZC0015 // Unexpected client method return type. - public virtual CollectionResult CreateRunStreaming(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + public virtual CollectionResult CreateRunStreaming(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) #pragma warning restore AZC0015 // Unexpected client method return type. { Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); @@ -152,6 +155,7 @@ public virtual CollectionResult CreateRunStreaming(string threa truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), null); RequestContext context = FromCancellationToken(cancellationToken); diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.cs index 8e26bdbe37582..bf16573a82c74 100644 --- a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.cs +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.cs @@ -108,7 +108,7 @@ public AgentsClient(Uri endpoint, string subscriptionId, string resourceGroupNam /// The cancellation token to use. /// A new instance. public virtual Response CreateRun(AgentThread thread, Agent agent, CancellationToken cancellationToken = default) - => CreateRun(thread.Id, agent.Id, null, null, null, null, null, null, null, null, null, null, null, null, null, null, cancellationToken); + => CreateRun(thread.Id, agent.Id, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, cancellationToken); /// /// Creates a new run of the specified thread using a specified agent. @@ -121,7 +121,7 @@ public virtual Response CreateRun(AgentThread thread, Agent agent, Ca /// The cancellation token to use. /// A new instance. public virtual Task> CreateRunAsync(AgentThread thread, Agent agent, CancellationToken cancellationToken = default) - => CreateRunAsync(thread.Id, agent.Id, null, null, null, null, null, null, null, null, null, null, null, null, null, null, cancellationToken); + => CreateRunAsync(thread.Id, agent.Id, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, cancellationToken); /// Returns a list of run steps associated an agent thread run. /// The instance from which run steps should be listed. diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/Streaming/StreamingUpdateReason.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/Streaming/StreamingUpdateReason.cs index 28fff18288faa..54a982496928f 100644 --- a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/Streaming/StreamingUpdateReason.cs +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/Streaming/StreamingUpdateReason.cs @@ -20,7 +20,7 @@ public enum StreamingUpdateReason /// Indicates that an update was generated as part of a thread.created event. /// /// This reason is typically only associated with calls to - /// , + /// , /// as other run-related methods operate on a thread that has previously been created. /// ThreadCreated, diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs index 394ba7cc4b5a8..ea5ad0df0decc 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs @@ -56,7 +56,7 @@ public partial class Agent /// /// The collection of tools enabled for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -104,7 +104,7 @@ internal Agent(string id, DateTimeOffset createdAt, string name, string descript /// /// The collection of tools enabled for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -162,7 +162,7 @@ internal Agent() /// /// The collection of tools enabled for the agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AgentStreamEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AgentStreamEvent.cs index 0c2e715e09a92..97c4efa2a29ed 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AgentStreamEvent.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AgentStreamEvent.cs @@ -77,7 +77,7 @@ public AgentStreamEvent(string value) public static AgentStreamEvent ThreadRunRequiresAction { get; } = new AgentStreamEvent(ThreadRunRequiresActionValue); /// Event sent when a run is completed. The data of this event is of type ThreadRun. public static AgentStreamEvent ThreadRunCompleted { get; } = new AgentStreamEvent(ThreadRunCompletedValue); - /// Event sent when a run ends incompleted. The data of this event is of type ThreadRun. + /// Event sent when a run ends incomplete. The data of this event is of type ThreadRun. public static AgentStreamEvent ThreadRunIncomplete { get; } = new AgentStreamEvent(ThreadRunIncompleteValue); /// Event sent when a run fails. The data of this event is of type ThreadRun. public static AgentStreamEvent ThreadRunFailed { get; } = new AgentStreamEvent(ThreadRunFailedValue); diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs index 6d8476ffe785a..03f27eba3f542 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs @@ -1706,11 +1706,12 @@ public virtual Response UpdateMessage(string threadId, string messageId, Request /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public virtual async Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); Argument.AssertNotNull(assistantId, nameof(assistantId)); @@ -1730,6 +1731,7 @@ public virtual async Task> CreateRunAsync(string threadId, s truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), null); RequestContext context = FromCancellationToken(cancellationToken); @@ -1776,11 +1778,12 @@ public virtual async Task> CreateRunAsync(string threadId, s /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public virtual Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + public virtual Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); Argument.AssertNotNull(assistantId, nameof(assistantId)); @@ -1800,6 +1803,7 @@ public virtual Response CreateRun(string threadId, string assistantId truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), null); RequestContext context = FromCancellationToken(cancellationToken); @@ -1817,7 +1821,7 @@ public virtual Response CreateRun(string threadId, string assistantId /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -1858,7 +1862,7 @@ public virtual async Task CreateRunAsync(string threadId, RequestConte /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2522,10 +2526,11 @@ public virtual Response CancelRun(string threadId, string runId, RequestContext /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// The cancellation token to use. /// is null. - public virtual async Task> CreateThreadAndRunAsync(string assistantId, AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateThreadAndRunAsync(string assistantId, AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(assistantId, nameof(assistantId)); @@ -2544,6 +2549,7 @@ public virtual async Task> CreateThreadAndRunAsync(string as truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), null); RequestContext context = FromCancellationToken(cancellationToken); @@ -2586,10 +2592,11 @@ public virtual async Task> CreateThreadAndRunAsync(string as /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// The cancellation token to use. /// is null. - public virtual Response CreateThreadAndRun(string assistantId, AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + public virtual Response CreateThreadAndRun(string assistantId, AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(assistantId, nameof(assistantId)); @@ -2608,6 +2615,7 @@ public virtual Response CreateThreadAndRun(string assistantId, AgentT truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), null); RequestContext context = FromCancellationToken(cancellationToken); @@ -2625,7 +2633,7 @@ public virtual Response CreateThreadAndRun(string assistantId, AgentT /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2663,7 +2671,7 @@ public virtual async Task CreateThreadAndRunAsync(RequestContent conte /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs index 3d3e0b45d42de..1f0ff63ee21fc 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs @@ -46,7 +46,7 @@ public partial class AzureFunctionStorageQueue private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// The URI of an Azure function storage queue. + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. /// The name of an Azure function storage queue. /// or is null. public AzureFunctionStorageQueue(string storageQueueUri, string queueName) @@ -59,7 +59,7 @@ public AzureFunctionStorageQueue(string storageQueueUri, string queueName) } /// Initializes a new instance of . - /// The URI of an Azure function storage queue. + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. /// The name of an Azure function storage queue. /// Keeps track of any properties unknown to the library. internal AzureFunctionStorageQueue(string storageQueueUri, string queueName, IDictionary serializedAdditionalRawData) @@ -74,7 +74,7 @@ internal AzureFunctionStorageQueue() { } - /// The URI of an Azure function storage queue. + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. public string StorageQueueUri { get; set; } /// The name of an Azure function storage queue. public string QueueName { get; set; } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs index 591b09e307920..1f51e5beb380b 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs @@ -65,7 +65,7 @@ internal CreateAgentRequest(string model) /// /// The collection of tools to enable for the new agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -115,7 +115,7 @@ internal CreateAgentRequest() /// /// The collection of tools to enable for the new agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.Serialization.cs index 91cd817d38276..bde5271e3de4b 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.Serialization.cs @@ -209,6 +209,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteNull("response_format"); } } + if (Optional.IsDefined(ParallelToolCalls)) + { + writer.WritePropertyName("parallel_tool_calls"u8); + writer.WriteBooleanValue(ParallelToolCalls.Value); + } if (Optional.IsCollectionDefined(Metadata)) { if (Metadata != null) @@ -278,6 +283,7 @@ internal static CreateRunRequest DeserializeCreateRunRequest(JsonElement element TruncationObject truncationStrategy = default; BinaryData toolChoice = default; BinaryData responseFormat = default; + bool? parallelToolCalls = default; IReadOnlyDictionary metadata = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -425,6 +431,15 @@ internal static CreateRunRequest DeserializeCreateRunRequest(JsonElement element responseFormat = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (property.NameEquals("parallel_tool_calls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parallelToolCalls = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("metadata"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -460,6 +475,7 @@ internal static CreateRunRequest DeserializeCreateRunRequest(JsonElement element truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs index f3f8b30781b34..efcfee1c47378 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs @@ -70,7 +70,7 @@ internal CreateRunRequest(string assistantId) /// /// The overridden list of enabled tools that the agent should use to run the thread. /// 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 . /// /// /// If `true`, returns a stream of events that happen during the Run as server-sent events, @@ -100,9 +100,10 @@ internal CreateRunRequest(string assistantId) /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// Keeps track of any properties unknown to the library. - internal CreateRunRequest(string assistantId, string overrideModelName, string overrideInstructions, string additionalInstructions, IReadOnlyList additionalMessages, IReadOnlyList overrideTools, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + internal CreateRunRequest(string assistantId, string overrideModelName, string overrideInstructions, string additionalInstructions, IReadOnlyList additionalMessages, IReadOnlyList overrideTools, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, bool? parallelToolCalls, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) { AssistantId = assistantId; OverrideModelName = overrideModelName; @@ -118,6 +119,7 @@ internal CreateRunRequest(string assistantId, string overrideModelName, string o TruncationStrategy = truncationStrategy; ToolChoice = toolChoice; ResponseFormat = responseFormat; + ParallelToolCalls = parallelToolCalls; Metadata = metadata; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -143,7 +145,7 @@ internal CreateRunRequest() /// /// The overridden list of enabled tools that the agent should use to run the thread. /// 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 IReadOnlyList OverrideTools { get; } /// @@ -268,6 +270,8 @@ internal CreateRunRequest() /// /// public BinaryData ResponseFormat { get; } + /// If `true` functions will run in parallel during tool use. + public bool? ParallelToolCalls { get; } /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. public IReadOnlyDictionary Metadata { get; } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.Serialization.cs index 10ad472113df2..0af226f2493c3 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.Serialization.cs @@ -197,6 +197,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteNull("response_format"); } } + if (Optional.IsDefined(ParallelToolCalls)) + { + writer.WritePropertyName("parallel_tool_calls"u8); + writer.WriteBooleanValue(ParallelToolCalls.Value); + } if (Optional.IsCollectionDefined(Metadata)) { if (Metadata != null) @@ -266,6 +271,7 @@ internal static CreateThreadAndRunRequest DeserializeCreateThreadAndRunRequest(J TruncationObject truncationStrategy = default; BinaryData toolChoice = default; BinaryData responseFormat = default; + bool? parallelToolCalls = default; IReadOnlyDictionary metadata = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -408,6 +414,15 @@ internal static CreateThreadAndRunRequest DeserializeCreateThreadAndRunRequest(J responseFormat = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (property.NameEquals("parallel_tool_calls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parallelToolCalls = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("metadata"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -443,6 +458,7 @@ internal static CreateThreadAndRunRequest DeserializeCreateThreadAndRunRequest(J truncationStrategy, toolChoice, responseFormat, + parallelToolCalls, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs index d234f56a46c83..abcf1cf5a0991 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs @@ -65,7 +65,7 @@ internal CreateThreadAndRunRequest(string assistantId) /// /// The overridden list of enabled tools the agent should use to run the thread. /// 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 . /// /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. /// @@ -96,9 +96,10 @@ internal CreateThreadAndRunRequest(string assistantId) /// The strategy to use for dropping messages as the context windows moves forward. /// Controls whether or not and which tool is called by the model. /// Specifies the format that the model must output. + /// If `true` functions will run in parallel during tool use. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. /// Keeps track of any properties unknown to the library. - internal CreateThreadAndRunRequest(string assistantId, AgentThreadCreationOptions thread, string overrideModelName, string overrideInstructions, IReadOnlyList overrideTools, UpdateToolResourcesOptions toolResources, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + internal CreateThreadAndRunRequest(string assistantId, AgentThreadCreationOptions thread, string overrideModelName, string overrideInstructions, IReadOnlyList overrideTools, UpdateToolResourcesOptions toolResources, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, bool? parallelToolCalls, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) { AssistantId = assistantId; Thread = thread; @@ -114,6 +115,7 @@ internal CreateThreadAndRunRequest(string assistantId, AgentThreadCreationOption TruncationStrategy = truncationStrategy; ToolChoice = toolChoice; ResponseFormat = responseFormat; + ParallelToolCalls = parallelToolCalls; Metadata = metadata; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -134,7 +136,7 @@ internal CreateThreadAndRunRequest() /// /// The overridden list of enabled tools the agent should use to run the thread. /// 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 IReadOnlyList OverrideTools { get; } /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. @@ -261,6 +263,8 @@ internal CreateThreadAndRunRequest() /// /// public BinaryData ResponseFormat { get; } + /// If `true` functions will run in parallel during tool use. + public bool? ParallelToolCalls { get; } /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. public IReadOnlyDictionary Metadata { get; } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs index e6d5e343ed5bc..0e34d24f7d855 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs @@ -47,8 +47,8 @@ internal partial class InternalAzureFunctionDefinition /// Initializes a new instance of . /// The definition of azure function and its parameters. - /// Input storage queue. - /// Output storage queue. + /// Input storage queue. The queue storage trigger runs a function as messages are added to it. + /// Output storage queue. The function writes output to this queue when the input items are processed. /// , or is null. public InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding) { @@ -63,8 +63,8 @@ public InternalAzureFunctionDefinition(InternalFunctionDefinition function, Azur /// Initializes a new instance of . /// The definition of azure function and its parameters. - /// Input storage queue. - /// Output storage queue. + /// Input storage queue. The queue storage trigger runs a function as messages are added to it. + /// Output storage queue. The function writes output to this queue when the input items are processed. /// Keeps track of any properties unknown to the library. internal InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, IDictionary serializedAdditionalRawData) { @@ -81,9 +81,9 @@ internal InternalAzureFunctionDefinition() /// The definition of azure function and its parameters. public InternalFunctionDefinition Function { get; set; } - /// Input storage queue. + /// Input storage queue. The queue storage trigger runs a function as messages are added to it. public AzureStorageQueueBinding InputBinding { get; set; } - /// Output storage queue. + /// Output storage queue. The function writes output to this queue when the input items are processed. public AzureStorageQueueBinding OutputBinding { get; set; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStreamEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStreamEvent.cs index 630d33f59e668..b3fd0dcab2ef8 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStreamEvent.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/RunStreamEvent.cs @@ -43,7 +43,7 @@ public RunStreamEvent(string value) public static RunStreamEvent ThreadRunRequiresAction { get; } = new RunStreamEvent(ThreadRunRequiresActionValue); /// Event sent when a run is completed. The data of this event is of type ThreadRun. public static RunStreamEvent ThreadRunCompleted { get; } = new RunStreamEvent(ThreadRunCompletedValue); - /// Event sent when a run ends incompleted. The data of this event is of type ThreadRun. + /// Event sent when a run ends incomplete. The data of this event is of type ThreadRun. public static RunStreamEvent ThreadRunIncomplete { get; } = new RunStreamEvent(ThreadRunIncompleteValue); /// Event sent when a run fails. The data of this event is of type ThreadRun. public static RunStreamEvent ThreadRunFailed { get; } = new RunStreamEvent(ThreadRunFailedValue); diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.Serialization.cs index 3319be0f6b356..46c6f4a2e3f7e 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.Serialization.cs @@ -251,11 +251,8 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteNull("tool_resources"); } } - if (Optional.IsDefined(ParallelToolCalls)) - { - writer.WritePropertyName("parallelToolCalls"u8); - writer.WriteBooleanValue(ParallelToolCalls.Value); - } + writer.WritePropertyName("parallel_tool_calls"u8); + writer.WriteBooleanValue(ParallelToolCalls); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -320,7 +317,7 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW BinaryData responseFormat = default; IReadOnlyDictionary metadata = default; UpdateToolResourcesOptions toolResources = default; - bool? parallelToolCalls = default; + bool parallelToolCalls = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -535,12 +532,8 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW toolResources = UpdateToolResourcesOptions.DeserializeUpdateToolResourcesOptions(property.Value, options); continue; } - if (property.NameEquals("parallelToolCalls"u8)) + if (property.NameEquals("parallel_tool_calls"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } parallelToolCalls = property.Value.GetBoolean(); continue; } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs index f60b310b3bcbe..9dccf0b2e901c 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs @@ -57,7 +57,7 @@ public partial class ThreadRun /// /// The overridden enabled tools used for this agent thread run. /// 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 . /// /// The Unix timestamp, in seconds, representing when this object was created. /// The Unix timestamp, in seconds, representing when this item expires. @@ -73,8 +73,9 @@ public partial class ThreadRun /// Controls whether or not and which tool is called by the model. /// The response format of the tool calls used in this run. /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// Determines if tools can be executed in parallel within the run. /// , , , , or is null. - internal ThreadRun(string id, string threadId, string assistantId, RunStatus status, RunError lastError, string model, string instructions, IEnumerable tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata) + internal ThreadRun(string id, string threadId, string assistantId, RunStatus status, RunError lastError, string model, string instructions, IEnumerable tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, bool parallelToolCalls) { Argument.AssertNotNull(id, nameof(id)); Argument.AssertNotNull(threadId, nameof(threadId)); @@ -105,6 +106,7 @@ internal ThreadRun(string id, string threadId, string assistantId, RunStatus sta ToolChoice = toolChoice; ResponseFormat = responseFormat; Metadata = metadata; + ParallelToolCalls = parallelToolCalls; } /// Initializes a new instance of . @@ -124,7 +126,7 @@ internal ThreadRun(string id, string threadId, string assistantId, RunStatus sta /// /// The overridden enabled tools used for this agent thread run. /// 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 . /// /// The Unix timestamp, in seconds, representing when this object was created. /// The Unix timestamp, in seconds, representing when this item expires. @@ -145,7 +147,7 @@ internal ThreadRun(string id, string threadId, string assistantId, RunStatus sta /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. /// Determines if tools can be executed in parallel within the run. /// Keeps track of any properties unknown to the library. - internal ThreadRun(string id, string @object, string threadId, string assistantId, RunStatus status, RequiredAction requiredAction, RunError lastError, string model, string instructions, IReadOnlyList tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, UpdateToolResourcesOptions toolResources, bool? parallelToolCalls, IDictionary serializedAdditionalRawData) + internal ThreadRun(string id, string @object, string threadId, string assistantId, RunStatus status, RequiredAction requiredAction, RunError lastError, string model, string instructions, IReadOnlyList tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, TruncationObject truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, UpdateToolResourcesOptions toolResources, bool parallelToolCalls, IDictionary serializedAdditionalRawData) { Id = id; Object = @object; @@ -207,7 +209,7 @@ internal ThreadRun() /// /// The overridden enabled tools used for this agent thread run. /// 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 IReadOnlyList Tools { get; } /// The Unix timestamp, in seconds, representing when this object was created. @@ -331,6 +333,6 @@ internal ThreadRun() /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. public UpdateToolResourcesOptions ToolResources { get; } /// Determines if tools can be executed in parallel within the run. - public bool? ParallelToolCalls { get; } + public bool ParallelToolCalls { get; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs index 81252e5ccbbaf..d6ebe82f65fff 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Projects /// /// An abstract representation of an input tool definition that an agent can use. /// 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 abstract partial class ToolDefinition { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs index da7f3ac2d4b59..20d36641d6a5a 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs @@ -60,7 +60,7 @@ internal UpdateAgentRequest() /// /// The modified collection of tools to enable for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, @@ -105,7 +105,7 @@ internal UpdateAgentRequest(string model, string name, string description, strin /// /// The modified collection of tools to enable for the agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs index 53987e8373d7d..ec7ed7eea75d5 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -21,10 +21,7 @@ public async Task AzureFunctionCallingExample() { var connectionString = TestEnvironment.AzureAICONNECTIONSTRING; var storageQueueUri = TestEnvironment.STORAGE_QUEUE_URI; - // Add experimental headers policy - AIProjectClientOptions clientOptions = new(); - clientOptions.AddPolicy(new CustomHeadersPolicy(), HttpPipelinePosition.PerCall); - AgentsClient client = new(connectionString, new DefaultAzureCredential(), clientOptions); + AgentsClient client = new(connectionString, new DefaultAzureCredential()); #region Snippet:AzureFunctionsDefineFunctionTools AzureFunctionToolDefinition azureFnTool = new( diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index b003672683bce..73da152e5b8b1 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: f82185fa22ee5b879726d7b3a35e98691016db5d +commit: dfb43c836f55ffcbe2bb7ade6508a974e2750b11 repo: Azure/azure-rest-api-specs additionalDirectories: From 92c4cf994010543324403ba5ab611f78ef83a950 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:19:39 -0800 Subject: [PATCH 07/18] Update docs --- .../api/Azure.AI.Projects.net8.0.cs | 14 +++++++------- .../api/Azure.AI.Projects.netstandard2.0.cs | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) 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 d2ce385863fe7..bdc4d33699ff7 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 @@ -199,18 +199,18 @@ public AgentsClient(System.Uri endpoint, string subscriptionId, string resourceG public virtual System.Threading.Tasks.Task CreateMessageAsync(string threadId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CreateRun(Azure.AI.Projects.AgentThread thread, Azure.AI.Projects.Agent agent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateRun(string threadId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateRunAsync(Azure.AI.Projects.AgentThread thread, Azure.AI.Projects.Agent agent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateRunAsync(string threadId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.ClientModel.CollectionResult CreateRunStreaming(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.ClientModel.AsyncCollectionResult CreateRunStreamingAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.ClientModel.CollectionResult CreateRunStreaming(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.ClientModel.AsyncCollectionResult CreateRunStreamingAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateThread(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CreateThread(System.Collections.Generic.IEnumerable messages = null, Azure.AI.Projects.ToolResources toolResources = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateThreadAndRun(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CreateThreadAndRun(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateThreadAndRun(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateThreadAndRunAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateThreadAndRunAsync(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateThreadAndRunAsync(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateThreadAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateThreadAsync(System.Collections.Generic.IEnumerable messages = null, Azure.AI.Projects.ToolResources toolResources = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateVectorStore(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } @@ -2330,7 +2330,7 @@ internal ThreadRun() { } public int? MaxPromptTokens { get { throw null; } } public System.Collections.Generic.IReadOnlyDictionary Metadata { get { throw null; } } public string Model { get { throw null; } } - public bool? ParallelToolCalls { get { throw null; } } + public bool ParallelToolCalls { get { throw null; } } public Azure.AI.Projects.RequiredAction RequiredAction { get { throw null; } } public System.Collections.Generic.IReadOnlyList RequiredActions { get { throw null; } } public System.BinaryData ResponseFormat { get { throw null; } } 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 d2ce385863fe7..bdc4d33699ff7 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 @@ -199,18 +199,18 @@ public AgentsClient(System.Uri endpoint, string subscriptionId, string resourceG public virtual System.Threading.Tasks.Task CreateMessageAsync(string threadId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CreateRun(Azure.AI.Projects.AgentThread thread, Azure.AI.Projects.Agent agent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateRun(string threadId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateRunAsync(Azure.AI.Projects.AgentThread thread, Azure.AI.Projects.Agent agent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateRunAsync(string threadId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.ClientModel.CollectionResult CreateRunStreaming(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.ClientModel.AsyncCollectionResult CreateRunStreamingAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.ClientModel.CollectionResult CreateRunStreaming(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.ClientModel.AsyncCollectionResult CreateRunStreamingAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, System.Collections.Generic.IEnumerable additionalMessages = null, System.Collections.Generic.IEnumerable overrideTools = null, float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateThread(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CreateThread(System.Collections.Generic.IEnumerable messages = null, Azure.AI.Projects.ToolResources toolResources = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateThreadAndRun(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CreateThreadAndRun(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateThreadAndRun(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateThreadAndRunAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateThreadAndRunAsync(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateThreadAndRunAsync(string assistantId, Azure.AI.Projects.AgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, System.Collections.Generic.IEnumerable overrideTools = null, Azure.AI.Projects.UpdateToolResourcesOptions toolResources = null, bool? stream = default(bool?), float? temperature = default(float?), float? topP = default(float?), int? maxPromptTokens = default(int?), int? maxCompletionTokens = default(int?), Azure.AI.Projects.TruncationObject truncationStrategy = null, System.BinaryData toolChoice = null, System.BinaryData responseFormat = null, bool? parallelToolCalls = default(bool?), System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateThreadAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateThreadAsync(System.Collections.Generic.IEnumerable messages = null, Azure.AI.Projects.ToolResources toolResources = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateVectorStore(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } @@ -2330,7 +2330,7 @@ internal ThreadRun() { } public int? MaxPromptTokens { get { throw null; } } public System.Collections.Generic.IReadOnlyDictionary Metadata { get { throw null; } } public string Model { get { throw null; } } - public bool? ParallelToolCalls { get { throw null; } } + public bool ParallelToolCalls { get { throw null; } } public Azure.AI.Projects.RequiredAction RequiredAction { get { throw null; } } public System.Collections.Generic.IReadOnlyList RequiredActions { get { throw null; } } public System.BinaryData ResponseFormat { get { throw null; } } From 44643fcc58cf2bc41b1bfea250869635806d81e1 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Wed, 4 Dec 2024 11:36:48 -0800 Subject: [PATCH 08/18] Fix --- sdk/ai/Azure.AI.Projects/README.md | 8 +- .../api/Azure.AI.Projects.net8.0.cs | 41 +++--- .../api/Azure.AI.Projects.netstandard2.0.cs | 41 +++--- .../Agent/AzureFunctionToolDefinition.cs | 2 +- .../src/Generated/AIProjectsModelFactory.cs | 9 ++ .../AzureFunctionBinding.Serialization.cs | 29 +++- .../src/Generated/AzureFunctionBinding.cs | 35 +++-- ...AzureFunctionStorageQueue.Serialization.cs | 2 +- .../Generated/AzureFunctionStorageQueue.cs | 18 +-- .../AzureStorageQueueBinding.Serialization.cs | 134 ------------------ .../src/Generated/AzureStorageQueueBinding.cs | 44 ------ ...alAzureFunctionDefinition.Serialization.cs | 8 +- .../InternalAzureFunctionDefinition.cs | 8 +- ...knownAzureFunctionBinding.Serialization.cs | 126 ---------------- .../Generated/UnknownAzureFunctionBinding.cs | 28 ---- .../Agent/Sample_Agent_Azure_Functions.cs | 8 +- sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 17 files changed, 133 insertions(+), 410 deletions(-) delete mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs delete mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs diff --git a/sdk/ai/Azure.AI.Projects/README.md b/sdk/ai/Azure.AI.Projects/README.md index 1389c37e406d1..7a9c6e9023002 100644 --- a/sdk/ai/Azure.AI.Projects/README.md +++ b/sdk/ai/Azure.AI.Projects/README.md @@ -354,16 +354,16 @@ We also can use Azure Function from inside the agent. In the example below we ar AzureFunctionToolDefinition azureFnTool = new( name: "foo", description: "Get answers from the foo bot.", - inputBinding: new AzureStorageQueueBinding( + inputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-foo-input", - storageQueueUri: storageQueueUri + storageServiceUri: storageQueueUri ) ), - outputBinding: new AzureStorageQueueBinding( + outputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-tool-output", - storageQueueUri: storageQueueUri + storageServiceUri: storageQueueUri ) ), parameters: BinaryData.FromObjectAsJson( 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 bdc4d33699ff7..10d2334675fd2 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 @@ -484,6 +484,7 @@ public static partial class AIProjectsModelFactory { public static Azure.AI.Projects.AgentPageableListOfVectorStore AgentPageableListOfVectorStore(Azure.AI.Projects.AgentPageableListOfVectorStoreObject @object = default(Azure.AI.Projects.AgentPageableListOfVectorStoreObject), System.Collections.Generic.IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = false) { throw null; } public static Azure.AI.Projects.AgentPageableListOfVectorStoreFile AgentPageableListOfVectorStoreFile(Azure.AI.Projects.AgentPageableListOfVectorStoreFileObject @object = default(Azure.AI.Projects.AgentPageableListOfVectorStoreFileObject), System.Collections.Generic.IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = false) { throw null; } + public static Azure.AI.Projects.AzureFunctionBinding AzureFunctionBinding(Azure.AI.Projects.AzureFunctionBindingType type = default(Azure.AI.Projects.AzureFunctionBindingType), Azure.AI.Projects.AzureFunctionStorageQueue storageQueue = null) { throw null; } public static Azure.AI.Projects.ConnectionProperties ConnectionProperties(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null) { throw null; } public static Azure.AI.Projects.ConnectionPropertiesApiKeyAuth ConnectionPropertiesApiKeyAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null, Azure.AI.Projects.CredentialsApiKeyAuth credentials = null) { throw null; } public static Azure.AI.Projects.ConnectionResponse ConnectionResponse(string id = null, string name = null, Azure.AI.Projects.ConnectionProperties properties = null) { throw null; } @@ -611,9 +612,11 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 AzureFunctionBinding : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AzureFunctionBinding : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - protected AzureFunctionBinding() { } + public AzureFunctionBinding(Azure.AI.Projects.AzureFunctionStorageQueue storageQueue) { } + public Azure.AI.Projects.AzureFunctionStorageQueue StorageQueue { get { throw null; } set { } } + public Azure.AI.Projects.AzureFunctionBindingType Type { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureFunctionBinding 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) { } @@ -621,11 +624,28 @@ 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; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AzureFunctionBindingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AzureFunctionBindingType(string value) { throw null; } + public static Azure.AI.Projects.AzureFunctionBindingType StorageQueue { get { throw null; } } + public bool Equals(Azure.AI.Projects.AzureFunctionBindingType 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.AzureFunctionBindingType left, Azure.AI.Projects.AzureFunctionBindingType right) { throw null; } + public static implicit operator Azure.AI.Projects.AzureFunctionBindingType (string value) { throw null; } + public static bool operator !=(Azure.AI.Projects.AzureFunctionBindingType left, Azure.AI.Projects.AzureFunctionBindingType right) { throw null; } + public override string ToString() { throw null; } + } public partial class AzureFunctionStorageQueue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AzureFunctionStorageQueue(string storageQueueUri, string queueName) { } + public AzureFunctionStorageQueue(string storageServiceUri, string queueName) { } public string QueueName { get { throw null; } set { } } - public string StorageQueueUri { get { throw null; } set { } } + public string StorageServiceUri { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureFunctionStorageQueue 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) { } @@ -635,7 +655,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class AzureFunctionToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AzureFunctionToolDefinition(string name, string description, Azure.AI.Projects.AzureStorageQueueBinding inputBinding, Azure.AI.Projects.AzureStorageQueueBinding outputBinding, System.BinaryData parameters) { } + public AzureFunctionToolDefinition(string name, string description, Azure.AI.Projects.AzureFunctionBinding inputBinding, Azure.AI.Projects.AzureFunctionBinding outputBinding, System.BinaryData parameters) { } public string Description { get { throw null; } } public string Name { get { throw null; } } public System.BinaryData Parameters { get { throw null; } } @@ -648,17 +668,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 AzureStorageQueueBinding : Azure.AI.Projects.AzureFunctionBinding, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public AzureStorageQueueBinding(Azure.AI.Projects.AzureFunctionStorageQueue storageQueue) { } - public Azure.AI.Projects.AzureFunctionStorageQueue StorageQueue { get { throw null; } set { } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Projects.AzureStorageQueueBinding 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.AzureStorageQueueBinding 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 BingGroundingToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public BingGroundingToolDefinition(Azure.AI.Projects.ToolConnectionList bingGrounding) { } 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 bdc4d33699ff7..10d2334675fd2 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 @@ -484,6 +484,7 @@ public static partial class AIProjectsModelFactory { public static Azure.AI.Projects.AgentPageableListOfVectorStore AgentPageableListOfVectorStore(Azure.AI.Projects.AgentPageableListOfVectorStoreObject @object = default(Azure.AI.Projects.AgentPageableListOfVectorStoreObject), System.Collections.Generic.IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = false) { throw null; } public static Azure.AI.Projects.AgentPageableListOfVectorStoreFile AgentPageableListOfVectorStoreFile(Azure.AI.Projects.AgentPageableListOfVectorStoreFileObject @object = default(Azure.AI.Projects.AgentPageableListOfVectorStoreFileObject), System.Collections.Generic.IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = false) { throw null; } + public static Azure.AI.Projects.AzureFunctionBinding AzureFunctionBinding(Azure.AI.Projects.AzureFunctionBindingType type = default(Azure.AI.Projects.AzureFunctionBindingType), Azure.AI.Projects.AzureFunctionStorageQueue storageQueue = null) { throw null; } public static Azure.AI.Projects.ConnectionProperties ConnectionProperties(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null) { throw null; } public static Azure.AI.Projects.ConnectionPropertiesApiKeyAuth ConnectionPropertiesApiKeyAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null, Azure.AI.Projects.CredentialsApiKeyAuth credentials = null) { throw null; } public static Azure.AI.Projects.ConnectionResponse ConnectionResponse(string id = null, string name = null, Azure.AI.Projects.ConnectionProperties properties = null) { throw null; } @@ -611,9 +612,11 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 AzureFunctionBinding : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AzureFunctionBinding : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - protected AzureFunctionBinding() { } + public AzureFunctionBinding(Azure.AI.Projects.AzureFunctionStorageQueue storageQueue) { } + public Azure.AI.Projects.AzureFunctionStorageQueue StorageQueue { get { throw null; } set { } } + public Azure.AI.Projects.AzureFunctionBindingType Type { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureFunctionBinding 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) { } @@ -621,11 +624,28 @@ 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; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AzureFunctionBindingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AzureFunctionBindingType(string value) { throw null; } + public static Azure.AI.Projects.AzureFunctionBindingType StorageQueue { get { throw null; } } + public bool Equals(Azure.AI.Projects.AzureFunctionBindingType 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.AzureFunctionBindingType left, Azure.AI.Projects.AzureFunctionBindingType right) { throw null; } + public static implicit operator Azure.AI.Projects.AzureFunctionBindingType (string value) { throw null; } + public static bool operator !=(Azure.AI.Projects.AzureFunctionBindingType left, Azure.AI.Projects.AzureFunctionBindingType right) { throw null; } + public override string ToString() { throw null; } + } public partial class AzureFunctionStorageQueue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AzureFunctionStorageQueue(string storageQueueUri, string queueName) { } + public AzureFunctionStorageQueue(string storageServiceUri, string queueName) { } public string QueueName { get { throw null; } set { } } - public string StorageQueueUri { get { throw null; } set { } } + public string StorageServiceUri { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureFunctionStorageQueue 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) { } @@ -635,7 +655,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class AzureFunctionToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AzureFunctionToolDefinition(string name, string description, Azure.AI.Projects.AzureStorageQueueBinding inputBinding, Azure.AI.Projects.AzureStorageQueueBinding outputBinding, System.BinaryData parameters) { } + public AzureFunctionToolDefinition(string name, string description, Azure.AI.Projects.AzureFunctionBinding inputBinding, Azure.AI.Projects.AzureFunctionBinding outputBinding, System.BinaryData parameters) { } public string Description { get { throw null; } } public string Name { get { throw null; } } public System.BinaryData Parameters { get { throw null; } } @@ -648,17 +668,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 AzureStorageQueueBinding : Azure.AI.Projects.AzureFunctionBinding, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public AzureStorageQueueBinding(Azure.AI.Projects.AzureFunctionStorageQueue storageQueue) { } - public Azure.AI.Projects.AzureFunctionStorageQueue StorageQueue { get { throw null; } set { } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Projects.AzureStorageQueueBinding 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.AzureStorageQueueBinding 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 BingGroundingToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public BingGroundingToolDefinition(Azure.AI.Projects.ToolConnectionList bingGrounding) { } diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs index 7a264a5d15717..e9532c4fc8780 100644 --- a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs @@ -34,7 +34,7 @@ public partial class AzureFunctionToolDefinition /// Output storage queue. /// The parameters the Azure functions accepts, described as a JSON Schema object. /// , or is null. - public AzureFunctionToolDefinition(string name, string description, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, BinaryData parameters) + public AzureFunctionToolDefinition(string name, string description, AzureFunctionBinding inputBinding, AzureFunctionBinding outputBinding, BinaryData parameters) : this(type: "azure_function", serializedAdditionalRawData: null, new InternalAzureFunctionDefinition(new InternalFunctionDefinition(name, description, parameters, serializedAdditionalRawData: null), inputBinding: inputBinding, outputBinding: outputBinding)) { } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs index cbab281da95be..720fa4e8cb327 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs @@ -164,6 +164,15 @@ public static CredentialsApiKeyAuth CredentialsApiKeyAuth(string key = null) return new CredentialsApiKeyAuth(key, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The type of binding, which is always 'storage_queue'. + /// Storage queue. + /// A new instance for mocking. + public static AzureFunctionBinding AzureFunctionBinding(AzureFunctionBindingType type = default, AzureFunctionStorageQueue storageQueue = null) + { + return new AzureFunctionBinding(type, storageQueue, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// /// The role of the entity that is creating the message. Allowed values include: diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs index a9ce253d16993..a4debebae7985 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.Serialization.cs @@ -7,12 +7,12 @@ using System; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.AI.Projects { - [PersistableModelProxy(typeof(UnknownAzureFunctionBinding))] public partial class AzureFunctionBinding : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -35,7 +35,9 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("storage_queue"u8); + writer.WriteObjectValue(StorageQueue, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -73,14 +75,29 @@ internal static AzureFunctionBinding DeserializeAzureFunctionBinding(JsonElement { return null; } - if (element.TryGetProperty("type", out JsonElement discriminator)) + AzureFunctionBindingType type = default; + AzureFunctionStorageQueue storageQueue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) { - switch (discriminator.GetString()) + if (property.NameEquals("type"u8)) { - case "storage_queue": return AzureStorageQueueBinding.DeserializeAzureStorageQueueBinding(element, options); + type = new AzureFunctionBindingType(property.Value.GetString()); + continue; + } + if (property.NameEquals("storage_queue"u8)) + { + storageQueue = AzureFunctionStorageQueue.DeserializeAzureFunctionStorageQueue(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } - return UnknownAzureFunctionBinding.DeserializeUnknownAzureFunctionBinding(element, options); + serializedAdditionalRawData = rawDataDictionary; + return new AzureFunctionBinding(type, storageQueue, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs index 9b69be69cb44a..86898f39d8121 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBinding.cs @@ -10,12 +10,8 @@ namespace Azure.AI.Projects { - /// - /// The Azure function binding - /// 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 . - /// - public abstract partial class AzureFunctionBinding + /// The structure for keeping storage queue name and URI. + public partial class AzureFunctionBinding { /// /// Keeps track of any properties unknown to the library. @@ -47,23 +43,38 @@ public abstract partial class AzureFunctionBinding /// /// /// - private protected IDictionary _serializedAdditionalRawData; + private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - protected AzureFunctionBinding() + /// Storage queue. + /// is null. + public AzureFunctionBinding(AzureFunctionStorageQueue storageQueue) { + Argument.AssertNotNull(storageQueue, nameof(storageQueue)); + + StorageQueue = storageQueue; } /// Initializes a new instance of . - /// The type of binding. + /// The type of binding, which is always 'storage_queue'. + /// Storage queue. /// Keeps track of any properties unknown to the library. - internal AzureFunctionBinding(string type, IDictionary serializedAdditionalRawData) + internal AzureFunctionBinding(AzureFunctionBindingType type, AzureFunctionStorageQueue storageQueue, IDictionary serializedAdditionalRawData) { Type = type; + StorageQueue = storageQueue; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The type of binding. - internal string Type { get; set; } + /// Initializes a new instance of for deserialization. + internal AzureFunctionBinding() + { + } + + /// The type of binding, which is always 'storage_queue'. + public AzureFunctionBindingType Type { get; } = AzureFunctionBindingType.StorageQueue; + + /// Storage queue. + public AzureFunctionStorageQueue StorageQueue { get; set; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs index 745777a4bb18a..a802adc193960 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs @@ -35,7 +35,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("queue_service_uri"u8); - writer.WriteStringValue(StorageQueueUri); + writer.WriteStringValue(StorageServiceUri); writer.WritePropertyName("queue_name"u8); writer.WriteStringValue(QueueName); if (options.Format != "W" && _serializedAdditionalRawData != null) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs index 1f0ff63ee21fc..2e3e293c3cc6a 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs @@ -46,25 +46,25 @@ public partial class AzureFunctionStorageQueue private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// URI to the Azure Storage Queue service allowing you to manipulate a queue. + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. /// The name of an Azure function storage queue. - /// or is null. - public AzureFunctionStorageQueue(string storageQueueUri, string queueName) + /// or is null. + public AzureFunctionStorageQueue(string storageServiceUri, string queueName) { - Argument.AssertNotNull(storageQueueUri, nameof(storageQueueUri)); + Argument.AssertNotNull(storageServiceUri, nameof(storageServiceUri)); Argument.AssertNotNull(queueName, nameof(queueName)); - StorageQueueUri = storageQueueUri; + StorageServiceUri = storageServiceUri; QueueName = queueName; } /// Initializes a new instance of . - /// URI to the Azure Storage Queue service allowing you to manipulate a queue. + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. /// The name of an Azure function storage queue. /// Keeps track of any properties unknown to the library. - internal AzureFunctionStorageQueue(string storageQueueUri, string queueName, IDictionary serializedAdditionalRawData) + internal AzureFunctionStorageQueue(string storageServiceUri, string queueName, IDictionary serializedAdditionalRawData) { - StorageQueueUri = storageQueueUri; + StorageServiceUri = storageServiceUri; QueueName = queueName; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -75,7 +75,7 @@ internal AzureFunctionStorageQueue() } /// URI to the Azure Storage Queue service allowing you to manipulate a queue. - public string StorageQueueUri { get; set; } + public string StorageServiceUri { get; set; } /// The name of an Azure function storage queue. public string QueueName { get; set; } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs deleted file mode 100644 index e8f8f9edba5e3..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Projects -{ - public partial class AzureStorageQueueBinding : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureStorageQueueBinding)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("storage_queue"u8); - writer.WriteObjectValue(StorageQueue, options); - } - - AzureStorageQueueBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureStorageQueueBinding)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAzureStorageQueueBinding(document.RootElement, options); - } - - internal static AzureStorageQueueBinding DeserializeAzureStorageQueueBinding(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AzureFunctionStorageQueue storageQueue = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("storage_queue"u8)) - { - storageQueue = AzureFunctionStorageQueue.DeserializeAzureFunctionStorageQueue(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AzureStorageQueueBinding(type, serializedAdditionalRawData, storageQueue); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - 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(AzureStorageQueueBinding)} does not support writing '{options.Format}' format."); - } - } - - AzureStorageQueueBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeAzureStorageQueueBinding(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AzureStorageQueueBinding)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new AzureStorageQueueBinding FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAzureStorageQueueBinding(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs deleted file mode 100644 index 7f3593f0fa407..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureStorageQueueBinding.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// The definition of input or output queue for Azure function. - public partial class AzureStorageQueueBinding : AzureFunctionBinding - { - /// Initializes a new instance of . - /// Storage queue. - /// is null. - public AzureStorageQueueBinding(AzureFunctionStorageQueue storageQueue) - { - Argument.AssertNotNull(storageQueue, nameof(storageQueue)); - - Type = "storage_queue"; - StorageQueue = storageQueue; - } - - /// Initializes a new instance of . - /// The type of binding. - /// Keeps track of any properties unknown to the library. - /// Storage queue. - internal AzureStorageQueueBinding(string type, IDictionary serializedAdditionalRawData, AzureFunctionStorageQueue storageQueue) : base(type, serializedAdditionalRawData) - { - StorageQueue = storageQueue; - } - - /// Initializes a new instance of for deserialization. - internal AzureStorageQueueBinding() - { - } - - /// Storage queue. - public AzureFunctionStorageQueue StorageQueue { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.Serialization.cs index d5c3f8a769923..1a3d51797196d 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.Serialization.cs @@ -78,8 +78,8 @@ internal static InternalAzureFunctionDefinition DeserializeInternalAzureFunction return null; } InternalFunctionDefinition function = default; - AzureStorageQueueBinding inputBinding = default; - AzureStorageQueueBinding outputBinding = default; + AzureFunctionBinding inputBinding = default; + AzureFunctionBinding outputBinding = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,12 +91,12 @@ internal static InternalAzureFunctionDefinition DeserializeInternalAzureFunction } if (property.NameEquals("input_binding"u8)) { - inputBinding = AzureStorageQueueBinding.DeserializeAzureStorageQueueBinding(property.Value, options); + inputBinding = AzureFunctionBinding.DeserializeAzureFunctionBinding(property.Value, options); continue; } if (property.NameEquals("output_binding"u8)) { - outputBinding = AzureStorageQueueBinding.DeserializeAzureStorageQueueBinding(property.Value, options); + outputBinding = AzureFunctionBinding.DeserializeAzureFunctionBinding(property.Value, options); continue; } if (options.Format != "W") diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs index 0e34d24f7d855..f566ee9d15b99 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/InternalAzureFunctionDefinition.cs @@ -50,7 +50,7 @@ internal partial class InternalAzureFunctionDefinition /// Input storage queue. The queue storage trigger runs a function as messages are added to it. /// Output storage queue. The function writes output to this queue when the input items are processed. /// , or is null. - public InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding) + public InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureFunctionBinding inputBinding, AzureFunctionBinding outputBinding) { Argument.AssertNotNull(function, nameof(function)); Argument.AssertNotNull(inputBinding, nameof(inputBinding)); @@ -66,7 +66,7 @@ public InternalAzureFunctionDefinition(InternalFunctionDefinition function, Azur /// Input storage queue. The queue storage trigger runs a function as messages are added to it. /// Output storage queue. The function writes output to this queue when the input items are processed. /// Keeps track of any properties unknown to the library. - internal InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureStorageQueueBinding inputBinding, AzureStorageQueueBinding outputBinding, IDictionary serializedAdditionalRawData) + internal InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureFunctionBinding inputBinding, AzureFunctionBinding outputBinding, IDictionary serializedAdditionalRawData) { Function = function; InputBinding = inputBinding; @@ -82,8 +82,8 @@ internal InternalAzureFunctionDefinition() /// The definition of azure function and its parameters. public InternalFunctionDefinition Function { get; set; } /// Input storage queue. The queue storage trigger runs a function as messages are added to it. - public AzureStorageQueueBinding InputBinding { get; set; } + public AzureFunctionBinding InputBinding { get; set; } /// Output storage queue. The function writes output to this queue when the input items are processed. - public AzureStorageQueueBinding OutputBinding { get; set; } + public AzureFunctionBinding OutputBinding { get; set; } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs deleted file mode 100644 index 23ba0a6949ba2..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Projects -{ - internal partial class UnknownAzureFunctionBinding : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AzureFunctionBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAzureFunctionBinding(document.RootElement, options); - } - - internal static UnknownAzureFunctionBinding DeserializeUnknownAzureFunctionBinding(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownAzureFunctionBinding(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - 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(AzureFunctionBinding)} does not support writing '{options.Format}' format."); - } - } - - AzureFunctionBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeAzureFunctionBinding(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownAzureFunctionBinding FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownAzureFunctionBinding(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs deleted file mode 100644 index 2abeeba1afb0e..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownAzureFunctionBinding.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Unknown version of AzureFunctionBinding. - internal partial class UnknownAzureFunctionBinding : AzureFunctionBinding - { - /// Initializes a new instance of . - /// The type of binding. - /// Keeps track of any properties unknown to the library. - internal UnknownAzureFunctionBinding(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownAzureFunctionBinding() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs index ec7ed7eea75d5..e0d76c303a2a5 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -27,16 +27,16 @@ public async Task AzureFunctionCallingExample() AzureFunctionToolDefinition azureFnTool = new( name: "foo", description: "Get answers from the foo bot.", - inputBinding: new AzureStorageQueueBinding( + inputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-foo-input", - storageQueueUri: storageQueueUri + storageServiceUri: storageQueueUri ) ), - outputBinding: new AzureStorageQueueBinding( + outputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-tool-output", - storageQueueUri: storageQueueUri + storageServiceUri: storageQueueUri ) ), parameters: BinaryData.FromObjectAsJson( diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index 73da152e5b8b1..aec866939a891 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: dfb43c836f55ffcbe2bb7ade6508a974e2750b11 +commit: 6903c20f838a37b1d6ac5411fe17eba5398a42ff repo: Azure/azure-rest-api-specs additionalDirectories: From 141ee77e016999b014d9c63b902b2e1d5a87ebe8 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:04:45 -0800 Subject: [PATCH 09/18] Rename parameter and regenerate the code --- .../Azure.AI.Projects/src/Generated/Agent.cs | 6 ++--- ...AzureFunctionStorageQueue.Serialization.cs | 12 +++++----- .../Generated/AzureFunctionStorageQueue.cs | 18 +++++++------- .../src/Generated/CreateAgentRequest.cs | 4 ++-- .../src/Generated/CreateRunRequest.cs | 4 ++-- .../Generated/CreateThreadAndRunRequest.cs | 4 ++-- .../MessageAttachment.Serialization.cs | 24 ++++++------------- .../src/Generated/MessageAttachment.cs | 9 ++++--- .../src/Generated/ThreadRun.cs | 6 ++--- .../Generated/ToolDefinition.Serialization.cs | 1 + .../src/Generated/ToolDefinition.cs | 2 +- .../src/Generated/UpdateAgentRequest.cs | 4 ++-- .../Agent/Sample_Agent_Azure_Functions.cs | 4 ++-- sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 14 files changed, 45 insertions(+), 55 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs index ea5ad0df0decc..4df181b747e4e 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/Agent.cs @@ -56,7 +56,7 @@ public partial class Agent /// /// The collection of tools enabled for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -104,7 +104,7 @@ internal Agent(string id, DateTimeOffset createdAt, string name, string descript /// /// The collection of tools enabled for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -162,7 +162,7 @@ internal Agent() /// /// The collection of tools enabled for the agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs index a802adc193960..1965136e4c3de 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.Serialization.cs @@ -34,8 +34,8 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{format}' format."); } - writer.WritePropertyName("queue_service_uri"u8); - writer.WriteStringValue(StorageServiceUri); + writer.WritePropertyName("queue_service_endpoint"u8); + writer.WriteStringValue(StorageServiceEndpoint); writer.WritePropertyName("queue_name"u8); writer.WriteStringValue(QueueName); if (options.Format != "W" && _serializedAdditionalRawData != null) @@ -75,15 +75,15 @@ internal static AzureFunctionStorageQueue DeserializeAzureFunctionStorageQueue(J { return null; } - string queueServiceUri = default; + string queueServiceEndpoint = default; string queueName = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("queue_service_uri"u8)) + if (property.NameEquals("queue_service_endpoint"u8)) { - queueServiceUri = property.Value.GetString(); + queueServiceEndpoint = property.Value.GetString(); continue; } if (property.NameEquals("queue_name"u8)) @@ -97,7 +97,7 @@ internal static AzureFunctionStorageQueue DeserializeAzureFunctionStorageQueue(J } } serializedAdditionalRawData = rawDataDictionary; - return new AzureFunctionStorageQueue(queueServiceUri, queueName, serializedAdditionalRawData); + return new AzureFunctionStorageQueue(queueServiceEndpoint, queueName, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs index 2e3e293c3cc6a..1782ede5ac86a 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionStorageQueue.cs @@ -46,25 +46,25 @@ public partial class AzureFunctionStorageQueue private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// URI to the Azure Storage Queue service allowing you to manipulate a queue. + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. /// The name of an Azure function storage queue. - /// or is null. - public AzureFunctionStorageQueue(string storageServiceUri, string queueName) + /// or is null. + public AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName) { - Argument.AssertNotNull(storageServiceUri, nameof(storageServiceUri)); + Argument.AssertNotNull(storageServiceEndpoint, nameof(storageServiceEndpoint)); Argument.AssertNotNull(queueName, nameof(queueName)); - StorageServiceUri = storageServiceUri; + StorageServiceEndpoint = storageServiceEndpoint; QueueName = queueName; } /// Initializes a new instance of . - /// URI to the Azure Storage Queue service allowing you to manipulate a queue. + /// URI to the Azure Storage Queue service allowing you to manipulate a queue. /// The name of an Azure function storage queue. /// Keeps track of any properties unknown to the library. - internal AzureFunctionStorageQueue(string storageServiceUri, string queueName, IDictionary serializedAdditionalRawData) + internal AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName, IDictionary serializedAdditionalRawData) { - StorageServiceUri = storageServiceUri; + StorageServiceEndpoint = storageServiceEndpoint; QueueName = queueName; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -75,7 +75,7 @@ internal AzureFunctionStorageQueue() } /// URI to the Azure Storage Queue service allowing you to manipulate a queue. - public string StorageServiceUri { get; set; } + public string StorageServiceEndpoint { get; set; } /// The name of an Azure function storage queue. public string QueueName { get; set; } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs index 1f51e5beb380b..4a88cff111589 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateAgentRequest.cs @@ -65,7 +65,7 @@ internal CreateAgentRequest(string model) /// /// The collection of tools to enable for the new agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` @@ -115,7 +115,7 @@ internal CreateAgentRequest() /// /// The collection of tools to enable for the new agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs index efcfee1c47378..ad16d5992e529 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateRunRequest.cs @@ -70,7 +70,7 @@ internal CreateRunRequest(string assistantId) /// /// The overridden list of enabled tools that the agent should use to run the thread. /// 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 . /// /// /// If `true`, returns a stream of events that happen during the Run as server-sent events, @@ -145,7 +145,7 @@ internal CreateRunRequest() /// /// The overridden list of enabled tools that the agent should use to run the thread. /// 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 IReadOnlyList OverrideTools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs index abcf1cf5a0991..8a7ef06db71a3 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/CreateThreadAndRunRequest.cs @@ -65,7 +65,7 @@ internal CreateThreadAndRunRequest(string assistantId) /// /// The overridden list of enabled tools the agent should use to run the thread. /// 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 . /// /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. /// @@ -136,7 +136,7 @@ internal CreateThreadAndRunRequest() /// /// The overridden list of enabled tools the agent should use to run the thread. /// 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 IReadOnlyList OverrideTools { get; } /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.Serialization.cs index 124ba52d97e18..9a3751e9f5ead 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.Serialization.cs @@ -39,15 +39,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("file_id"u8); writer.WriteStringValue(FileId); } - if (Optional.IsCollectionDefined(DataSources)) + if (Optional.IsDefined(DataSource)) { - writer.WritePropertyName("data_sources"u8); - writer.WriteStartArray(); - foreach (var item in DataSources) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("data_source"u8); + writer.WriteObjectValue(DataSource, options); } writer.WritePropertyName("tools"u8); writer.WriteStartArray(); @@ -106,7 +101,7 @@ internal static MessageAttachment DeserializeMessageAttachment(JsonElement eleme return null; } string fileId = default; - IList dataSources = default; + VectorStoreDataSource dataSource = default; IList tools = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -117,18 +112,13 @@ internal static MessageAttachment DeserializeMessageAttachment(JsonElement eleme fileId = property.Value.GetString(); continue; } - if (property.NameEquals("data_sources"u8)) + if (property.NameEquals("data_source"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(VectorStoreDataSource.DeserializeVectorStoreDataSource(item, options)); - } - dataSources = array; + dataSource = VectorStoreDataSource.DeserializeVectorStoreDataSource(property.Value, options); continue; } if (property.NameEquals("tools"u8)) @@ -154,7 +144,7 @@ internal static MessageAttachment DeserializeMessageAttachment(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new MessageAttachment(fileId, dataSources ?? new ChangeTrackingList(), tools, serializedAdditionalRawData); + return new MessageAttachment(fileId, dataSource, tools, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.cs index 0aab327fa3db5..be25230a7c4ca 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/MessageAttachment.cs @@ -53,19 +53,18 @@ public MessageAttachment(IEnumerable tools) { Argument.AssertNotNull(tools, nameof(tools)); - DataSources = new ChangeTrackingList(); Tools = tools.ToList(); } /// Initializes a new instance of . /// The ID of the file to attach to the message. - /// Azure asset ID. + /// Azure asset ID. /// The tools to add to this file. /// Keeps track of any properties unknown to the library. - internal MessageAttachment(string fileId, IList dataSources, IList tools, IDictionary serializedAdditionalRawData) + internal MessageAttachment(string fileId, VectorStoreDataSource dataSource, IList tools, IDictionary serializedAdditionalRawData) { FileId = fileId; - DataSources = dataSources; + DataSource = dataSource; Tools = tools; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -78,7 +77,7 @@ internal MessageAttachment() /// The ID of the file to attach to the message. public string FileId { get; set; } /// Azure asset ID. - public IList DataSources { get; } + public VectorStoreDataSource DataSource { get; set; } /// /// The tools to add to this file. /// diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs index 9dccf0b2e901c..a15465abf330d 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadRun.cs @@ -57,7 +57,7 @@ public partial class ThreadRun /// /// The overridden enabled tools used for this agent thread run. /// 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 . /// /// The Unix timestamp, in seconds, representing when this object was created. /// The Unix timestamp, in seconds, representing when this item expires. @@ -126,7 +126,7 @@ internal ThreadRun(string id, string threadId, string assistantId, RunStatus sta /// /// The overridden enabled tools used for this agent thread run. /// 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 . /// /// The Unix timestamp, in seconds, representing when this object was created. /// The Unix timestamp, in seconds, representing when this item expires. @@ -209,7 +209,7 @@ internal ThreadRun() /// /// The overridden enabled tools used for this agent thread run. /// 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 IReadOnlyList Tools { get; } /// The Unix timestamp, in seconds, representing when this object was created. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs index 4d414a891908c..24642ea0f9fcd 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.Serialization.cs @@ -84,6 +84,7 @@ internal static ToolDefinition DeserializeToolDefinition(JsonElement element, Mo case "fabric_aiskill": return MicrosoftFabricToolDefinition.DeserializeMicrosoftFabricToolDefinition(element, options); case "file_search": return FileSearchToolDefinition.DeserializeFileSearchToolDefinition(element, options); case "function": return FunctionToolDefinition.DeserializeFunctionToolDefinition(element, options); + case "openapi": return OpenApiToolDefinition.DeserializeOpenApiToolDefinition(element, options); case "sharepoint_grounding": return SharepointToolDefinition.DeserializeSharepointToolDefinition(element, options); } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs index d6ebe82f65fff..212407f403df3 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ToolDefinition.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Projects /// /// An abstract representation of an input tool definition that an agent can use. /// 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 abstract partial class ToolDefinition { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs index 20d36641d6a5a..b83961c08f5ab 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UpdateAgentRequest.cs @@ -60,7 +60,7 @@ internal UpdateAgentRequest() /// /// The modified collection of tools to enable for the agent. /// 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 . /// /// /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, @@ -105,7 +105,7 @@ internal UpdateAgentRequest(string model, string name, string description, strin /// /// The modified collection of tools to enable for the agent. /// 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 IReadOnlyList Tools { get; } /// diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs index e0d76c303a2a5..ab60750e58ddf 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -30,13 +30,13 @@ public async Task AzureFunctionCallingExample() inputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-foo-input", - storageServiceUri: storageQueueUri + storageServiceEndpoint: storageQueueUri ) ), outputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-tool-output", - storageServiceUri: storageQueueUri + storageServiceEndpoint: storageQueueUri ) ), parameters: BinaryData.FromObjectAsJson( diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index aec866939a891..f9e0b27b0cb78 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: 6903c20f838a37b1d6ac5411fe17eba5398a42ff +commit: fcbbb8c60c603011ec0b2c05aa11034be4a9b17e repo: Azure/azure-rest-api-specs additionalDirectories: From 5a2010fa378c165c6548fde42c180d1e2ec6ab84 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:13:40 -0800 Subject: [PATCH 10/18] Add newly generated files --- sdk/ai/Azure.AI.Projects/README.md | 4 +- .../api/Azure.AI.Projects.net8.0.cs | 95 +++++++++- .../api/Azure.AI.Projects.netstandard2.0.cs | 95 +++++++++- .../src/Generated/AzureFunctionBindingType.cs | 48 +++++ ...enApiAnonymousAuthDetails.Serialization.cs | 126 +++++++++++++ .../Generated/OpenApiAnonymousAuthDetails.cs | 29 +++ .../OpenApiAuthDetails.Serialization.cs | 135 ++++++++++++++ .../src/Generated/OpenApiAuthDetails.cs | 69 +++++++ .../src/Generated/OpenApiAuthType.cs | 54 ++++++ ...nApiConnectionAuthDetails.Serialization.cs | 134 +++++++++++++ .../Generated/OpenApiConnectionAuthDetails.cs | 44 +++++ ...iConnectionSecurityScheme.Serialization.cs | 142 ++++++++++++++ .../OpenApiConnectionSecurityScheme.cs | 75 ++++++++ ...OpenApiFunctionDefinition.Serialization.cs | 176 ++++++++++++++++++ .../Generated/OpenApiFunctionDefinition.cs | 134 +++++++++++++ ...OpenApiManagedAuthDetails.Serialization.cs | 134 +++++++++++++ .../Generated/OpenApiManagedAuthDetails.cs | 44 +++++ ...nApiManagedSecurityScheme.Serialization.cs | 142 ++++++++++++++ .../Generated/OpenApiManagedSecurityScheme.cs | 75 ++++++++ .../OpenApiToolDefinition.Serialization.cs | 134 +++++++++++++ .../src/Generated/OpenApiToolDefinition.cs | 44 +++++ ...UnknownOpenApiAuthDetails.Serialization.cs | 126 +++++++++++++ .../Generated/UnknownOpenApiAuthDetails.cs | 28 +++ 23 files changed, 2079 insertions(+), 8 deletions(-) create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBindingType.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAnonymousAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs create mode 100644 sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.cs diff --git a/sdk/ai/Azure.AI.Projects/README.md b/sdk/ai/Azure.AI.Projects/README.md index 7a9c6e9023002..aea4472bcea69 100644 --- a/sdk/ai/Azure.AI.Projects/README.md +++ b/sdk/ai/Azure.AI.Projects/README.md @@ -357,13 +357,13 @@ AzureFunctionToolDefinition azureFnTool = new( inputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-foo-input", - storageServiceUri: storageQueueUri + storageServiceEndpoint: storageQueueUri ) ), outputBinding: new AzureFunctionBinding( new AzureFunctionStorageQueue( queueName: "azure-function-tool-output", - storageServiceUri: storageQueueUri + storageServiceEndpoint: storageQueueUri ) ), parameters: BinaryData.FromObjectAsJson( 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 10d2334675fd2..6af1de27cfe50 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 @@ -643,9 +643,9 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class AzureFunctionStorageQueue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AzureFunctionStorageQueue(string storageServiceUri, string queueName) { } + public AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName) { } public string QueueName { get { throw null; } set { } } - public string StorageServiceUri { get { throw null; } set { } } + public string StorageServiceEndpoint { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureFunctionStorageQueue 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) { } @@ -1152,7 +1152,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MessageAttachment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MessageAttachment(System.Collections.Generic.IEnumerable tools) { } - public System.Collections.Generic.IList DataSources { get { throw null; } } + public Azure.AI.Projects.VectorStoreDataSource DataSource { get { throw null; } set { } } public string FileId { get { throw null; } set { } } public System.Collections.Generic.IList Tools { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1509,6 +1509,95 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 OpenApiAnonymousAuthDetails : Azure.AI.Projects.OpenApiAuthDetails, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiAnonymousAuthDetails() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiAnonymousAuthDetails 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.OpenApiAnonymousAuthDetails 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 OpenApiAuthDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected OpenApiAuthDetails() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiAuthDetails 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.OpenApiAuthDetails 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 OpenApiConnectionAuthDetails : Azure.AI.Projects.OpenApiAuthDetails, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiConnectionAuthDetails(Azure.AI.Projects.OpenApiConnectionSecurityScheme securityScheme) { } + public Azure.AI.Projects.OpenApiConnectionSecurityScheme SecurityScheme { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiConnectionAuthDetails 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.OpenApiConnectionAuthDetails 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 OpenApiConnectionSecurityScheme : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiConnectionSecurityScheme(string connectionId) { } + public string ConnectionId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiConnectionSecurityScheme 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.OpenApiConnectionSecurityScheme 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 OpenApiFunctionDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiFunctionDefinition(string name, System.BinaryData spec, Azure.AI.Projects.OpenApiAuthDetails auth) { } + public Azure.AI.Projects.OpenApiAuthDetails Auth { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public System.BinaryData Spec { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiFunctionDefinition 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.OpenApiFunctionDefinition 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 OpenApiManagedAuthDetails : Azure.AI.Projects.OpenApiAuthDetails, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiManagedAuthDetails(Azure.AI.Projects.OpenApiManagedSecurityScheme securityScheme) { } + public Azure.AI.Projects.OpenApiManagedSecurityScheme SecurityScheme { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiManagedAuthDetails 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.OpenApiManagedAuthDetails 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 OpenApiManagedSecurityScheme : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiManagedSecurityScheme(string audience) { } + public string Audience { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiManagedSecurityScheme 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.OpenApiManagedSecurityScheme 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 OpenApiToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiToolDefinition(Azure.AI.Projects.OpenApiFunctionDefinition openapi) { } + public Azure.AI.Projects.OpenApiFunctionDefinition Openapi { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiToolDefinition 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.OpenApiToolDefinition 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 PageableList : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { internal PageableList() { } 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 10d2334675fd2..6af1de27cfe50 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 @@ -643,9 +643,9 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class AzureFunctionStorageQueue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AzureFunctionStorageQueue(string storageServiceUri, string queueName) { } + public AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName) { } public string QueueName { get { throw null; } set { } } - public string StorageServiceUri { get { throw null; } set { } } + public string StorageServiceEndpoint { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.AzureFunctionStorageQueue 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) { } @@ -1152,7 +1152,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MessageAttachment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MessageAttachment(System.Collections.Generic.IEnumerable tools) { } - public System.Collections.Generic.IList DataSources { get { throw null; } } + public Azure.AI.Projects.VectorStoreDataSource DataSource { get { throw null; } set { } } public string FileId { get { throw null; } set { } } public System.Collections.Generic.IList Tools { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1509,6 +1509,95 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 OpenApiAnonymousAuthDetails : Azure.AI.Projects.OpenApiAuthDetails, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiAnonymousAuthDetails() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiAnonymousAuthDetails 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.OpenApiAnonymousAuthDetails 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 OpenApiAuthDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected OpenApiAuthDetails() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiAuthDetails 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.OpenApiAuthDetails 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 OpenApiConnectionAuthDetails : Azure.AI.Projects.OpenApiAuthDetails, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiConnectionAuthDetails(Azure.AI.Projects.OpenApiConnectionSecurityScheme securityScheme) { } + public Azure.AI.Projects.OpenApiConnectionSecurityScheme SecurityScheme { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiConnectionAuthDetails 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.OpenApiConnectionAuthDetails 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 OpenApiConnectionSecurityScheme : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiConnectionSecurityScheme(string connectionId) { } + public string ConnectionId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiConnectionSecurityScheme 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.OpenApiConnectionSecurityScheme 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 OpenApiFunctionDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiFunctionDefinition(string name, System.BinaryData spec, Azure.AI.Projects.OpenApiAuthDetails auth) { } + public Azure.AI.Projects.OpenApiAuthDetails Auth { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public System.BinaryData Spec { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiFunctionDefinition 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.OpenApiFunctionDefinition 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 OpenApiManagedAuthDetails : Azure.AI.Projects.OpenApiAuthDetails, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiManagedAuthDetails(Azure.AI.Projects.OpenApiManagedSecurityScheme securityScheme) { } + public Azure.AI.Projects.OpenApiManagedSecurityScheme SecurityScheme { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiManagedAuthDetails 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.OpenApiManagedAuthDetails 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 OpenApiManagedSecurityScheme : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiManagedSecurityScheme(string audience) { } + public string Audience { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiManagedSecurityScheme 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.OpenApiManagedSecurityScheme 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 OpenApiToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OpenApiToolDefinition(Azure.AI.Projects.OpenApiFunctionDefinition openapi) { } + public Azure.AI.Projects.OpenApiFunctionDefinition Openapi { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.OpenApiToolDefinition 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.OpenApiToolDefinition 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 PageableList : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { internal PageableList() { } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBindingType.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBindingType.cs new file mode 100644 index 0000000000000..d3ef7652d7824 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AzureFunctionBindingType.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.AI.Projects +{ + /// The AzureFunctionBinding_type. + public readonly partial struct AzureFunctionBindingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureFunctionBindingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StorageQueueValue = "storage_queue"; + + /// storage_queue. + public static AzureFunctionBindingType StorageQueue { get; } = new AzureFunctionBindingType(StorageQueueValue); + /// Determines if two values are the same. + public static bool operator ==(AzureFunctionBindingType left, AzureFunctionBindingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureFunctionBindingType left, AzureFunctionBindingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AzureFunctionBindingType(string value) => new AzureFunctionBindingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureFunctionBindingType other && Equals(other); + /// + public bool Equals(AzureFunctionBindingType 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/OpenApiAnonymousAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs new file mode 100644 index 0000000000000..e2b9cdf548476 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiAnonymousAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + OpenApiAnonymousAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiAnonymousAuthDetails(document.RootElement, options); + } + + internal static OpenApiAnonymousAuthDetails DeserializeOpenApiAnonymousAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiAuthType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiAnonymousAuthDetails(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiAnonymousAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiAnonymousAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiAnonymousAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiAnonymousAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiAnonymousAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAnonymousAuthDetails.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAnonymousAuthDetails.cs new file mode 100644 index 0000000000000..5a86750c6c95b --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAnonymousAuthDetails.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Security details for OpenApi anonymous authentication. + public partial class OpenApiAnonymousAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + public OpenApiAnonymousAuthDetails() + { + Type = OpenApiAuthType.Anonymous; + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + internal OpenApiAnonymousAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.Serialization.cs new file mode 100644 index 0000000000000..8d9043b1b4bad --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + [PersistableModelProxy(typeof(UnknownOpenApiAuthDetails))] + public partial class OpenApiAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// 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; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + + internal static OpenApiAuthDetails DeserializeOpenApiAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "anonymous": return OpenApiAnonymousAuthDetails.DeserializeOpenApiAnonymousAuthDetails(element, options); + case "connection": return OpenApiConnectionAuthDetails.DeserializeOpenApiConnectionAuthDetails(element, options); + case "managed_identity": return OpenApiManagedAuthDetails.DeserializeOpenApiManagedAuthDetails(element, options); + } + } + return UnknownOpenApiAuthDetails.DeserializeUnknownOpenApiAuthDetails(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiAuthDetails(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.cs new file mode 100644 index 0000000000000..596d594a2488e --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthDetails.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// + /// authentication details for OpenApiFunctionDefinition + /// 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 abstract partial class OpenApiAuthDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected OpenApiAuthDetails() + { + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + internal OpenApiAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of authentication, must be anonymous/connection/managed_identity. + internal OpenApiAuthType Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs new file mode 100644 index 0000000000000..552622c70847d --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Projects +{ + /// Type of chunking strategy. + internal readonly partial struct OpenApiAuthType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenApiAuthType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AnonymousValue = "anonymous"; + private const string ConnectionValue = "connection"; + private const string ManagedIdentityValue = "managed_identity"; + + /// anonymous. + public static OpenApiAuthType Anonymous { get; } = new OpenApiAuthType(AnonymousValue); + /// connection. + public static OpenApiAuthType Connection { get; } = new OpenApiAuthType(ConnectionValue); + /// managed_identity. + public static OpenApiAuthType ManagedIdentity { get; } = new OpenApiAuthType(ManagedIdentityValue); + /// Determines if two values are the same. + public static bool operator ==(OpenApiAuthType left, OpenApiAuthType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenApiAuthType left, OpenApiAuthType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OpenApiAuthType(string value) => new OpenApiAuthType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenApiAuthType other && Equals(other); + /// + public bool Equals(OpenApiAuthType 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/OpenApiConnectionAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs new file mode 100644 index 0000000000000..3594791bd4279 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiConnectionAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("security_scheme"u8); + writer.WriteObjectValue(SecurityScheme, options); + } + + OpenApiConnectionAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiConnectionAuthDetails(document.RootElement, options); + } + + internal static OpenApiConnectionAuthDetails DeserializeOpenApiConnectionAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiConnectionSecurityScheme securityScheme = default; + OpenApiAuthType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("security_scheme"u8)) + { + securityScheme = OpenApiConnectionSecurityScheme.DeserializeOpenApiConnectionSecurityScheme(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiConnectionAuthDetails(type, serializedAdditionalRawData, securityScheme); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiConnectionAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiConnectionAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiConnectionAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiConnectionAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiConnectionAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionAuthDetails.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionAuthDetails.cs new file mode 100644 index 0000000000000..8c2771c0f3b92 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionAuthDetails.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Security details for OpenApi connection authentication. + public partial class OpenApiConnectionAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + /// Connection auth security details. + /// is null. + public OpenApiConnectionAuthDetails(OpenApiConnectionSecurityScheme securityScheme) + { + Argument.AssertNotNull(securityScheme, nameof(securityScheme)); + + Type = OpenApiAuthType.Connection; + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + /// Connection auth security details. + internal OpenApiConnectionAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData, OpenApiConnectionSecurityScheme securityScheme) : base(type, serializedAdditionalRawData) + { + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiConnectionAuthDetails() + { + } + + /// Connection auth security details. + public OpenApiConnectionSecurityScheme SecurityScheme { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs new file mode 100644 index 0000000000000..3587020a88677 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiConnectionSecurityScheme : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// 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; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("connection_id"u8); + writer.WriteStringValue(ConnectionId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiConnectionSecurityScheme IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiConnectionSecurityScheme(document.RootElement, options); + } + + internal static OpenApiConnectionSecurityScheme DeserializeOpenApiConnectionSecurityScheme(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string connectionId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connection_id"u8)) + { + connectionId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiConnectionSecurityScheme(connectionId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiConnectionSecurityScheme)} does not support writing '{options.Format}' format."); + } + } + + OpenApiConnectionSecurityScheme IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiConnectionSecurityScheme(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiConnectionSecurityScheme FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiConnectionSecurityScheme(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.cs new file mode 100644 index 0000000000000..d74d1bae8a27a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiConnectionSecurityScheme.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Security scheme for OpenApi managed_identity authentication. + public partial class OpenApiConnectionSecurityScheme + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Connection id for Connection auth type. + /// is null. + public OpenApiConnectionSecurityScheme(string connectionId) + { + Argument.AssertNotNull(connectionId, nameof(connectionId)); + + ConnectionId = connectionId; + } + + /// Initializes a new instance of . + /// Connection id for Connection auth type. + /// Keeps track of any properties unknown to the library. + internal OpenApiConnectionSecurityScheme(string connectionId, IDictionary serializedAdditionalRawData) + { + ConnectionId = connectionId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiConnectionSecurityScheme() + { + } + + /// Connection id for Connection auth type. + public string ConnectionId { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.Serialization.cs new file mode 100644 index 0000000000000..52bd220dc908d --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiFunctionDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// 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; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("spec"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Spec); +#else + using (JsonDocument document = JsonDocument.Parse(Spec)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + writer.WritePropertyName("auth"u8); + writer.WriteObjectValue(Auth, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiFunctionDefinition(document.RootElement, options); + } + + internal static OpenApiFunctionDefinition DeserializeOpenApiFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string description = default; + BinaryData spec = default; + OpenApiAuthDetails auth = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("spec"u8)) + { + spec = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("auth"u8)) + { + auth = OpenApiAuthDetails.DeserializeOpenApiAuthDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiFunctionDefinition(name, description, spec, auth, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiFunctionDefinition)} does not support writing '{options.Format}' format."); + } + } + + OpenApiFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiFunctionDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiFunctionDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiFunctionDefinition(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.cs new file mode 100644 index 0000000000000..8980b1cfe70e7 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiFunctionDefinition.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// The input definition information for an openapi function. + public partial class OpenApiFunctionDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the function to be called. + /// The openapi function shape, described as a JSON Schema object. + /// + /// Open API authentication details + /// 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 . + /// + /// , or is null. + public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetails auth) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(spec, nameof(spec)); + Argument.AssertNotNull(auth, nameof(auth)); + + Name = name; + Spec = spec; + Auth = auth; + } + + /// Initializes a new instance of . + /// The name of the function to be called. + /// A description of what the function does, used by the model to choose when and how to call the function. + /// The openapi function shape, described as a JSON Schema object. + /// + /// Open API authentication details + /// 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 . + /// + /// Keeps track of any properties unknown to the library. + internal OpenApiFunctionDefinition(string name, string description, BinaryData spec, OpenApiAuthDetails auth, IDictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + Spec = spec; + Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiFunctionDefinition() + { + } + + /// The name of the function to be called. + public string Name { get; set; } + /// A description of what the function does, used by the model to choose when and how to call the function. + public string Description { get; set; } + /// + /// The openapi function shape, described as a JSON Schema object. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData Spec { get; set; } + /// + /// Open API authentication details + /// 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 OpenApiAuthDetails Auth { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.Serialization.cs new file mode 100644 index 0000000000000..6f05aaf2f05cf --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiManagedAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("security_scheme"u8); + writer.WriteObjectValue(SecurityScheme, options); + } + + OpenApiManagedAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiManagedAuthDetails(document.RootElement, options); + } + + internal static OpenApiManagedAuthDetails DeserializeOpenApiManagedAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiManagedSecurityScheme securityScheme = default; + OpenApiAuthType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("security_scheme"u8)) + { + securityScheme = OpenApiManagedSecurityScheme.DeserializeOpenApiManagedSecurityScheme(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiManagedAuthDetails(type, serializedAdditionalRawData, securityScheme); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiManagedAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiManagedAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiManagedAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiManagedAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiManagedAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.cs new file mode 100644 index 0000000000000..9a51a510225c1 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedAuthDetails.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Security details for OpenApi managed_identity authentication. + public partial class OpenApiManagedAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + /// Connection auth security details. + /// is null. + public OpenApiManagedAuthDetails(OpenApiManagedSecurityScheme securityScheme) + { + Argument.AssertNotNull(securityScheme, nameof(securityScheme)); + + Type = OpenApiAuthType.ManagedIdentity; + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + /// Connection auth security details. + internal OpenApiManagedAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData, OpenApiManagedSecurityScheme securityScheme) : base(type, serializedAdditionalRawData) + { + SecurityScheme = securityScheme; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiManagedAuthDetails() + { + } + + /// Connection auth security details. + public OpenApiManagedSecurityScheme SecurityScheme { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs new file mode 100644 index 0000000000000..61a1375c0007a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiManagedSecurityScheme : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// 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; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("audience"u8); + writer.WriteStringValue(Audience); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OpenApiManagedSecurityScheme IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiManagedSecurityScheme(document.RootElement, options); + } + + internal static OpenApiManagedSecurityScheme DeserializeOpenApiManagedSecurityScheme(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string audience = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("audience"u8)) + { + audience = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiManagedSecurityScheme(audience, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiManagedSecurityScheme)} does not support writing '{options.Format}' format."); + } + } + + OpenApiManagedSecurityScheme IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiManagedSecurityScheme(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OpenApiManagedSecurityScheme FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiManagedSecurityScheme(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.cs new file mode 100644 index 0000000000000..e1c3d9970098a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiManagedSecurityScheme.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Security scheme for OpenApi managed_identity authentication. + public partial class OpenApiManagedSecurityScheme + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Authentication scope for managed_identity auth type. + /// is null. + public OpenApiManagedSecurityScheme(string audience) + { + Argument.AssertNotNull(audience, nameof(audience)); + + Audience = audience; + } + + /// Initializes a new instance of . + /// Authentication scope for managed_identity auth type. + /// Keeps track of any properties unknown to the library. + internal OpenApiManagedSecurityScheme(string audience, IDictionary serializedAdditionalRawData) + { + Audience = audience; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiManagedSecurityScheme() + { + } + + /// Authentication scope for managed_identity auth type. + public string Audience { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.Serialization.cs new file mode 100644 index 0000000000000..bd31655d48ab7 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiToolDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("openapi"u8); + writer.WriteObjectValue(Openapi, options); + } + + OpenApiToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiToolDefinition(document.RootElement, options); + } + + internal static OpenApiToolDefinition DeserializeOpenApiToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiFunctionDefinition openapi = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("openapi"u8)) + { + openapi = OpenApiFunctionDefinition.DeserializeOpenApiFunctionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenApiToolDefinition(type, serializedAdditionalRawData, openapi); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiToolDefinition)} does not support writing '{options.Format}' format."); + } + } + + OpenApiToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiToolDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OpenApiToolDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOpenApiToolDefinition(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.cs new file mode 100644 index 0000000000000..f56708e3d6e5b --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiToolDefinition.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// The input definition information for an OpenAPI tool as used to configure an agent. + public partial class OpenApiToolDefinition : ToolDefinition + { + /// Initializes a new instance of . + /// The openapi function definition. + /// is null. + public OpenApiToolDefinition(OpenApiFunctionDefinition openapi) + { + Argument.AssertNotNull(openapi, nameof(openapi)); + + Type = "openapi"; + Openapi = openapi; + } + + /// Initializes a new instance of . + /// The object type. + /// Keeps track of any properties unknown to the library. + /// The openapi function definition. + internal OpenApiToolDefinition(string type, IDictionary serializedAdditionalRawData, OpenApiFunctionDefinition openapi) : base(type, serializedAdditionalRawData) + { + Openapi = openapi; + } + + /// Initializes a new instance of for deserialization. + internal OpenApiToolDefinition() + { + } + + /// The openapi function definition. + public OpenApiFunctionDefinition Openapi { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs new file mode 100644 index 0000000000000..34ec6852a21e3 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + internal partial class UnknownOpenApiAuthDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + OpenApiAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + + internal static UnknownOpenApiAuthDetails DeserializeUnknownOpenApiAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenApiAuthType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new OpenApiAuthType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownOpenApiAuthDetails(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + 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(OpenApiAuthDetails)} does not support writing '{options.Format}' format."); + } + } + + OpenApiAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenApiAuthDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownOpenApiAuthDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownOpenApiAuthDetails(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.cs new file mode 100644 index 0000000000000..4844d77a21858 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownOpenApiAuthDetails.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Unknown version of OpenApiAuthDetails. + internal partial class UnknownOpenApiAuthDetails : OpenApiAuthDetails + { + /// Initializes a new instance of . + /// The type of authentication, must be anonymous/connection/managed_identity. + /// Keeps track of any properties unknown to the library. + internal UnknownOpenApiAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownOpenApiAuthDetails() + { + } + } +} From 3727d8684dbdc8384093ba23c3b4155e98f74747 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:26:35 -0800 Subject: [PATCH 11/18] Regenerate the code --- sdk/ai/Azure.AI.Projects/src/Generated/AIProjectClient.cs | 8 ++++---- .../src/Generated/AIProjectsClientBuilderExtensions.cs | 4 ++-- .../src/Generated/AIProjectsModelFactory.cs | 2 +- sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs | 4 ++-- sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs | 4 ++-- .../Azure.AI.Projects/src/Generated/EvaluationsClient.cs | 4 ++-- sdk/ai/Azure.AI.Projects/src/Generated/TelemetryClient.cs | 4 ++-- sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectClient.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectClient.cs index fc1c7f45a00eb..267dd3c78398c 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectClient.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectClient.cs @@ -35,10 +35,10 @@ protected AIProjectClient() } /// Initializes a new instance of AIProjectClient. - /// The Azure AI Studio project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. + /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. /// The Azure subscription ID. /// The name of the Azure Resource Group. - /// The Azure AI Studio project name. + /// The Azure AI Foundry project name. /// A credential used to authenticate to an Azure Service. /// , , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -47,10 +47,10 @@ protected AIProjectClient() } /// Initializes a new instance of AIProjectClient. - /// The Azure AI Studio project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. + /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. /// The Azure subscription ID. /// The name of the Azure Resource Group. - /// The Azure AI Studio project name. + /// The Azure AI Foundry project name. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. /// , , , or is null. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsClientBuilderExtensions.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsClientBuilderExtensions.cs index 02f3bc489b922..acd83ee1a2170 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsClientBuilderExtensions.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsClientBuilderExtensions.cs @@ -16,10 +16,10 @@ public static partial class AIProjectsClientBuilderExtensions { /// Registers a instance. /// The builder to register with. - /// The Azure AI Studio project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. + /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. /// The Azure subscription ID. /// The name of the Azure Resource Group. - /// The Azure AI Studio project name. + /// The Azure AI Foundry project name. public static IAzureClientBuilder AddAIProjectClient(this TBuilder builder, Uri endpoint, string subscriptionId, string resourceGroupName, string projectName) where TBuilder : IAzureClientFactoryBuilderWithCredential { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs index 720fa4e8cb327..c503dd3f2eda7 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs @@ -21,7 +21,7 @@ public static partial class AIProjectsModelFactory /// 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 . /// - /// Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique. + /// Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. /// Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. /// Metadata containing createdBy and modifiedBy information. /// Status of the evaluation. It is set by service and is read-only. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs index 03f27eba3f542..c5cb29e9b5e93 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AgentsClient.cs @@ -44,10 +44,10 @@ protected AgentsClient() /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The token credential to copy. - /// The Azure AI Studio project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. + /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. /// The Azure subscription ID. /// The name of the Azure Resource Group. - /// The Azure AI Studio project name. + /// The Azure AI Foundry project name. /// The API version to use for this operation. internal AgentsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, string apiVersion) { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs b/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs index 173443bdd0bd7..a5bb875ca420e 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs @@ -71,7 +71,7 @@ public Evaluation(InputData data, IDictionary ev /// 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 . /// - /// Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique. + /// Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. /// Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. /// Metadata containing createdBy and modifiedBy information. /// Status of the evaluation. It is set by service and is read-only. @@ -106,7 +106,7 @@ internal Evaluation() /// The available derived classes include and . /// public InputData Data { get; set; } - /// Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique. + /// Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. public string DisplayName { get; set; } /// Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. public string Description { get; set; } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationsClient.cs b/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationsClient.cs index 2df054d1bb74f..f577d7d06da62 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationsClient.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationsClient.cs @@ -42,10 +42,10 @@ protected EvaluationsClient() /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The token credential to copy. - /// The Azure AI Studio project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. + /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. /// The Azure subscription ID. /// The name of the Azure Resource Group. - /// The Azure AI Studio project name. + /// The Azure AI Foundry project name. /// The API version to use for this operation. internal EvaluationsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, string apiVersion) { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/TelemetryClient.cs b/sdk/ai/Azure.AI.Projects/src/Generated/TelemetryClient.cs index 74d85dbdef872..2732da6a60da0 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/TelemetryClient.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/TelemetryClient.cs @@ -41,10 +41,10 @@ protected TelemetryClient() /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The token credential to copy. - /// The Azure AI Studio project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. + /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link. /// The Azure subscription ID. /// The name of the Azure Resource Group. - /// The Azure AI Studio project name. + /// The Azure AI Foundry project name. /// The API version to use for this operation. internal TelemetryClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, string apiVersion) { diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index f9e0b27b0cb78..b3a80994e3c83 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: fcbbb8c60c603011ec0b2c05aa11034be4a9b17e +commit: af7fb4bf8449f36fe055c895ace1e48535dbbd92 repo: Azure/azure-rest-api-specs additionalDirectories: From f9838d20ebd8f624757f0e520a80261aa52588c3 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:09:39 -0800 Subject: [PATCH 12/18] Update code to new specs --- sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs | 7 ++++++- sdk/ai/Azure.AI.Projects/tsp-location.yaml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs index 552622c70847d..230257cdbd7b3 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/OpenApiAuthType.cs @@ -10,7 +10,12 @@ namespace Azure.AI.Projects { - /// Type of chunking strategy. + /// + /// Authentication type for OpenApi endpoint. Allowed types are: + /// - Anonymous (no authentication required) + /// - Connection (requires connection_id to endpoint, as setup in AI Foundry) + /// - Managed_Identity (requires audience for identity based auth) + /// internal readonly partial struct OpenApiAuthType : IEquatable { private readonly string _value; diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index b3a80994e3c83..acb32c35461ce 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: af7fb4bf8449f36fe055c895ace1e48535dbbd92 +commit: 78fd03731af85255ec8c33527e0eb70aaa65da80 repo: Azure/azure-rest-api-specs additionalDirectories: From f20ee3cad9131dab35a51e8e8acc3426495c65d1 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:21:28 -0800 Subject: [PATCH 13/18] Add OpenAPI example. --- sdk/ai/Azure.AI.Projects/README.md | 45 +++++++++++++++++++ .../api/Azure.AI.Projects.net8.0.cs | 1 + .../api/Azure.AI.Projects.netstandard2.0.cs | 1 + .../Agent/Sample_Agent_Azure_Functions.cs | 2 - 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/README.md b/sdk/ai/Azure.AI.Projects/README.md index aea4472bcea69..de8aa1819a76e 100644 --- a/sdk/ai/Azure.AI.Projects/README.md +++ b/sdk/ai/Azure.AI.Projects/README.md @@ -21,6 +21,8 @@ Use the AI Projects client library to: - [File search](#file-search) - [Function call](#function-call) - [Azure function call](#azure-function-call) + - [Azure Function Call](#create-agent-with-azure-function-call) + - [OpenAPI](#create-agent-with-openapi) - [Troubleshooting](#troubleshooting) - [Next steps](#next-steps) - [Contributing](#contributing) @@ -349,6 +351,7 @@ while (runResponse.Value.Status == RunStatus.Queued ``` #### Azure function call + We also can use Azure Function from inside the agent. In the example below we are calling function "foo", which responds "Bar". In this example we create `AzureFunctionToolDefinition` object, with the function name, description, input and output queues, followed by function parameters. ```C# Snippet:AzureFunctionsDefineFunctionTools AzureFunctionToolDefinition azureFnTool = new( @@ -424,6 +427,48 @@ while (runResponse.Value.Status == RunStatus.Queued || runResponse.Value.Status == RunStatus.RequiresAction); ``` +#### Create Agent With OpenAPI + +OpenAPI specifications describe REST operations against a specific endpoint. Agents SDK can read an OpenAPI spec, create a function from it, and call that function against the REST endpoint without additional client-side execution. + +Here is an example creating an OpenAPI tool (using anonymous authentication): +```C# Snippet:OpenAPIDefineFunctionTools +OpenApiAnonymousAuthDetails oaiAuth = new(); +OpenApiToolDefinition openapiTool = new( + name: "get_weather", + description: "Retrieve weather information for a location", + spec: BinaryData.FromBytes(File.ReadAllBytes(file_path)), + auth: oaiAuth +); + +Response agentResponse = await client.CreateAgentAsync( + model: "gpt-4", + name: "azure-function-agent-foo", + instructions: "You are a helpful assistant.", + tools: new List { openapiTool } + ); +Agent agent = agentResponse.Value; +``` + +In this example we are using the `weather_openapi.json` file and agent will request the wttr.in website for the weather in a location fron the prompt. +```C# Snippet:OpenAPIHandlePollingWithRequiredAction +Response messageResponse = await client.CreateMessageAsync( + thread.Id, + MessageRole.User, + "What's the weather in Seattle?"); +ThreadMessage message = messageResponse.Value; + +Response runResponse = await client.CreateRunAsync(thread, agent); + +do +{ + await Task.Delay(TimeSpan.FromMilliseconds(500)); + runResponse = await client.GetRunAsync(thread.Id, runResponse.Value.Id); +} +while (runResponse.Value.Status == RunStatus.Queued + || runResponse.Value.Status == RunStatus.InProgress + || runResponse.Value.Status == RunStatus.RequiresAction); +``` ## Troubleshooting 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 6af1de27cfe50..60548c9993aae 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 @@ -1590,6 +1590,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class OpenApiToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public OpenApiToolDefinition(Azure.AI.Projects.OpenApiFunctionDefinition openapi) { } + public OpenApiToolDefinition(string name, string description, System.BinaryData spec, Azure.AI.Projects.OpenApiAuthDetails auth) { } public Azure.AI.Projects.OpenApiFunctionDefinition Openapi { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.OpenApiToolDefinition System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } 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 6af1de27cfe50..60548c9993aae 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 @@ -1590,6 +1590,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class OpenApiToolDefinition : Azure.AI.Projects.ToolDefinition, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public OpenApiToolDefinition(Azure.AI.Projects.OpenApiFunctionDefinition openapi) { } + public OpenApiToolDefinition(string name, string description, System.BinaryData spec, Azure.AI.Projects.OpenApiAuthDetails auth) { } public Azure.AI.Projects.OpenApiFunctionDefinition Openapi { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.OpenApiToolDefinition System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs index ab60750e58ddf..400af35f18d13 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Azure_Functions.cs @@ -7,8 +7,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; using Azure.Core.TestFramework; using NUnit.Framework; From 7c2a81ee4c52dc8022fccdc02de74cb2adb9c272 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:24:55 -0800 Subject: [PATCH 14/18] Update changelog --- sdk/ai/Azure.AI.Projects/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/ai/Azure.AI.Projects/CHANGELOG.md b/sdk/ai/Azure.AI.Projects/CHANGELOG.md index 610241142b1ec..5abd1f6b764f8 100644 --- a/sdk/ai/Azure.AI.Projects/CHANGELOG.md +++ b/sdk/ai/Azure.AI.Projects/CHANGELOG.md @@ -4,6 +4,10 @@ ### Features Added +* Added objects to inform Agents about Azure Functions. +* Added `OpenApiTool` for Agents, which creates and executes a REST function defined by an OpenAPI spec. +* Add `parallel_tool_calls` parameter to allow parallel tool execution for Agents. + ### Breaking Changes ### Bugs Fixed From 23806de6b4d5cea3bcb80592a6a60488e172ef1b Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:36:06 -0800 Subject: [PATCH 15/18] Add new files --- .../src/Custom/Agent/OpenApiToolDefinition.cs | 24 +++++ .../Agent/Sample_Agent_Openapi_Functions.cs | 97 +++++++++++++++++++ .../tests/Samples/Agent/weather_openapi.json | 62 ++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 sdk/ai/Azure.AI.Projects/src/Custom/Agent/OpenApiToolDefinition.cs create mode 100644 sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs create mode 100644 sdk/ai/Azure.AI.Projects/tests/Samples/Agent/weather_openapi.json diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/OpenApiToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/OpenApiToolDefinition.cs new file mode 100644 index 0000000000000..646bf56448bc7 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/OpenApiToolDefinition.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class OpenApiToolDefinition + { + public OpenApiToolDefinition(string name, string description, BinaryData spec, OpenApiAuthDetails auth):this( + new OpenApiFunctionDefinition( + name: name, + description: description, + spec: spec, + auth: auth, + serializedAdditionalRawData: null + ) + ){} + } +} diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs new file mode 100644 index 0000000000000..25966737e588a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text.Json.Serialization; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using NUnit.Framework; +using Newtonsoft.Json.Linq; + +namespace Azure.AI.Projects.Tests; + +public partial class Sample_Agent_Azure_Functions : SamplesBase +{ + private static string getFile([CallerFilePath] string pth = "") + { + var dirName = Path.GetDirectoryName(pth) ?? ""; + return Path.Combine(dirName, "weather_openapi.json"); + } + + [Test] + public async Task OpenAPICallingExample() + { + var connectionString = TestEnvironment.AzureAICONNECTIONSTRING; + var storageQueueUri = TestEnvironment.STORAGE_QUEUE_URI; + AgentsClient client = new(connectionString, new DefaultAzureCredential()); + var file_path = getFile(); + + #region Snippet:OpenAPIDefineFunctionTools + OpenApiAnonymousAuthDetails oaiAuth = new(); + OpenApiToolDefinition openapiTool = new( + name: "get_weather", + description: "Retrieve weather information for a location", + spec: BinaryData.FromBytes(File.ReadAllBytes(file_path)), + auth: oaiAuth + ); + + Response agentResponse = await client.CreateAgentAsync( + model: "gpt-4", + name: "azure-function-agent-foo", + instructions: "You are a helpful assistant.", + tools: new List { openapiTool } + ); + Agent agent = agentResponse.Value; + #endregion + + Response threadResponse = await client.CreateThreadAsync(); + AgentThread thread = threadResponse.Value; + + #region Snippet:OpenAPIHandlePollingWithRequiredAction + Response messageResponse = await client.CreateMessageAsync( + thread.Id, + MessageRole.User, + "What's the weather in Seattle?"); + ThreadMessage message = messageResponse.Value; + + Response runResponse = await client.CreateRunAsync(thread, agent); + + do + { + await Task.Delay(TimeSpan.FromMilliseconds(500)); + runResponse = await client.GetRunAsync(thread.Id, runResponse.Value.Id); + } + while (runResponse.Value.Status == RunStatus.Queued + || runResponse.Value.Status == RunStatus.InProgress + || runResponse.Value.Status == RunStatus.RequiresAction); + #endregion + + Response> afterRunMessagesResponse + = await client.GetMessagesAsync(thread.Id); + IReadOnlyList messages = afterRunMessagesResponse.Value.Data; + + // Note: messages iterate from newest to oldest, with the messages[0] being the most recent + foreach (ThreadMessage threadMessage in messages) + { + Console.Write($"{threadMessage.CreatedAt:yyyy-MM-dd HH:mm:ss} - {threadMessage.Role,10}: "); + foreach (MessageContent contentItem in threadMessage.ContentItems) + { + if (contentItem is MessageTextContent textItem) + { + Console.Write(textItem.Text); + } + else if (contentItem is MessageImageFileContent imageFileItem) + { + Console.Write($" Date: Fri, 13 Dec 2024 13:13:22 -0800 Subject: [PATCH 16/18] Fix comment --- sdk/ai/Azure.AI.Projects/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ai/Azure.AI.Projects/CHANGELOG.md b/sdk/ai/Azure.AI.Projects/CHANGELOG.md index 5abd1f6b764f8..769d60cce3ea9 100644 --- a/sdk/ai/Azure.AI.Projects/CHANGELOG.md +++ b/sdk/ai/Azure.AI.Projects/CHANGELOG.md @@ -4,7 +4,7 @@ ### Features Added -* Added objects to inform Agents about Azure Functions. +* Added `AzureFunctionToolDefinition` support to inform Agents about Azure Functions. * Added `OpenApiTool` for Agents, which creates and executes a REST function defined by an OpenAPI spec. * Add `parallel_tool_calls` parameter to allow parallel tool execution for Agents. From 936498eb712ed591b6b000be39ed86ca39481db6 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:20:06 -0800 Subject: [PATCH 17/18] Add bug to the changelog --- sdk/ai/Azure.AI.Projects/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/ai/Azure.AI.Projects/CHANGELOG.md b/sdk/ai/Azure.AI.Projects/CHANGELOG.md index 769d60cce3ea9..b8513e3bef86b 100644 --- a/sdk/ai/Azure.AI.Projects/CHANGELOG.md +++ b/sdk/ai/Azure.AI.Projects/CHANGELOG.md @@ -12,6 +12,8 @@ ### Bugs Fixed +* Fix a bug preventing additional messages to be created when using `CreateRunStreamingAsync` and `CreateRunAsync` see [issue](https://github.com/Azure/azure-sdk-for-net/issues/47244). + ### Other Changes ## 1.0.0-beta.1 (2024-11-19) From e50f9167ea67215be57b6028b3f6b03f2083d1e6 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:38:29 -0800 Subject: [PATCH 18/18] Fix --- sdk/ai/Azure.AI.Projects/CHANGELOG.md | 2 +- .../src/Custom/Agent/AzureFunctionToolDefinition.cs | 3 --- .../tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sdk/ai/Azure.AI.Projects/CHANGELOG.md b/sdk/ai/Azure.AI.Projects/CHANGELOG.md index b8513e3bef86b..bfcefe32bd1ed 100644 --- a/sdk/ai/Azure.AI.Projects/CHANGELOG.md +++ b/sdk/ai/Azure.AI.Projects/CHANGELOG.md @@ -6,7 +6,7 @@ * Added `AzureFunctionToolDefinition` support to inform Agents about Azure Functions. * Added `OpenApiTool` for Agents, which creates and executes a REST function defined by an OpenAPI spec. -* Add `parallel_tool_calls` parameter to allow parallel tool execution for Agents. +* Add `parallelToolCalls` parameter to `CreateRunRequest`, `CreateRunAsync`, `CreateRunStreaming` and `CreateRunStreamingAsync`, which allows parallel tool execution for Agents. ### Breaking Changes diff --git a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs index e9532c4fc8780..5f001e3d0eb78 100644 --- a/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs +++ b/sdk/ai/Azure.AI.Projects/src/Custom/Agent/AzureFunctionToolDefinition.cs @@ -1,8 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. - -// - #nullable disable using System; diff --git a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs index 25966737e588a..004c38dae175f 100644 --- a/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs +++ b/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/Sample_Agent_Openapi_Functions.cs @@ -18,7 +18,7 @@ namespace Azure.AI.Projects.Tests; public partial class Sample_Agent_Azure_Functions : SamplesBase { - private static string getFile([CallerFilePath] string pth = "") + private static string GetFile([CallerFilePath] string pth = "") { var dirName = Path.GetDirectoryName(pth) ?? ""; return Path.Combine(dirName, "weather_openapi.json"); @@ -30,7 +30,7 @@ public async Task OpenAPICallingExample() var connectionString = TestEnvironment.AzureAICONNECTIONSTRING; var storageQueueUri = TestEnvironment.STORAGE_QUEUE_URI; AgentsClient client = new(connectionString, new DefaultAzureCredential()); - var file_path = getFile(); + var file_path = GetFile(); #region Snippet:OpenAPIDefineFunctionTools OpenApiAnonymousAuthDetails oaiAuth = new();