diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs index 87c02b22505f..02993f45cecc 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs @@ -154,7 +154,7 @@ internal CreateAgentRequest() /// /// /// - /// + /// /// /// /// diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs index f284b65a774e..d6413572c7a9 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs @@ -244,7 +244,7 @@ internal CreateRunRequest() /// /// /// - /// + /// /// /// /// diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs index ebf177810083..49848d9fc53c 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs @@ -237,7 +237,7 @@ internal CreateThreadAndRunRequest() /// /// /// - /// + /// /// /// /// diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormat.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.Serialization.cs similarity index 63% rename from sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormat.Serialization.cs rename to sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.Serialization.cs index f433d5a72adc..5080938904e6 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormat.Serialization.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Agents.Persistent { - public partial class PersistentAgentsResponseFormat : IUtf8JsonSerializable, IJsonModel + internal partial class InternalPersistentAgentsResponseFormat : 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,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// 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(PersistentAgentsResponseFormat)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} does not support writing '{format}' format."); } if (Optional.IsDefined(Type)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PersistentAgentsResponseFormat IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + InternalPersistentAgentsResponseFormat 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(PersistentAgentsResponseFormat)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentAgentsResponseFormat(document.RootElement, options); + return DeserializeInternalPersistentAgentsResponseFormat(document.RootElement, options); } - internal static PersistentAgentsResponseFormat DeserializePersistentAgentsResponseFormat(JsonElement element, ModelReaderWriterOptions options = null) + internal static InternalPersistentAgentsResponseFormat DeserializeInternalPersistentAgentsResponseFormat(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -96,46 +96,46 @@ internal static PersistentAgentsResponseFormat DeserializePersistentAgentsRespon } } serializedAdditionalRawData = rawDataDictionary; - return new PersistentAgentsResponseFormat(type, serializedAdditionalRawData); + return new InternalPersistentAgentsResponseFormat(type, 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, AzureAIAgentsPersistentContext.Default); default: - throw new FormatException($"The model {nameof(PersistentAgentsResponseFormat)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} does not support writing '{options.Format}' format."); } } - PersistentAgentsResponseFormat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + InternalPersistentAgentsResponseFormat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentsResponseFormat(document.RootElement, options); + return DeserializeInternalPersistentAgentsResponseFormat(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(PersistentAgentsResponseFormat)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} 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 PersistentAgentsResponseFormat FromResponse(Response response) + internal static InternalPersistentAgentsResponseFormat FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentsResponseFormat(document.RootElement); + return DeserializeInternalPersistentAgentsResponseFormat(document.RootElement); } /// Convert into a . diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormat.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.cs similarity index 82% rename from sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormat.cs rename to sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.cs index a40f7fad39b9..ae42c5945c51 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormat.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.cs @@ -14,7 +14,7 @@ namespace Azure.AI.Agents.Persistent /// An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. /// If `text` the model can return text or any value needed. /// - public partial class PersistentAgentsResponseFormat + internal partial class InternalPersistentAgentsResponseFormat { /// /// Keeps track of any properties unknown to the library. @@ -48,15 +48,15 @@ public partial class PersistentAgentsResponseFormat /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public PersistentAgentsResponseFormat() + /// Initializes a new instance of . + public InternalPersistentAgentsResponseFormat() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Must be one of `text` or `json_object`. /// Keeps track of any properties unknown to the library. - internal PersistentAgentsResponseFormat(ResponseFormat? type, IDictionary serializedAdditionalRawData) + internal InternalPersistentAgentsResponseFormat(ResponseFormat? type, IDictionary serializedAdditionalRawData) { Type = type; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs index 41d5a0ae6d05..2f6d24b94894 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs @@ -62,6 +62,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (options.Format != "W" && Optional.IsCollectionDefined(Functions)) + { + writer.WritePropertyName("functions"u8); + writer.WriteStartArray(); + foreach (var item in Functions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -104,6 +114,7 @@ internal static OpenApiFunctionDefinition DeserializeOpenApiFunctionDefinition(J BinaryData spec = default; OpenApiAuthDetails auth = default; IList defaultParams = default; + IList functions = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -142,6 +153,20 @@ internal static OpenApiFunctionDefinition DeserializeOpenApiFunctionDefinition(J defaultParams = array; continue; } + if (property.NameEquals("functions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InternalFunctionDefinition.DeserializeInternalFunctionDefinition(item, options)); + } + functions = array; + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -154,6 +179,7 @@ internal static OpenApiFunctionDefinition DeserializeOpenApiFunctionDefinition(J spec, auth, defaultParams ?? new ChangeTrackingList(), + functions ?? new ChangeTrackingList(), serializedAdditionalRawData); } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs index e537de02f25c..c5decc8b7489 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs @@ -64,6 +64,7 @@ public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetail Spec = spec; Auth = auth; DefaultParams = new ChangeTrackingList(); + Functions = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -76,14 +77,16 @@ public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetail /// The available derived classes include , and . /// /// List of OpenAPI spec parameters that will use user-provided defaults. + /// List of function definitions used by OpenApi tool. /// Keeps track of any properties unknown to the library. - internal OpenApiFunctionDefinition(string name, string description, BinaryData spec, OpenApiAuthDetails auth, IList defaultParams, IDictionary serializedAdditionalRawData) + internal OpenApiFunctionDefinition(string name, string description, BinaryData spec, OpenApiAuthDetails auth, IList defaultParams, IList functions, IDictionary serializedAdditionalRawData) { Name = name; Description = description; Spec = spec; Auth = auth; DefaultParams = defaultParams; + Functions = functions; _serializedAdditionalRawData = serializedAdditionalRawData; } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs index f2a4a65b55cc..027c8084d20e 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs @@ -201,7 +201,7 @@ internal PersistentAgent() /// /// /// - /// + /// /// /// /// diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentStreamEvent.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentStreamEvent.cs index 833656dfbdbf..a69ba7079458 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentStreamEvent.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentStreamEvent.cs @@ -54,9 +54,9 @@ public PersistentAgentStreamEvent(string value) private const string InProgressValue = "thread.run.step.in_progress"; private const string DeltaValue = "thread.run.step.delta"; private const string CompletedValue = "thread.run.step.completed"; - private const string ThreadRunStepFailedValue = "thread.run.step.failed"; - private const string ThreadRunStepCancelledValue = "thread.run.step.cancelled"; - private const string ThreadRunStepExpiredValue = "thread.run.step.expired"; + private const string FailedValue = "thread.run.step.failed"; + private const string CancelledValue = "thread.run.step.cancelled"; + private const string ExpiredValue = "thread.run.step.expired"; private const string ThreadMessageCreatedValue = "thread.message.created"; private const string ThreadMessageInProgressValue = "thread.message.in_progress"; private const string ThreadMessageDeltaValue = "thread.message.delta"; @@ -96,11 +96,11 @@ public PersistentAgentStreamEvent(string value) /// Event sent when a run step is completed. The data of this event is of type RunStep. public static PersistentAgentStreamEvent Completed { get; } = new PersistentAgentStreamEvent(CompletedValue); /// Event sent when a run step fails. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent ThreadRunStepFailed { get; } = new PersistentAgentStreamEvent(ThreadRunStepFailedValue); + public static PersistentAgentStreamEvent Failed { get; } = new PersistentAgentStreamEvent(FailedValue); /// Event sent when a run step is cancelled. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent ThreadRunStepCancelled { get; } = new PersistentAgentStreamEvent(ThreadRunStepCancelledValue); + public static PersistentAgentStreamEvent Cancelled { get; } = new PersistentAgentStreamEvent(CancelledValue); /// Event sent when a run step is expired. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent ThreadRunStepExpired { get; } = new PersistentAgentStreamEvent(ThreadRunStepExpiredValue); + public static PersistentAgentStreamEvent Expired { get; } = new PersistentAgentStreamEvent(ExpiredValue); /// Event sent when a new message is created. The data of this event is of type ThreadMessage. public static PersistentAgentStreamEvent ThreadMessageCreated { get; } = new PersistentAgentStreamEvent(ThreadMessageCreatedValue); /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs index fad9a7c7c30e..cfe6f5076c30 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Agents.Persistent { /// Possible API response formats. - public readonly partial struct ResponseFormat : IEquatable + internal readonly partial struct ResponseFormat : IEquatable { private readonly string _value; diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStreamEvent.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStreamEvent.cs index 84fda207876d..840165d54f19 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStreamEvent.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStreamEvent.cs @@ -26,9 +26,9 @@ public RunStepStreamEvent(string value) private const string InProgressValue = "thread.run.step.in_progress"; private const string DeltaValue = "thread.run.step.delta"; private const string CompletedValue = "thread.run.step.completed"; - private const string ThreadRunStepFailedValue = "thread.run.step.failed"; - private const string ThreadRunStepCancelledValue = "thread.run.step.cancelled"; - private const string ThreadRunStepExpiredValue = "thread.run.step.expired"; + private const string FailedValue = "thread.run.step.failed"; + private const string CancelledValue = "thread.run.step.cancelled"; + private const string ExpiredValue = "thread.run.step.expired"; /// Event sent when a new thread run step is created. The data of this event is of type RunStep. public static RunStepStreamEvent Created { get; } = new RunStepStreamEvent(CreatedValue); @@ -39,11 +39,11 @@ public RunStepStreamEvent(string value) /// Event sent when a run step is completed. The data of this event is of type RunStep. public static RunStepStreamEvent Completed { get; } = new RunStepStreamEvent(CompletedValue); /// Event sent when a run step fails. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepFailed { get; } = new RunStepStreamEvent(ThreadRunStepFailedValue); + public static RunStepStreamEvent Failed { get; } = new RunStepStreamEvent(FailedValue); /// Event sent when a run step is cancelled. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepCancelled { get; } = new RunStepStreamEvent(ThreadRunStepCancelledValue); + public static RunStepStreamEvent Cancelled { get; } = new RunStepStreamEvent(CancelledValue); /// Event sent when a run step is expired. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepExpired { get; } = new RunStepStreamEvent(ThreadRunStepExpiredValue); + public static RunStepStreamEvent Expired { get; } = new RunStepStreamEvent(ExpiredValue); /// Determines if two values are the same. public static bool operator ==(RunStepStreamEvent left, RunStepStreamEvent right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs index f82dda33493b..195dfe8c9d4d 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs @@ -302,7 +302,7 @@ internal ThreadRun() /// /// /// - /// + /// /// /// /// diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs index 7badebe73673..7b84d42ae316 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs @@ -144,7 +144,7 @@ internal UpdateAgentRequest(string model, string name, string description, strin /// /// /// - /// + /// /// /// /// diff --git a/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml b/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml index 1262a7e70b96..ee78374a7dca 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml +++ b/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Azure.AI.Agents -commit: 41018d0a67ed5a396f4ee34f44bd4e5462f809be +commit: 0d86e6248d493d4bed166df7a077f39f7fcd503c repo: Azure/azure-rest-api-specs additionalDirectories: