diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.Serialization.cs deleted file mode 100644 index 3e84b77f907b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.Serialization.cs +++ /dev/null @@ -1,164 +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.Agents.Persistent -{ - internal partial class File : 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(File)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ContentType)) - { - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - } - if (Optional.IsDefined(Filename)) - { - writer.WritePropertyName("filename"u8); - writer.WriteStringValue(Filename); - } - writer.WritePropertyName("contents"u8); - writer.WriteBase64StringValue(Contents.ToArray(), "D"); - 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, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - File 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(File)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeFile(document.RootElement, options); - } - - internal static File DeserializeFile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string contentType = default; - string filename = default; - BinaryData contents = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("contentType"u8)) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("filename"u8)) - { - filename = property.Value.GetString(); - continue; - } - if (property.NameEquals("contents"u8)) - { - contents = BinaryData.FromBytes(property.Value.GetBytesFromBase64("D")); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new File(contentType, filename, contents, 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, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(File)} does not support writing '{options.Format}' format."); - } - } - - File 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, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(File)} 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 File FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFile(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.Agents.Persistent/src/Generated/File.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.cs deleted file mode 100644 index fe6fa90e5f73..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.cs +++ /dev/null @@ -1,184 +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.Agents.Persistent -{ - /// - /// A file in an HTTP request, response, or multipart payload. - /// - /// Files have a special meaning that the HTTP library understands. When the body of an HTTP request, response, - /// or multipart payload is _effectively_ an instance of `TypeSpec.Http.File` or any type that extends it, the - /// operation is treated as a file upload or download. - /// - /// When using file bodies, the fields of the file model are defined to come from particular locations by default: - /// - /// - `contentType`: The `Content-Type` header of the request, response, or multipart payload (CANNOT be overridden or changed). - /// - `contents`: The body of the request, response, or multipart payload (CANNOT be overridden or changed). - /// - `filename`: The `filename` parameter value of the `Content-Disposition` header of the response or multipart payload - /// (MAY be overridden or changed). - /// - /// A File may be used as a normal structured JSON object in a request or response, if the request specifies an explicit - /// `Content-Type` header. In this case, the entire File model is serialized as if it were any other model. In a JSON payload, - /// it will have a structure like: - /// - /// ``` - /// { - /// "contentType": <string?>, - /// "filename": <string?>, - /// "contents": <string, base64> - /// } - /// ``` - /// - /// The `contentType` _within_ the file defines what media types the data inside the file can be, but if the specification - /// defines a `Content-Type` for the payload as HTTP metadata, that `Content-Type` metadata defines _how the file is - /// serialized_. See the examples below for more information. - /// - /// NOTE: The `filename` and `contentType` fields are optional. Furthermore, the default location of `filename` - /// (`Content-Disposition: <disposition>; filename=<filename>`) is only valid in HTTP responses and multipart payloads. If - /// you wish to send the `filename` in a request, you must use HTTP metadata decorators to describe the location of the - /// `filename` field. You can combine the metadata decorators with `@visibility` to control when the `filename` location - /// is overridden, as shown in the examples below. - /// - internal partial class File - { - /// - /// 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 contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// is null. - public File(BinaryData contents) - { - Argument.AssertNotNull(contents, nameof(contents)); - - Contents = contents; - } - - /// Initializes a new instance of . - /// - /// The allowed media (MIME) types of the file contents. - /// - /// In file bodies, this value comes from the `Content-Type` header of the request or response. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// NOTE: this is not _necessarily_ the same as the `Content-Type` header of the request or response, but - /// it will be for file bodies. It may be different if the file is serialized as a JSON object. It always refers to the - /// _contents_ of the file, and not necessarily the way the file itself is transmitted or serialized. - /// - /// - /// The name of the file, if any. - /// - /// In file bodies, this value comes from the `filename` parameter of the `Content-Disposition` header of the response - /// or multipart payload. In JSON bodies, this value is serialized as a field in the response. - /// - /// NOTE: By default, `filename` cannot be sent in request payloads and can only be sent in responses and multipart - /// payloads, as the `Content-Disposition` header is not valid in requests. If you want to send the `filename` in a request, - /// you must extend the `File` model and override the `filename` property with a different location defined by HTTP metadata - /// decorators. - /// - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// Keeps track of any properties unknown to the library. - internal File(string contentType, string filename, BinaryData contents, IDictionary serializedAdditionalRawData) - { - ContentType = contentType; - Filename = filename; - Contents = contents; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal File() - { - } - - /// - /// The allowed media (MIME) types of the file contents. - /// - /// In file bodies, this value comes from the `Content-Type` header of the request or response. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// NOTE: this is not _necessarily_ the same as the `Content-Type` header of the request or response, but - /// it will be for file bodies. It may be different if the file is serialized as a JSON object. It always refers to the - /// _contents_ of the file, and not necessarily the way the file itself is transmitted or serialized. - /// - public string ContentType { get; set; } - /// - /// The name of the file, if any. - /// - /// In file bodies, this value comes from the `filename` parameter of the `Content-Disposition` header of the response - /// or multipart payload. In JSON bodies, this value is serialized as a field in the response. - /// - /// NOTE: By default, `filename` cannot be sent in request payloads and can only be sent in responses and multipart - /// payloads, as the `Content-Disposition` header is not valid in requests. If you want to send the `filename` in a request, - /// you must extend the `File` model and override the `filename` property with a different location defined by HTTP metadata - /// decorators. - /// - public string Filename { get; set; } - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// To assign a byte[] to this property use . - /// The byte[] will be serialized to a Base64 encoded string. - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromBytes(new byte[] { 1, 2, 3 }) - /// Creates a payload of "AQID". - /// - /// - /// - /// - public BinaryData Contents { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStreamEvent.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStreamEvent.cs index 73fba226628c..16ecec3460b8 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStreamEvent.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStreamEvent.cs @@ -22,22 +22,22 @@ public MessageStreamEvent(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string ThreadMessageCreatedValue = "thread.message.created"; - private const string ThreadMessageInProgressValue = "thread.message.in_progress"; - private const string ThreadMessageDeltaValue = "thread.message.delta"; - private const string ThreadMessageCompletedValue = "thread.message.completed"; - private const string ThreadMessageIncompleteValue = "thread.message.incomplete"; + private const string MessageCreatedValue = "thread.message.created"; + private const string MessageInProgressValue = "thread.message.in_progress"; + private const string MessageDeltaValue = "thread.message.delta"; + private const string MessageCompletedValue = "thread.message.completed"; + private const string MessageIncompleteValue = "thread.message.incomplete"; /// Event sent when a new message is created. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageCreated { get; } = new MessageStreamEvent(ThreadMessageCreatedValue); + public static MessageStreamEvent MessageCreated { get; } = new MessageStreamEvent(MessageCreatedValue); /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageInProgress { get; } = new MessageStreamEvent(ThreadMessageInProgressValue); + public static MessageStreamEvent MessageInProgress { get; } = new MessageStreamEvent(MessageInProgressValue); /// Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. - public static MessageStreamEvent ThreadMessageDelta { get; } = new MessageStreamEvent(ThreadMessageDeltaValue); + public static MessageStreamEvent MessageDelta { get; } = new MessageStreamEvent(MessageDeltaValue); /// Event sent when a message is completed. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageCompleted { get; } = new MessageStreamEvent(ThreadMessageCompletedValue); + public static MessageStreamEvent MessageCompleted { get; } = new MessageStreamEvent(MessageCompletedValue); /// Event sent before a message is completed. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageIncomplete { get; } = new MessageStreamEvent(ThreadMessageIncompleteValue); + public static MessageStreamEvent MessageIncomplete { get; } = new MessageStreamEvent(MessageIncompleteValue); /// Determines if two values are the same. public static bool operator ==(MessageStreamEvent left, MessageStreamEvent right) => left.Equals(right); /// Determines if two values are not the same. 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 2f6d24b94894..f00228accaec 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 @@ -51,7 +51,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } #endif writer.WritePropertyName("auth"u8); - writer.WriteObjectValue(Auth, options); + writer.WriteObjectValue(OpenApiAuthentication, options); if (Optional.IsCollectionDefined(DefaultParams)) { writer.WritePropertyName("default_params"u8); 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 c5decc8b7489..379481f6a951 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs @@ -48,21 +48,21 @@ public partial class OpenApiFunctionDefinition /// 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) + /// , or is null. + public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetails openApiAuthentication) { Argument.AssertNotNull(name, nameof(name)); Argument.AssertNotNull(spec, nameof(spec)); - Argument.AssertNotNull(auth, nameof(auth)); + Argument.AssertNotNull(openApiAuthentication, nameof(openApiAuthentication)); Name = name; Spec = spec; - Auth = auth; + OpenApiAuthentication = openApiAuthentication; DefaultParams = new ChangeTrackingList(); Functions = new ChangeTrackingList(); } @@ -71,7 +71,7 @@ public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetail /// 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 . @@ -79,12 +79,12 @@ public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetail /// 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, IList functions, IDictionary serializedAdditionalRawData) + internal OpenApiFunctionDefinition(string name, string description, BinaryData spec, OpenApiAuthDetails openApiAuthentication, IList defaultParams, IList functions, IDictionary serializedAdditionalRawData) { Name = name; Description = description; Spec = spec; - Auth = auth; + OpenApiAuthentication = openApiAuthentication; DefaultParams = defaultParams; Functions = functions; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -135,7 +135,7 @@ internal 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 OpenApiAuthDetails Auth { get; set; } + public OpenApiAuthDetails OpenApiAuthentication { get; set; } /// List of OpenAPI spec parameters that will use user-provided defaults. public IList DefaultParams { get; } } 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 a69ba7079458..ade7f4ca510d 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentStreamEvent.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentStreamEvent.cs @@ -50,18 +50,18 @@ public PersistentAgentStreamEvent(string value) private const string ThreadRunCancellingValue = "thread.run.cancelling"; private const string ThreadRunCancelledValue = "thread.run.cancelled"; private const string ThreadRunExpiredValue = "thread.run.expired"; - private const string CreatedValue = "thread.run.step.created"; - 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 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"; - private const string ThreadMessageCompletedValue = "thread.message.completed"; - private const string ThreadMessageIncompleteValue = "thread.message.incomplete"; + private const string RunStepCreatedValue = "thread.run.step.created"; + private const string RunStepInProgressValue = "thread.run.step.in_progress"; + private const string RunStepDeltaValue = "thread.run.step.delta"; + private const string RunStepCompletedValue = "thread.run.step.completed"; + private const string RunStepFailedValue = "thread.run.step.failed"; + private const string RunStepCancelledValue = "thread.run.step.cancelled"; + private const string RunStepExpiredValue = "thread.run.step.expired"; + private const string MessageCreatedValue = "thread.message.created"; + private const string MessageInProgressValue = "thread.message.in_progress"; + private const string MessageDeltaValue = "thread.message.delta"; + private const string MessageCompletedValue = "thread.message.completed"; + private const string MessageIncompleteValue = "thread.message.incomplete"; private const string ErrorValue = "error"; private const string DoneValue = "done"; @@ -88,29 +88,29 @@ public PersistentAgentStreamEvent(string value) /// Event sent when a run is expired. The data of this event is of type ThreadRun. public static PersistentAgentStreamEvent ThreadRunExpired { get; } = new PersistentAgentStreamEvent(ThreadRunExpiredValue); /// Event sent when a new thread run step is created. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent Created { get; } = new PersistentAgentStreamEvent(CreatedValue); + public static PersistentAgentStreamEvent RunStepCreated { get; } = new PersistentAgentStreamEvent(RunStepCreatedValue); /// Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent InProgress { get; } = new PersistentAgentStreamEvent(InProgressValue); + public static PersistentAgentStreamEvent RunStepInProgress { get; } = new PersistentAgentStreamEvent(RunStepInProgressValue); /// Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. - public static PersistentAgentStreamEvent Delta { get; } = new PersistentAgentStreamEvent(DeltaValue); + public static PersistentAgentStreamEvent RunStepDelta { get; } = new PersistentAgentStreamEvent(RunStepDeltaValue); /// 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); + public static PersistentAgentStreamEvent RunStepCompleted { get; } = new PersistentAgentStreamEvent(RunStepCompletedValue); /// Event sent when a run step fails. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent Failed { get; } = new PersistentAgentStreamEvent(FailedValue); + public static PersistentAgentStreamEvent RunStepFailed { get; } = new PersistentAgentStreamEvent(RunStepFailedValue); /// Event sent when a run step is cancelled. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent Cancelled { get; } = new PersistentAgentStreamEvent(CancelledValue); + public static PersistentAgentStreamEvent RunStepCancelled { get; } = new PersistentAgentStreamEvent(RunStepCancelledValue); /// Event sent when a run step is expired. The data of this event is of type RunStep. - public static PersistentAgentStreamEvent Expired { get; } = new PersistentAgentStreamEvent(ExpiredValue); + public static PersistentAgentStreamEvent RunStepExpired { get; } = new PersistentAgentStreamEvent(RunStepExpiredValue); /// 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); + public static PersistentAgentStreamEvent MessageCreated { get; } = new PersistentAgentStreamEvent(MessageCreatedValue); /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. - public static PersistentAgentStreamEvent ThreadMessageInProgress { get; } = new PersistentAgentStreamEvent(ThreadMessageInProgressValue); + public static PersistentAgentStreamEvent MessageInProgress { get; } = new PersistentAgentStreamEvent(MessageInProgressValue); /// Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. - public static PersistentAgentStreamEvent ThreadMessageDelta { get; } = new PersistentAgentStreamEvent(ThreadMessageDeltaValue); + public static PersistentAgentStreamEvent MessageDelta { get; } = new PersistentAgentStreamEvent(MessageDeltaValue); /// Event sent when a message is completed. The data of this event is of type ThreadMessage. - public static PersistentAgentStreamEvent ThreadMessageCompleted { get; } = new PersistentAgentStreamEvent(ThreadMessageCompletedValue); + public static PersistentAgentStreamEvent MessageCompleted { get; } = new PersistentAgentStreamEvent(MessageCompletedValue); /// Event sent before a message is completed. The data of this event is of type ThreadMessage. - public static PersistentAgentStreamEvent ThreadMessageIncomplete { get; } = new PersistentAgentStreamEvent(ThreadMessageIncompleteValue); + public static PersistentAgentStreamEvent MessageIncomplete { get; } = new PersistentAgentStreamEvent(MessageIncompleteValue); /// Event sent when an error occurs, such as an internal server error or a timeout. public static PersistentAgentStreamEvent Error { get; } = new PersistentAgentStreamEvent(ErrorValue); /// Event sent when the stream is done. diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClientOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClientOptions.cs index 9cb1de8e0318..41280307fd81 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClientOptions.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClientOptions.cs @@ -13,15 +13,15 @@ namespace Azure.AI.Agents.Persistent /// Client options for PersistentAgentsAdministrationClient. public partial class PersistentAgentsAdministrationClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V1; + private const ServiceVersion LatestVersion = ServiceVersion.V2025_05_15_Preview; /// The version of the service to use. public enum ServiceVersion { /// Service version "2025-05-01". V2025_05_01 = 1, - /// Service version "v1". - V1 = 2, + /// Service version "2025-05-15-preview". + V2025_05_15_Preview = 2, } internal string Version { get; } @@ -32,7 +32,7 @@ public PersistentAgentsAdministrationClientOptions(ServiceVersion version = Late Version = version switch { ServiceVersion.V2025_05_01 => "2025-05-01", - ServiceVersion.V1 => "v1", + ServiceVersion.V2025_05_15_Preview => "2025-05-15-preview", _ => throw new NotSupportedException() }; } 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 840165d54f19..56b4cb4f09d8 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStreamEvent.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStreamEvent.cs @@ -22,28 +22,28 @@ public RunStepStreamEvent(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string CreatedValue = "thread.run.step.created"; - 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 FailedValue = "thread.run.step.failed"; - private const string CancelledValue = "thread.run.step.cancelled"; - private const string ExpiredValue = "thread.run.step.expired"; + private const string RunStepCreatedValue = "thread.run.step.created"; + private const string RunStepInProgressValue = "thread.run.step.in_progress"; + private const string RunStepDeltaValue = "thread.run.step.delta"; + private const string RunStepCompletedValue = "thread.run.step.completed"; + private const string RunStepFailedValue = "thread.run.step.failed"; + private const string RunStepCancelledValue = "thread.run.step.cancelled"; + private const string RunStepExpiredValue = "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); + public static RunStepStreamEvent RunStepCreated { get; } = new RunStepStreamEvent(RunStepCreatedValue); /// Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. - public static RunStepStreamEvent InProgress { get; } = new RunStepStreamEvent(InProgressValue); + public static RunStepStreamEvent RunStepInProgress { get; } = new RunStepStreamEvent(RunStepInProgressValue); /// Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. - public static RunStepStreamEvent Delta { get; } = new RunStepStreamEvent(DeltaValue); + public static RunStepStreamEvent RunStepDelta { get; } = new RunStepStreamEvent(RunStepDeltaValue); /// 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); + public static RunStepStreamEvent RunStepCompleted { get; } = new RunStepStreamEvent(RunStepCompletedValue); /// Event sent when a run step fails. The data of this event is of type RunStep. - public static RunStepStreamEvent Failed { get; } = new RunStepStreamEvent(FailedValue); + public static RunStepStreamEvent RunStepFailed { get; } = new RunStepStreamEvent(RunStepFailedValue); /// Event sent when a run step is cancelled. The data of this event is of type RunStep. - public static RunStepStreamEvent Cancelled { get; } = new RunStepStreamEvent(CancelledValue); + public static RunStepStreamEvent RunStepCancelled { get; } = new RunStepStreamEvent(RunStepCancelledValue); /// Event sent when a run step is expired. The data of this event is of type RunStep. - public static RunStepStreamEvent Expired { get; } = new RunStepStreamEvent(ExpiredValue); + public static RunStepStreamEvent RunStepExpired { get; } = new RunStepStreamEvent(RunStepExpiredValue); /// 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/UploadFileRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.Serialization.cs index 630757d555d5..556457d136fb 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.Serialization.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.Serialization.cs @@ -36,7 +36,14 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("file"u8); - writer.WriteObjectValue(Data, options); +#if NET6_0_OR_GREATER + writer.WriteRawValue(global::System.BinaryData.FromStream(Data)); +#else + using (JsonDocument document = JsonDocument.Parse(BinaryData.FromStream(Data), ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif writer.WritePropertyName("purpose"u8); writer.WriteStringValue(Purpose.ToString()); if (Optional.IsDefined(Filename)) @@ -81,7 +88,7 @@ internal static UploadFileRequest DeserializeUploadFileRequest(JsonElement eleme { return null; } - File file = default; + Stream file = default; PersistentAgentFilePurpose purpose = default; string filename = default; IDictionary serializedAdditionalRawData = default; @@ -90,7 +97,7 @@ internal static UploadFileRequest DeserializeUploadFileRequest(JsonElement eleme { if (property.NameEquals("file"u8)) { - file = File.DeserializeFile(property.Value, options); + file = BinaryData.FromString(property.Value.GetRawText()).ToStream(); continue; } if (property.NameEquals("purpose"u8)) diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs index de3f5be1f220..8237de65309a 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.IO; namespace Azure.AI.Agents.Persistent { @@ -49,7 +50,7 @@ internal partial class UploadFileRequest /// The file data, in bytes. /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. /// is null. - public UploadFileRequest(File data, PersistentAgentFilePurpose purpose) + public UploadFileRequest(Stream data, PersistentAgentFilePurpose purpose) { Argument.AssertNotNull(data, nameof(data)); @@ -62,7 +63,7 @@ public UploadFileRequest(File data, PersistentAgentFilePurpose purpose) /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. /// The name of the file. /// Keeps track of any properties unknown to the library. - internal UploadFileRequest(File data, PersistentAgentFilePurpose purpose, string filename, IDictionary serializedAdditionalRawData) + internal UploadFileRequest(Stream data, PersistentAgentFilePurpose purpose, string filename, IDictionary serializedAdditionalRawData) { Data = data; Purpose = purpose; @@ -76,7 +77,7 @@ internal UploadFileRequest() } /// The file data, in bytes. - public File Data { get; } + public Stream Data { get; } /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. public PersistentAgentFilePurpose Purpose { get; } /// The name of the file. diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs index 0f5fac22d94d..ebec386dfdf3 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs @@ -470,6 +470,7 @@ internal HttpMessage CreateGetVectorStoreFileBatchFilesRequest(string vectorStor { uri.AppendQuery("filter", filter, true); } + uri.AppendQuery("api-version", _apiVersion, true); if (limit != null) { uri.AppendQuery("limit", limit.Value, true); diff --git a/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml b/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml index 35e2e6045ef4..bad9c01ddc4c 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: 6625eb323d07755a1d77c17dc713e484d3c1e00e +commit: 911eaca01646c018e30066edd51dd1848101bc34 repo: Azure/azure-rest-api-specs additionalDirectories: