diff --git a/sdk/ai/Azure.AI.Assistants/Azure.AI.Assistants.sln b/sdk/ai/Azure.AI.Assistants/Azure.AI.Assistants.sln
new file mode 100644
index 000000000000..7e61ec7e9b4e
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/Azure.AI.Assistants.sln
@@ -0,0 +1,56 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Assistants", "src\Azure.AI.Assistants.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Assistants.Tests", "tests\Azure.AI.Assistants.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/ai/Azure.AI.Assistants/CHANGELOG.md b/sdk/ai/Azure.AI.Assistants/CHANGELOG.md
new file mode 100644
index 000000000000..8b33f0fedccc
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
\ No newline at end of file
diff --git a/sdk/ai/Azure.AI.Assistants/Directory.Build.props b/sdk/ai/Azure.AI.Assistants/Directory.Build.props
new file mode 100644
index 000000000000..63bd836ad44b
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/ai/Azure.AI.Assistants/README.md b/sdk/ai/Azure.AI.Assistants/README.md
new file mode 100644
index 000000000000..a6e83f175c1a
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/README.md
@@ -0,0 +1,107 @@
+# Azure.AI.Assistants client library for .NET
+
+Azure.AI.Assistants is a managed service that helps developers get secret simply and securely.
+
+Use the client library for to:
+
+* [Get secret](https://docs.microsoft.com/azure)
+
+[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples]
+
+ [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Assistants/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure)
+
+## Getting started
+
+This section should include everything a developer needs to do to install and create their first client connection *very quickly*.
+
+### Install the package
+
+First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository.
+
+Install the client library for .NET with [NuGet](https://www.nuget.org/ ):
+
+```dotnetcli
+dotnet add package Azure.AI.Assistants --prerelease
+```
+
+### Prerequisites
+
+Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB:
+
+> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`.
+
+### Authenticate the client
+
+If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating.
+
+For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object.
+
+### Service API versions
+
+The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate.
+
+#### Select a service API version
+
+You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version.
+
+For example,
+
+```C# Snippet:CreateClientForSpecificApiVersion
+Uri endpoint = new Uri("");
+DefaultAzureCredential credential = new DefaultAzureCredential();
+ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.)
+var client = new Client(endpoint, credential, options);
+```
+
+When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility.
+
+Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy.
+
+## Key concepts
+
+The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity.
+
+Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of:
+
+### Thread safety
+
+We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.
+
+### Additional concepts
+
+[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) |
+[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) |
+[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) |
+[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) |
+[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) |
+[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) |
+[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/)
+
+
+## Examples
+
+You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Assistants/samples).
+
+## Troubleshooting
+
+Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery.
+
+Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API.
+
+If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code.
+
+## Next steps
+
+* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory.
+* If appropriate, point users to other packages that might be useful.
+* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for.
+
+## Contributing
+
+This is a template, but your SDK readme should include details on how to contribute code to the repo/package.
+
+
+[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
+[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
+
+
\ No newline at end of file
diff --git a/sdk/ai/Azure.AI.Assistants/src/Azure.AI.Assistants.csproj b/sdk/ai/Azure.AI.Assistants/src/Azure.AI.Assistants.csproj
new file mode 100644
index 000000000000..88d4fd53f671
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Azure.AI.Assistants.csproj
@@ -0,0 +1,20 @@
+
+
+ This is the Azure.AI.Assistants client library for developing .NET applications with rich experience.
+ Azure SDK Code Generation Azure.AI.Assistants for Azure Data Plane
+ 1.0.0-beta.1
+ Azure.AI.Assistants
+ $(RequiredTargetFrameworks)
+ true
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsClientBuilderExtensions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsClientBuilderExtensions.cs
new file mode 100644
index 000000000000..0ed8d1b60b45
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsClientBuilderExtensions.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure;
+using Azure.AI.Assistants;
+using Azure.Core.Extensions;
+
+namespace Microsoft.Extensions.Azure
+{
+ /// Extension methods to add to client builder.
+ public static partial class AIAssistantsClientBuilderExtensions
+ {
+ /// Registers a instance.
+ /// The builder to register with.
+ /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>.
+ /// A credential used to authenticate to an Azure Service.
+ public static IAzureClientBuilder AddAssistantsClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential)
+ where TBuilder : IAzureClientFactoryBuilder
+ {
+ return builder.RegisterClientFactory((options) => new AssistantsClient(endpoint, credential, options));
+ }
+
+ /// Registers a instance.
+ /// The builder to register with.
+ /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>.
+ public static IAzureClientBuilder AddAssistantsClient(this TBuilder builder, Uri endpoint)
+ where TBuilder : IAzureClientFactoryBuilderWithCredential
+ {
+ return builder.RegisterClientFactory((options, cred) => new AssistantsClient(endpoint, cred, options));
+ }
+
+ /// Registers a instance.
+ /// The builder to register with.
+ /// The configuration values.
+ public static IAzureClientBuilder AddAssistantsClient(this TBuilder builder, TConfiguration configuration)
+ where TBuilder : IAzureClientFactoryBuilderWithConfiguration
+ {
+ return builder.RegisterClientFactory(configuration);
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsModelFactory.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsModelFactory.cs
new file mode 100644
index 000000000000..26a565a95b31
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AIAssistantsModelFactory.cs
@@ -0,0 +1,1160 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Azure.AI.Assistants
+{
+ /// Model factory for models.
+ public static partial class AIAssistantsModelFactory
+ {
+ /// 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 .
+ /// Type.
+ /// The JSON schema, describing response format.
+ /// A new instance for mocking.
+ public static ResponseFormatJsonSchemaType ResponseFormatJsonSchemaType(ResponseFormatJsonSchemaTypeType type = default, ResponseFormatJsonSchema jsonSchema = null)
+ {
+ return new ResponseFormatJsonSchemaType(type, jsonSchema, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always assistant.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The name of the assistant.
+ /// The description of the assistant.
+ /// The ID of the model to use.
+ /// The system instructions for the assistant to use.
+ ///
+ /// The collection of tools enabled for the assistant.
+ /// 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 .
+ ///
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ /// The response format of the tool calls used by this assistant.
+ /// 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.
+ /// A new instance for mocking.
+ public static Assistant Assistant(string id = null, AssistantObject @object = default, DateTimeOffset createdAt = default, string name = null, string description = null, string model = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null)
+ {
+ tools ??= new List();
+ metadata ??= new Dictionary();
+
+ return new Assistant(
+ id,
+ @object,
+ createdAt,
+ name,
+ description,
+ model,
+ instructions,
+ tools?.ToList(),
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// The role of the entity that is creating the message. Allowed values include:
+ /// `user`, which indicates the message is sent by an actual user (and should be
+ /// used in most cases to represent user-generated messages), and `assistant`,
+ /// which indicates the message is generated by the agent (use this value to insert
+ /// messages from the agent into the conversation).
+ ///
+ ///
+ /// The content of the initial message. This may be a basic string (if you only
+ /// need text) or an array of typed content blocks (for example, text, image_file,
+ /// image_url, and so on).
+ ///
+ /// A list of files attached to the message, and the tools they should be added to.
+ /// 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.
+ /// A new instance for mocking.
+ public static ThreadMessageOptions ThreadMessageOptions(MessageRole role = default, BinaryData content = null, IEnumerable attachments = null, IDictionary metadata = null)
+ {
+ attachments ??= new List();
+ metadata ??= new Dictionary();
+
+ return new ThreadMessageOptions(role, content, attachments?.ToList(), metadata, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The plain text content for this block.
+ /// A new instance for mocking.
+ public static MessageInputTextBlock MessageInputTextBlock(string text = null)
+ {
+ return new MessageInputTextBlock(MessageBlockType.Text, serializedAdditionalRawData: null, text);
+ }
+
+ /// Initializes a new instance of .
+ /// Information about the referenced image file, including file ID and optional detail level.
+ /// A new instance for mocking.
+ public static MessageInputImageFileBlock MessageInputImageFileBlock(MessageImageFileParam imageFile = null)
+ {
+ return new MessageInputImageFileBlock(MessageBlockType.ImageFile, serializedAdditionalRawData: null, imageFile);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the previously uploaded image file.
+ /// Optional detail level for the image (auto, low, or high).
+ /// A new instance for mocking.
+ public static MessageImageFileParam MessageImageFileParam(string fileId = null, ImageDetailLevel? detail = null)
+ {
+ return new MessageImageFileParam(fileId, detail, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Information about the external image URL, including the URL and optional detail level.
+ /// A new instance for mocking.
+ public static MessageInputImageUrlBlock MessageInputImageUrlBlock(MessageImageUrlParam imageUrl = null)
+ {
+ return new MessageInputImageUrlBlock(MessageBlockType.ImageUrl, serializedAdditionalRawData: null, imageUrl);
+ }
+
+ /// Initializes a new instance of .
+ /// The publicly accessible URL of the external image.
+ /// Optional detail level for the image (auto, low, or high). Defaults to 'auto' if not specified.
+ /// A new instance for mocking.
+ public static MessageImageUrlParam MessageImageUrlParam(string url = null, ImageDetailLevel? detail = null)
+ {
+ return new MessageImageUrlParam(url, detail, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type
+ /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list
+ /// of vector store IDs.
+ ///
+ /// 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.
+ /// A new instance for mocking.
+ public static AssistantThread AssistantThread(string id = null, AssistantThreadObject @object = default, DateTimeOffset createdAt = default, ToolResources toolResources = null, IReadOnlyDictionary metadata = null)
+ {
+ metadata ??= new Dictionary();
+
+ return new AssistantThread(
+ id,
+ @object,
+ createdAt,
+ toolResources,
+ metadata,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread.message'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The ID of the thread that this message belongs to.
+ /// The status of the message.
+ /// On an incomplete message, details about why the message is incomplete.
+ /// The Unix timestamp (in seconds) for when the message was completed.
+ /// The Unix timestamp (in seconds) for when the message was marked as incomplete.
+ /// The role associated with the assistant thread message.
+ ///
+ /// The list of content items associated with the assistant thread message.
+ /// 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 .
+ ///
+ /// If applicable, the ID of the assistant that authored this message.
+ /// If applicable, the ID of the run associated with the authoring of this message.
+ /// A list of files attached to the message, and the tools they were added to.
+ /// 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.
+ /// A new instance for mocking.
+ public static ThreadMessage ThreadMessage(string id = null, ThreadMessageObject @object = default, DateTimeOffset createdAt = default, string threadId = null, MessageStatus status = default, MessageIncompleteDetails incompleteDetails = null, DateTimeOffset? completedAt = null, DateTimeOffset? incompleteAt = null, MessageRole role = default, IEnumerable contentItems = null, string assistantId = null, string runId = null, IEnumerable attachments = null, IReadOnlyDictionary metadata = null)
+ {
+ contentItems ??= new List();
+ attachments ??= new List();
+ metadata ??= new Dictionary();
+
+ return new ThreadMessage(
+ id,
+ @object,
+ createdAt,
+ threadId,
+ status,
+ incompleteDetails,
+ completedAt,
+ incompleteAt,
+ role,
+ contentItems?.ToList(),
+ assistantId,
+ runId,
+ attachments?.ToList(),
+ metadata,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The provided reason describing why the message was marked as incomplete.
+ /// A new instance for mocking.
+ public static MessageIncompleteDetails MessageIncompleteDetails(MessageIncompleteDetailsReason reason = default)
+ {
+ return new MessageIncompleteDetails(reason, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// The textual content associated with this text annotation item.
+ /// A new instance for mocking.
+ public static MessageTextAnnotation MessageTextAnnotation(string type = null, string text = null)
+ {
+ return new UnknownMessageTextAnnotation(type, text, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The textual content associated with this text annotation item.
+ /// The details of the URL citation.
+ /// The first text index associated with this text annotation.
+ /// The last text index associated with this text annotation.
+ /// A new instance for mocking.
+ public static MessageTextUrlCitationAnnotation MessageTextUrlCitationAnnotation(string text = null, MessageTextUrlCitationDetails urlCitation = null, int? startIndex = null, int? endIndex = null)
+ {
+ return new MessageTextUrlCitationAnnotation(
+ "url_citation",
+ text,
+ serializedAdditionalRawData: null,
+ urlCitation,
+ startIndex,
+ endIndex);
+ }
+
+ /// Initializes a new instance of .
+ /// The URL associated with this citation.
+ /// The title of the URL.
+ /// A new instance for mocking.
+ public static MessageTextUrlCitationDetails MessageTextUrlCitationDetails(string url = null, string title = null)
+ {
+ return new MessageTextUrlCitationDetails(url, title, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread.run'.
+ /// The ID of the thread associated with this run.
+ /// The ID of the assistant associated with the thread this run was performed against.
+ /// The status of the assistant thread run.
+ ///
+ /// The details of the action required for the assistant thread run to continue.
+ /// 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 .
+ ///
+ /// The last error, if any, encountered by this assistant thread run.
+ /// The ID of the model to use.
+ /// The overridden system instructions used for this assistant thread run.
+ ///
+ /// The overridden enabled tools used for this assistant 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 Unix timestamp, in seconds, representing when this object was created.
+ /// The Unix timestamp, in seconds, representing when this item expires.
+ /// The Unix timestamp, in seconds, representing when this item was started.
+ /// The Unix timestamp, in seconds, representing when this completed.
+ /// The Unix timestamp, in seconds, representing when this was cancelled.
+ /// The Unix timestamp, in seconds, representing when this failed.
+ /// Details on why the run is incomplete. Will be `null` if the run is not incomplete.
+ /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).
+ /// The sampling temperature used for this run. If not set, defaults to 1.
+ /// The nucleus sampling value used for this run. If not set, defaults to 1.
+ /// The maximum number of prompt tokens specified to have been used over the course of the run.
+ /// The maximum number of completion tokens specified to have been used over the course of the run.
+ /// 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.
+ /// 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.
+ /// Override the tools the assistant 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.
+ /// A new instance for mocking.
+ public static ThreadRun ThreadRun(string id = null, ThreadRunObject @object = default, string threadId = null, string assistantId = null, RunStatus status = default, RequiredAction requiredAction = null, RunError lastError = null, string model = null, string instructions = null, IEnumerable tools = null, DateTimeOffset createdAt = default, DateTimeOffset? expiresAt = null, DateTimeOffset? startedAt = null, DateTimeOffset? completedAt = null, DateTimeOffset? cancelledAt = null, DateTimeOffset? failedAt = null, IncompleteRunDetails incompleteDetails = null, RunCompletionUsage usage = 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, UpdateToolResourcesOptions toolResources = null, bool parallelToolCalls = default)
+ {
+ tools ??= new List();
+ metadata ??= new Dictionary();
+
+ return new ThreadRun(
+ id,
+ @object,
+ threadId,
+ assistantId,
+ 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);
+ }
+
+ /// Initializes a new instance of .
+ /// The object type for the required tool call.
+ /// The ID of the tool call. This ID must be referenced when submitting tool outputs.
+ /// A new instance for mocking.
+ public static RequiredToolCall RequiredToolCall(string type = null, string id = null)
+ {
+ return new UnknownRequiredToolCall(type, id, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The status for the error.
+ /// The human-readable text associated with the error.
+ /// A new instance for mocking.
+ public static RunError RunError(string code = null, string message = null)
+ {
+ return new RunError(code, message, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run.
+ /// A new instance for mocking.
+ public static IncompleteRunDetails IncompleteRunDetails(IncompleteDetailsReason reason = default)
+ {
+ return new IncompleteRunDetails(reason, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Number of completion tokens used over the course of the run.
+ /// Number of prompt tokens used over the course of the run.
+ /// Total number of tokens used (prompt + completion).
+ /// A new instance for mocking.
+ public static RunCompletionUsage RunCompletionUsage(long completionTokens = default, long promptTokens = default, long totalTokens = default)
+ {
+ return new RunCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread.run.step'.
+ /// The type of run step, which can be either message_creation or tool_calls.
+ /// The ID of the assistant associated with the run step.
+ /// The ID of the thread that was run.
+ /// The ID of the run that this run step is a part of.
+ /// The status of this run step.
+ ///
+ /// The 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 .
+ ///
+ /// If applicable, information about the last error encountered by this run step.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The Unix timestamp, in seconds, representing when this item expired.
+ /// The Unix timestamp, in seconds, representing when this completed.
+ /// The Unix timestamp, in seconds, representing when this was cancelled.
+ /// The Unix timestamp, in seconds, representing when this failed.
+ /// Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.
+ /// 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.
+ /// A new instance for mocking.
+ public static RunStep RunStep(string id = null, RunStepObject @object = default, RunStepType type = default, string assistantId = null, string threadId = null, string runId = null, RunStepStatus status = default, RunStepDetails stepDetails = null, RunStepError lastError = null, DateTimeOffset createdAt = default, DateTimeOffset? expiredAt = null, DateTimeOffset? completedAt = null, DateTimeOffset? cancelledAt = null, DateTimeOffset? failedAt = null, RunStepCompletionUsage usage = null, IReadOnlyDictionary metadata = null)
+ {
+ metadata ??= new Dictionary();
+
+ return new RunStep(
+ id,
+ @object,
+ type,
+ assistantId,
+ threadId,
+ runId,
+ status,
+ stepDetails,
+ lastError,
+ createdAt,
+ expiredAt,
+ completedAt,
+ cancelledAt,
+ failedAt,
+ usage,
+ metadata,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Information about the message creation associated with this run step.
+ /// A new instance for mocking.
+ public static RunStepMessageCreationDetails RunStepMessageCreationDetails(RunStepMessageCreationReference messageCreation = null)
+ {
+ return new RunStepMessageCreationDetails(RunStepType.MessageCreation, serializedAdditionalRawData: null, messageCreation);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the message created by this run step.
+ /// A new instance for mocking.
+ public static RunStepMessageCreationReference RunStepMessageCreationReference(string messageId = null)
+ {
+ return new RunStepMessageCreationReference(messageId, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// 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 .
+ ///
+ /// A new instance for mocking.
+ public static RunStepToolCallDetails RunStepToolCallDetails(IEnumerable toolCalls = null)
+ {
+ toolCalls ??= new List();
+
+ return new RunStepToolCallDetails(RunStepType.ToolCalls, serializedAdditionalRawData: null, toolCalls?.ToList());
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// A new instance for mocking.
+ public static RunStepToolCall RunStepToolCall(string type = null, string id = null)
+ {
+ return new UnknownRunStepToolCall(type, id, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// For now, this is always going to be an empty object.
+ /// A new instance for mocking.
+ public static RunStepFileSearchToolCall RunStepFileSearchToolCall(string id = null, RunStepFileSearchToolCallResults fileSearch = null)
+ {
+ return new RunStepFileSearchToolCall("file_search", id, serializedAdditionalRawData: null, fileSearch);
+ }
+
+ /// Initializes a new instance of .
+ /// Ranking options for file search.
+ /// The array of a file search results.
+ /// A new instance for mocking.
+ public static RunStepFileSearchToolCallResults RunStepFileSearchToolCallResults(FileSearchRankingOptions rankingOptions = null, IEnumerable results = null)
+ {
+ results ??= new List();
+
+ return new RunStepFileSearchToolCallResults(rankingOptions, results?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the file that result was found in.
+ /// The name of the file that result was found in.
+ /// The score of the result. All values must be a floating point number between 0 and 1.
+ /// The content of the result that was found. The content is only included if requested via the include query parameter.
+ /// A new instance for mocking.
+ public static RunStepFileSearchToolCallResult RunStepFileSearchToolCallResult(string fileId = null, string fileName = null, float score = default, IEnumerable content = null)
+ {
+ content ??= new List();
+
+ return new RunStepFileSearchToolCallResult(fileId, fileName, score, content?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The type of the content.
+ /// The text content of the file.
+ /// A new instance for mocking.
+ public static FileSearchToolCallContent FileSearchToolCallContent(FileSearchToolCallContentType type = default, string text = null)
+ {
+ return new FileSearchToolCallContent(type, text, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// Reserved for future use.
+ /// A new instance for mocking.
+ public static RunStepBingGroundingToolCall RunStepBingGroundingToolCall(string id = null, IReadOnlyDictionary bingGrounding = null)
+ {
+ bingGrounding ??= new Dictionary();
+
+ return new RunStepBingGroundingToolCall("bing_grounding", id, serializedAdditionalRawData: null, bingGrounding);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// Reserved for future use.
+ /// A new instance for mocking.
+ public static RunStepAzureAISearchToolCall RunStepAzureAISearchToolCall(string id = null, IReadOnlyDictionary azureAISearch = null)
+ {
+ azureAISearch ??= new Dictionary();
+
+ return new RunStepAzureAISearchToolCall("azure_ai_search", id, serializedAdditionalRawData: null, azureAISearch);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// Reserved for future use.
+ /// A new instance for mocking.
+ public static RunStepSharepointToolCall RunStepSharepointToolCall(string id = null, IReadOnlyDictionary sharePoint = null)
+ {
+ sharePoint ??= new Dictionary();
+
+ return new RunStepSharepointToolCall("sharepoint_grounding", id, serializedAdditionalRawData: null, sharePoint);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// Reserved for future use.
+ /// A new instance for mocking.
+ public static RunStepMicrosoftFabricToolCall RunStepMicrosoftFabricToolCall(string id = null, IReadOnlyDictionary microsoftFabric = null)
+ {
+ microsoftFabric ??= new Dictionary();
+
+ return new RunStepMicrosoftFabricToolCall("fabric_dataagent", id, serializedAdditionalRawData: null, microsoftFabric);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// Reserved for future use.
+ /// A new instance for mocking.
+ public static RunStepCustomSearchToolCall RunStepCustomSearchToolCall(string id = null, IReadOnlyDictionary bingCustomSearch = null)
+ {
+ bingCustomSearch ??= new Dictionary();
+
+ return new RunStepCustomSearchToolCall("bing_custom_search", id, serializedAdditionalRawData: null, bingCustomSearch);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// Reserved for future use.
+ /// A new instance for mocking.
+ public static RunStepOpenAPIToolCall RunStepOpenAPIToolCall(string id = null, IReadOnlyDictionary openAPI = null)
+ {
+ openAPI ??= new Dictionary();
+
+ return new RunStepOpenAPIToolCall("openapi", id, serializedAdditionalRawData: null, openAPI);
+ }
+
+ /// Initializes a new instance of .
+ /// The error code for this error.
+ /// The human-readable text associated with this error.
+ /// A new instance for mocking.
+ public static RunStepError RunStepError(RunStepErrorCode code = default, string message = null)
+ {
+ return new RunStepError(code, message, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Number of completion tokens used over the course of the run step.
+ /// Number of prompt tokens used over the course of the run step.
+ /// Total number of tokens used (prompt + completion).
+ /// A new instance for mocking.
+ public static RunStepCompletionUsage RunStepCompletionUsage(long completionTokens = default, long promptTokens = default, long totalTokens = default)
+ {
+ return new RunStepCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The object type, which is always 'file'.
+ /// The identifier, which can be referenced in API endpoints.
+ /// The size of the file, in bytes.
+ /// The name of the file.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The intended purpose of a file.
+ /// The state of the file. This field is available in Azure OpenAI only.
+ /// The error message with details in case processing of this file failed. This field is available in Azure OpenAI only.
+ /// A new instance for mocking.
+ public static OpenAIFile OpenAIFile(OpenAIFileObject @object = default, string id = null, int size = default, string filename = null, DateTimeOffset createdAt = default, OpenAIFilePurpose purpose = default, FileState? status = null, string statusDetails = null)
+ {
+ return new OpenAIFile(
+ @object,
+ id,
+ size,
+ filename,
+ createdAt,
+ purpose,
+ status,
+ statusDetails,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The file data, in bytes.
+ /// The intended purpose of the uploaded file. Use `assistants` for Assistants and Message files, `vision` for Assistants image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning.
+ /// The name of the file.
+ /// A new instance for mocking.
+ public static UploadFileRequest UploadFileRequest(File data = null, OpenAIFilePurpose purpose = default, string filename = null)
+ {
+ return new UploadFileRequest(data, purpose, filename, serializedAdditionalRawData: null);
+ }
+
+ /// 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.
+ ///
+ /// A new instance for mocking.
+ public static File File(string contentType = null, string filename = null, BinaryData contents = null)
+ {
+ return new File(contentType, filename, contents, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The object type, which is always list.
+ /// The requested list of items.
+ /// The first ID represented in this list.
+ /// The last ID represented in this list.
+ /// A value indicating whether there are additional values available not captured in this list.
+ /// A new instance for mocking.
+ public static OpenAIPageableListOfVectorStore OpenAIPageableListOfVectorStore(OpenAIPageableListOfVectorStoreObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfVectorStore(
+ @object,
+ data?.ToList(),
+ firstId,
+ lastId,
+ hasMore,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always `vector_store`.
+ /// The Unix timestamp (in seconds) for when the vector store was created.
+ /// The name of the vector store.
+ /// The total number of bytes used by the files in the vector store.
+ /// Files count grouped by status processed or being processed by this vector store.
+ /// The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
+ /// Details on when this vector store expires.
+ /// The Unix timestamp (in seconds) for when the vector store will expire.
+ /// The Unix timestamp (in seconds) for when the vector store was last active.
+ /// 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.
+ /// A new instance for mocking.
+ public static VectorStore VectorStore(string id = null, VectorStoreObject @object = default, DateTimeOffset createdAt = default, string name = null, int usageBytes = default, VectorStoreFileCount fileCounts = null, VectorStoreStatus status = default, VectorStoreExpirationPolicy expiresAfter = null, DateTimeOffset? expiresAt = null, DateTimeOffset? lastActiveAt = null, IReadOnlyDictionary metadata = null)
+ {
+ metadata ??= new Dictionary();
+
+ return new VectorStore(
+ id,
+ @object,
+ createdAt,
+ name,
+ usageBytes,
+ fileCounts,
+ status,
+ expiresAfter,
+ expiresAt,
+ lastActiveAt,
+ metadata,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The number of files that are currently being processed.
+ /// The number of files that have been successfully processed.
+ /// The number of files that have failed to process.
+ /// The number of files that were cancelled.
+ /// The total number of files.
+ /// A new instance for mocking.
+ public static VectorStoreFileCount VectorStoreFileCount(int inProgress = default, int completed = default, int failed = default, int cancelled = default, int total = default)
+ {
+ return new VectorStoreFileCount(
+ inProgress,
+ completed,
+ failed,
+ cancelled,
+ total,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The options for the static chunking strategy.
+ /// A new instance for mocking.
+ public static VectorStoreStaticChunkingStrategyRequest VectorStoreStaticChunkingStrategyRequest(VectorStoreStaticChunkingStrategyOptions @static = null)
+ {
+ return new VectorStoreStaticChunkingStrategyRequest(VectorStoreChunkingStrategyRequestType.Static, serializedAdditionalRawData: null, @static);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the resource specified for deletion.
+ /// A value indicating whether deletion was successful.
+ /// The object type, which is always 'vector_store.deleted'.
+ /// A new instance for mocking.
+ public static VectorStoreDeletionStatus VectorStoreDeletionStatus(string id = null, bool deleted = default, VectorStoreDeletionStatusObject @object = default)
+ {
+ return new VectorStoreDeletionStatus(id, deleted, @object, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The object type, which is always list.
+ /// The requested list of items.
+ /// The first ID represented in this list.
+ /// The last ID represented in this list.
+ /// A value indicating whether there are additional values available not captured in this list.
+ /// A new instance for mocking.
+ public static OpenAIPageableListOfVectorStoreFile OpenAIPageableListOfVectorStoreFile(OpenAIPageableListOfVectorStoreFileObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfVectorStoreFile(
+ @object,
+ data?.ToList(),
+ firstId,
+ lastId,
+ hasMore,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always `vector_store.file`.
+ ///
+ /// The total vector store usage in bytes. Note that this may be different from the original file
+ /// size.
+ ///
+ /// The Unix timestamp (in seconds) for when the vector store file was created.
+ /// The ID of the vector store that the file is attached to.
+ /// The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
+ /// The last error associated with this vector store file. Will be `null` if there are no errors.
+ ///
+ /// The strategy used to chunk the file.
+ /// 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 .
+ ///
+ /// A new instance for mocking.
+ public static VectorStoreFile VectorStoreFile(string id = null, VectorStoreFileObject @object = default, int usageBytes = default, DateTimeOffset createdAt = default, string vectorStoreId = null, VectorStoreFileStatus status = default, VectorStoreFileError lastError = null, VectorStoreChunkingStrategyResponse chunkingStrategy = null)
+ {
+ return new VectorStoreFile(
+ id,
+ @object,
+ usageBytes,
+ createdAt,
+ vectorStoreId,
+ status,
+ lastError,
+ chunkingStrategy,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// One of `server_error` or `rate_limit_exceeded`.
+ /// A human-readable description of the error.
+ /// A new instance for mocking.
+ public static VectorStoreFileError VectorStoreFileError(VectorStoreFileErrorCode code = default, string message = null)
+ {
+ return new VectorStoreFileError(code, message, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The options for the static chunking strategy.
+ /// A new instance for mocking.
+ public static VectorStoreStaticChunkingStrategyResponse VectorStoreStaticChunkingStrategyResponse(VectorStoreStaticChunkingStrategyOptions @static = null)
+ {
+ return new VectorStoreStaticChunkingStrategyResponse(VectorStoreChunkingStrategyResponseType.Static, serializedAdditionalRawData: null, @static);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the resource specified for deletion.
+ /// A value indicating whether deletion was successful.
+ /// The object type, which is always 'vector_store.deleted'.
+ /// A new instance for mocking.
+ public static VectorStoreFileDeletionStatus VectorStoreFileDeletionStatus(string id = null, bool deleted = default, VectorStoreFileDeletionStatusObject @object = default)
+ {
+ return new VectorStoreFileDeletionStatus(id, deleted, @object, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always `vector_store.file_batch`.
+ /// The Unix timestamp (in seconds) for when the vector store files batch was created.
+ /// The ID of the vector store that the file is attached to.
+ /// The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
+ /// Files count grouped by status processed or being processed by this vector store.
+ /// A new instance for mocking.
+ public static VectorStoreFileBatch VectorStoreFileBatch(string id = null, VectorStoreFileBatchObject @object = default, DateTimeOffset createdAt = default, string vectorStoreId = null, VectorStoreFileBatchStatus status = default, VectorStoreFileCount fileCounts = null)
+ {
+ return new VectorStoreFileBatch(
+ id,
+ @object,
+ createdAt,
+ vectorStoreId,
+ status,
+ fileCounts,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier of the message, which can be referenced in API endpoints.
+ /// The object type, which is always `thread.message.delta`.
+ /// The delta containing the fields that have changed on the Message.
+ /// A new instance for mocking.
+ public static MessageDeltaChunk MessageDeltaChunk(string id = null, MessageDeltaChunkObject @object = default, MessageDelta delta = null)
+ {
+ return new MessageDeltaChunk(id, @object, delta, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The entity that produced the message.
+ ///
+ /// The content of the message as an array of text and/or images.
+ /// 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 .
+ ///
+ /// A new instance for mocking.
+ public static MessageDelta MessageDelta(MessageRole role = default, IEnumerable content = null)
+ {
+ content ??= new List();
+
+ return new MessageDelta(role, content?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the content part of the message.
+ /// The type of content for this content part.
+ /// A new instance for mocking.
+ public static MessageDeltaContent MessageDeltaContent(int index = default, string type = null)
+ {
+ return new UnknownMessageDeltaContent(index, type, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the content part of the message.
+ /// The image_file data.
+ /// A new instance for mocking.
+ public static MessageDeltaImageFileContent MessageDeltaImageFileContent(int index = default, MessageDeltaImageFileContentObject imageFile = null)
+ {
+ return new MessageDeltaImageFileContent(index, "image_file", serializedAdditionalRawData: null, imageFile);
+ }
+
+ /// Initializes a new instance of .
+ /// The file ID of the image in the message content.
+ /// A new instance for mocking.
+ public static MessageDeltaImageFileContentObject MessageDeltaImageFileContentObject(string fileId = null)
+ {
+ return new MessageDeltaImageFileContentObject(fileId, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the content part of the message.
+ /// The text content details.
+ /// A new instance for mocking.
+ public static MessageDeltaTextContent MessageDeltaTextContent(int index = default, MessageDeltaTextContentObject text = null)
+ {
+ return new MessageDeltaTextContent(index, "text", serializedAdditionalRawData: null, text);
+ }
+
+ /// Initializes a new instance of .
+ /// The data that makes up the text.
+ ///
+ /// Annotations for the text.
+ /// 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 .
+ ///
+ /// A new instance for mocking.
+ public static MessageDeltaTextContentObject MessageDeltaTextContentObject(string value = null, IEnumerable annotations = null)
+ {
+ annotations ??= new List();
+
+ return new MessageDeltaTextContentObject(value, annotations?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the annotation within a text content part.
+ /// The type of the text content annotation.
+ /// A new instance for mocking.
+ public static MessageDeltaTextAnnotation MessageDeltaTextAnnotation(int index = default, string type = null)
+ {
+ return new UnknownMessageDeltaTextAnnotation(index, type, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the annotation within a text content part.
+ /// The details of the URL citation.
+ /// The first text index associated with this text annotation.
+ /// The last text index associated with this text annotation.
+ /// A new instance for mocking.
+ public static MessageDeltaTextUrlCitationAnnotation MessageDeltaTextUrlCitationAnnotation(int index = default, MessageDeltaTextUrlCitationDetails urlCitation = null, int? startIndex = null, int? endIndex = null)
+ {
+ return new MessageDeltaTextUrlCitationAnnotation(
+ index,
+ "url_citation",
+ serializedAdditionalRawData: null,
+ urlCitation,
+ startIndex,
+ endIndex);
+ }
+
+ /// Initializes a new instance of .
+ /// The URL associated with this citation.
+ /// The title of the URL.
+ /// A new instance for mocking.
+ public static MessageDeltaTextUrlCitationDetails MessageDeltaTextUrlCitationDetails(string url = null, string title = null)
+ {
+ return new MessageDeltaTextUrlCitationDetails(url, title, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the annotation within a text content part.
+ /// The file citation information.
+ /// The text in the message content that needs to be replaced.
+ /// The start index of this annotation in the content text.
+ /// The end index of this annotation in the content text.
+ /// A new instance for mocking.
+ public static MessageDeltaTextFileCitationAnnotation MessageDeltaTextFileCitationAnnotation(int index = default, MessageDeltaTextFileCitationAnnotationObject fileCitation = null, string text = null, int? startIndex = null, int? endIndex = null)
+ {
+ return new MessageDeltaTextFileCitationAnnotation(
+ index,
+ "file_citation",
+ serializedAdditionalRawData: null,
+ fileCitation,
+ text,
+ startIndex,
+ endIndex);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the specific file the citation is from.
+ /// The specific quote in the cited file.
+ /// A new instance for mocking.
+ public static MessageDeltaTextFileCitationAnnotationObject MessageDeltaTextFileCitationAnnotationObject(string fileId = null, string quote = null)
+ {
+ return new MessageDeltaTextFileCitationAnnotationObject(fileId, quote, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the annotation within a text content part.
+ /// The file path information.
+ /// The start index of this annotation in the content text.
+ /// The end index of this annotation in the content text.
+ /// The text in the message content that needs to be replaced.
+ /// A new instance for mocking.
+ public static MessageDeltaTextFilePathAnnotation MessageDeltaTextFilePathAnnotation(int index = default, MessageDeltaTextFilePathAnnotationObject filePath = null, int? startIndex = null, int? endIndex = null, string text = null)
+ {
+ return new MessageDeltaTextFilePathAnnotation(
+ index,
+ "file_path",
+ serializedAdditionalRawData: null,
+ filePath,
+ startIndex,
+ endIndex,
+ text);
+ }
+
+ /// Initializes a new instance of .
+ /// The file ID for the annotation.
+ /// A new instance for mocking.
+ public static MessageDeltaTextFilePathAnnotationObject MessageDeltaTextFilePathAnnotationObject(string fileId = null)
+ {
+ return new MessageDeltaTextFilePathAnnotationObject(fileId, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier of the run step, which can be referenced in API endpoints.
+ /// The object type, which is always `thread.run.step.delta`.
+ /// The delta containing the fields that have changed on the run step.
+ /// A new instance for mocking.
+ public static RunStepDeltaChunk RunStepDeltaChunk(string id = null, RunStepDeltaChunkObject @object = default, RunStepDelta delta = null)
+ {
+ return new RunStepDeltaChunk(id, @object, delta, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// The details of the 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 .
+ ///
+ /// A new instance for mocking.
+ public static RunStepDelta RunStepDelta(RunStepDeltaDetail stepDetails = null)
+ {
+ return new RunStepDelta(stepDetails, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The message creation data.
+ /// A new instance for mocking.
+ public static RunStepDeltaMessageCreation RunStepDeltaMessageCreation(RunStepDeltaMessageCreationObject messageCreation = null)
+ {
+ return new RunStepDeltaMessageCreation("message_creation", serializedAdditionalRawData: null, messageCreation);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the newly-created message.
+ /// A new instance for mocking.
+ public static RunStepDeltaMessageCreationObject RunStepDeltaMessageCreationObject(string messageId = null)
+ {
+ return new RunStepDeltaMessageCreationObject(messageId, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// The collection of tool calls for the tool call detail item.
+ /// 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 .
+ ///
+ /// A new instance for mocking.
+ public static RunStepDeltaToolCallObject RunStepDeltaToolCallObject(IEnumerable toolCalls = null)
+ {
+ toolCalls ??= new List();
+
+ return new RunStepDeltaToolCallObject("tool_calls", serializedAdditionalRawData: null, toolCalls?.ToList());
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the tool call detail in the run step's tool_calls array.
+ /// The ID of the tool call, used when submitting outputs to the run.
+ /// The type of the tool call detail item in a streaming run step's details.
+ /// A new instance for mocking.
+ public static RunStepDeltaToolCall RunStepDeltaToolCall(int index = default, string id = null, string type = null)
+ {
+ return new UnknownRunStepDeltaToolCall(index, id, type, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the tool call detail in the run step's tool_calls array.
+ /// The ID of the tool call, used when submitting outputs to the run.
+ /// The function data for the tool call.
+ /// A new instance for mocking.
+ public static RunStepDeltaFunctionToolCall RunStepDeltaFunctionToolCall(int index = default, string id = null, RunStepDeltaFunction function = null)
+ {
+ return new RunStepDeltaFunctionToolCall(index, id, "function", serializedAdditionalRawData: null, function);
+ }
+
+ /// Initializes a new instance of .
+ /// The name of the function.
+ /// The arguments passed to the function as input.
+ /// The output of the function, null if outputs have not yet been submitted.
+ /// A new instance for mocking.
+ public static RunStepDeltaFunction RunStepDeltaFunction(string name = null, string arguments = null, string output = null)
+ {
+ return new RunStepDeltaFunction(name, arguments, output, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the tool call detail in the run step's tool_calls array.
+ /// The ID of the tool call, used when submitting outputs to the run.
+ /// Reserved for future use.
+ /// A new instance for mocking.
+ public static RunStepDeltaFileSearchToolCall RunStepDeltaFileSearchToolCall(int index = default, string id = null, RunStepFileSearchToolCallResults fileSearch = null)
+ {
+ return new RunStepDeltaFileSearchToolCall(index, id, "file_search", serializedAdditionalRawData: null, fileSearch);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the tool call detail in the run step's tool_calls array.
+ /// The ID of the tool call, used when submitting outputs to the run.
+ /// The Code Interpreter data for the tool call.
+ /// A new instance for mocking.
+ public static RunStepDeltaCodeInterpreterToolCall RunStepDeltaCodeInterpreterToolCall(int index = default, string id = null, RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter = null)
+ {
+ return new RunStepDeltaCodeInterpreterToolCall(index, id, "code_interpreter", serializedAdditionalRawData: null, codeInterpreter);
+ }
+
+ /// Initializes a new instance of .
+ /// The input into the Code Interpreter tool call.
+ ///
+ /// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more
+ /// items, including text (`logs`) or images (`image`). Each of these are represented by a
+ /// different object type.
+ /// 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 .
+ ///
+ /// A new instance for mocking.
+ public static RunStepDeltaCodeInterpreterDetailItemObject RunStepDeltaCodeInterpreterDetailItemObject(string input = null, IEnumerable outputs = null)
+ {
+ outputs ??= new List();
+
+ return new RunStepDeltaCodeInterpreterDetailItemObject(input, outputs?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the output in the streaming run step tool call's Code Interpreter outputs array.
+ /// The type of the streaming run step tool call's Code Interpreter output.
+ /// A new instance for mocking.
+ public static RunStepDeltaCodeInterpreterOutput RunStepDeltaCodeInterpreterOutput(int index = default, string type = null)
+ {
+ return new UnknownRunStepDeltaCodeInterpreterOutput(index, type, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the output in the streaming run step tool call's Code Interpreter outputs array.
+ /// The text output from the Code Interpreter tool call.
+ /// A new instance for mocking.
+ public static RunStepDeltaCodeInterpreterLogOutput RunStepDeltaCodeInterpreterLogOutput(int index = default, string logs = null)
+ {
+ return new RunStepDeltaCodeInterpreterLogOutput(index, "logs", serializedAdditionalRawData: null, logs);
+ }
+
+ /// Initializes a new instance of .
+ /// The index of the output in the streaming run step tool call's Code Interpreter outputs array.
+ /// The image data for the Code Interpreter tool call output.
+ /// A new instance for mocking.
+ public static RunStepDeltaCodeInterpreterImageOutput RunStepDeltaCodeInterpreterImageOutput(int index = default, RunStepDeltaCodeInterpreterImageOutputObject image = null)
+ {
+ return new RunStepDeltaCodeInterpreterImageOutput(index, "image", serializedAdditionalRawData: null, image);
+ }
+
+ /// Initializes a new instance of .
+ /// The file ID for the image.
+ /// A new instance for mocking.
+ public static RunStepDeltaCodeInterpreterImageOutputObject RunStepDeltaCodeInterpreterImageOutputObject(string fileId = null)
+ {
+ return new RunStepDeltaCodeInterpreterImageOutputObject(fileId, serializedAdditionalRawData: null);
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.Serialization.cs
new file mode 100644
index 000000000000..70ace5bf3e5b
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.Serialization.cs
@@ -0,0 +1,197 @@
+// 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.Assistants
+{
+ public partial class AISearchIndexResource : 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(AISearchIndexResource)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("index_connection_id"u8);
+ writer.WriteStringValue(IndexConnectionId);
+ writer.WritePropertyName("index_name"u8);
+ writer.WriteStringValue(IndexName);
+ if (Optional.IsDefined(QueryType))
+ {
+ writer.WritePropertyName("query_type"u8);
+ writer.WriteStringValue(QueryType.Value.ToString());
+ }
+ if (Optional.IsDefined(TopK))
+ {
+ writer.WritePropertyName("top_k"u8);
+ writer.WriteNumberValue(TopK.Value);
+ }
+ if (Optional.IsDefined(Filter))
+ {
+ writer.WritePropertyName("filter"u8);
+ writer.WriteStringValue(Filter);
+ }
+ 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
+ }
+ }
+ }
+
+ AISearchIndexResource 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(AISearchIndexResource)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAISearchIndexResource(document.RootElement, options);
+ }
+
+ internal static AISearchIndexResource DeserializeAISearchIndexResource(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string indexConnectionId = default;
+ string indexName = default;
+ AzureAISearchQueryType? queryType = default;
+ int? topK = default;
+ string filter = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("index_connection_id"u8))
+ {
+ indexConnectionId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("index_name"u8))
+ {
+ indexName = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("query_type"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ queryType = new AzureAISearchQueryType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("top_k"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ topK = property.Value.GetInt32();
+ continue;
+ }
+ if (property.NameEquals("filter"u8))
+ {
+ filter = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AISearchIndexResource(
+ indexConnectionId,
+ indexName,
+ queryType,
+ topK,
+ filter,
+ 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(AISearchIndexResource)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AISearchIndexResource 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 DeserializeAISearchIndexResource(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AISearchIndexResource)} 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 AISearchIndexResource FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAISearchIndexResource(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.Assistants/src/Generated/AISearchIndexResource.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.cs
new file mode 100644
index 000000000000..cfbbaf7029a7
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AISearchIndexResource.cs
@@ -0,0 +1,94 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Assistants
+{
+ /// A AI Search Index resource.
+ public partial class AISearchIndexResource
+ {
+ ///
+ /// 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 .
+ /// An index connection id in an IndexResource attached to this assistant.
+ /// The name of an index in an IndexResource attached to this assistant.
+ /// or is null.
+ public AISearchIndexResource(string indexConnectionId, string indexName)
+ {
+ Argument.AssertNotNull(indexConnectionId, nameof(indexConnectionId));
+ Argument.AssertNotNull(indexName, nameof(indexName));
+
+ IndexConnectionId = indexConnectionId;
+ IndexName = indexName;
+ }
+
+ /// Initializes a new instance of .
+ /// An index connection id in an IndexResource attached to this assistant.
+ /// The name of an index in an IndexResource attached to this assistant.
+ /// Type of query in an AIIndexResource attached to this assistant.
+ /// Number of documents to retrieve from search and present to the model.
+ /// Odata filter string for search resource.
+ /// Keeps track of any properties unknown to the library.
+ internal AISearchIndexResource(string indexConnectionId, string indexName, AzureAISearchQueryType? queryType, int? topK, string filter, IDictionary serializedAdditionalRawData)
+ {
+ IndexConnectionId = indexConnectionId;
+ IndexName = indexName;
+ QueryType = queryType;
+ TopK = topK;
+ Filter = filter;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AISearchIndexResource()
+ {
+ }
+
+ /// An index connection id in an IndexResource attached to this assistant.
+ public string IndexConnectionId { get; set; }
+ /// The name of an index in an IndexResource attached to this assistant.
+ public string IndexName { get; set; }
+ /// Type of query in an AIIndexResource attached to this assistant.
+ public AzureAISearchQueryType? QueryType { get; set; }
+ /// Number of documents to retrieve from search and present to the model.
+ public int? TopK { get; set; }
+ /// Odata filter string for search resource.
+ public string Filter { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/Assistant.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Assistant.Serialization.cs
new file mode 100644
index 000000000000..1885dd60828b
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Assistant.Serialization.cs
@@ -0,0 +1,379 @@
+// 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.Assistants
+{
+ public partial class Assistant : 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(Assistant)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("id"u8);
+ writer.WriteStringValue(Id);
+ writer.WritePropertyName("object"u8);
+ writer.WriteStringValue(Object.ToString());
+ writer.WritePropertyName("created_at"u8);
+ writer.WriteNumberValue(CreatedAt, "U");
+ if (Name != null)
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ else
+ {
+ writer.WriteNull("name");
+ }
+ if (Description != null)
+ {
+ writer.WritePropertyName("description"u8);
+ writer.WriteStringValue(Description);
+ }
+ else
+ {
+ writer.WriteNull("description");
+ }
+ writer.WritePropertyName("model"u8);
+ writer.WriteStringValue(Model);
+ if (Instructions != null)
+ {
+ writer.WritePropertyName("instructions"u8);
+ writer.WriteStringValue(Instructions);
+ }
+ else
+ {
+ writer.WriteNull("instructions");
+ }
+ writer.WritePropertyName("tools"u8);
+ writer.WriteStartArray();
+ foreach (var item in Tools)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ if (ToolResources != null)
+ {
+ writer.WritePropertyName("tool_resources"u8);
+ writer.WriteObjectValue(ToolResources, options);
+ }
+ else
+ {
+ writer.WriteNull("tool_resources");
+ }
+ if (Temperature != null)
+ {
+ writer.WritePropertyName("temperature"u8);
+ writer.WriteNumberValue(Temperature.Value);
+ }
+ else
+ {
+ writer.WriteNull("temperature");
+ }
+ if (TopP != null)
+ {
+ writer.WritePropertyName("top_p"u8);
+ writer.WriteNumberValue(TopP.Value);
+ }
+ else
+ {
+ writer.WriteNull("top_p");
+ }
+ if (Optional.IsDefined(ResponseFormat))
+ {
+ if (ResponseFormat != null)
+ {
+ writer.WritePropertyName("response_format"u8);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(ResponseFormat);
+#else
+ using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ else
+ {
+ writer.WriteNull("response_format");
+ }
+ }
+ if (Metadata != null && Optional.IsCollectionDefined(Metadata))
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ 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
+ }
+ }
+ }
+
+ Assistant 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(Assistant)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAssistant(document.RootElement, options);
+ }
+
+ internal static Assistant DeserializeAssistant(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ AssistantObject @object = default;
+ DateTimeOffset createdAt = default;
+ string name = default;
+ string description = default;
+ string model = default;
+ string instructions = default;
+ IReadOnlyList tools = default;
+ ToolResources toolResources = default;
+ float? temperature = default;
+ float? topP = default;
+ BinaryData responseFormat = default;
+ IReadOnlyDictionary metadata = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new AssistantObject(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("created_at"u8))
+ {
+ createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64());
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ name = null;
+ continue;
+ }
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("description"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ description = null;
+ continue;
+ }
+ description = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("model"u8))
+ {
+ model = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("instructions"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ instructions = null;
+ continue;
+ }
+ instructions = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("tools"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(ToolDefinition.DeserializeToolDefinition(item, options));
+ }
+ tools = array;
+ continue;
+ }
+ if (property.NameEquals("tool_resources"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ toolResources = null;
+ continue;
+ }
+ toolResources = ToolResources.DeserializeToolResources(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("temperature"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ temperature = null;
+ continue;
+ }
+ temperature = property.Value.GetSingle();
+ continue;
+ }
+ if (property.NameEquals("top_p"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ topP = null;
+ continue;
+ }
+ topP = property.Value.GetSingle();
+ continue;
+ }
+ if (property.NameEquals("response_format"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ responseFormat = null;
+ continue;
+ }
+ responseFormat = BinaryData.FromString(property.Value.GetRawText());
+ continue;
+ }
+ if (property.NameEquals("metadata"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ metadata = new ChangeTrackingDictionary();
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ metadata = dictionary;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Assistant(
+ id,
+ @object,
+ createdAt,
+ name,
+ description,
+ model,
+ instructions,
+ tools,
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata,
+ 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(Assistant)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Assistant 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 DeserializeAssistant(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Assistant)} 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 Assistant FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAssistant(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.Assistants/src/Generated/Assistant.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/Assistant.cs
new file mode 100644
index 000000000000..c9b90557be92
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/Assistant.cs
@@ -0,0 +1,238 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Azure.AI.Assistants
+{
+ /// Represents an assistant that can call the model and use tools.
+ public partial class Assistant
+ {
+ ///
+ /// 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 identifier, which can be referenced in API endpoints.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The name of the assistant.
+ /// The description of the assistant.
+ /// The ID of the model to use.
+ /// The system instructions for the assistant to use.
+ ///
+ /// The collection of tools enabled for the assistant.
+ /// 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 .
+ ///
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ /// 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.
+ /// , or is null.
+ internal Assistant(string id, DateTimeOffset createdAt, string name, string description, string model, string instructions, IEnumerable tools, ToolResources toolResources, float? temperature, float? topP, IReadOnlyDictionary metadata)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(model, nameof(model));
+ Argument.AssertNotNull(tools, nameof(tools));
+
+ Id = id;
+ CreatedAt = createdAt;
+ Name = name;
+ Description = description;
+ Model = model;
+ Instructions = instructions;
+ Tools = tools.ToList();
+ ToolResources = toolResources;
+ Temperature = temperature;
+ TopP = topP;
+ Metadata = metadata;
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always assistant.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The name of the assistant.
+ /// The description of the assistant.
+ /// The ID of the model to use.
+ /// The system instructions for the assistant to use.
+ ///
+ /// The collection of tools enabled for the assistant.
+ /// 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 .
+ ///
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ /// The response format of the tool calls used by this assistant.
+ /// 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 Assistant(string id, AssistantObject @object, DateTimeOffset createdAt, string name, string description, string model, string instructions, IReadOnlyList tools, ToolResources toolResources, float? temperature, float? topP, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData)
+ {
+ Id = id;
+ Object = @object;
+ CreatedAt = createdAt;
+ Name = name;
+ Description = description;
+ Model = model;
+ Instructions = instructions;
+ Tools = tools;
+ ToolResources = toolResources;
+ Temperature = temperature;
+ TopP = topP;
+ ResponseFormat = responseFormat;
+ Metadata = metadata;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal Assistant()
+ {
+ }
+
+ /// The identifier, which can be referenced in API endpoints.
+ public string Id { get; }
+ /// The object type, which is always assistant.
+ public AssistantObject Object { get; } = AssistantObject.Assistant;
+
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ public DateTimeOffset CreatedAt { get; }
+ /// The name of the assistant.
+ public string Name { get; }
+ /// The description of the assistant.
+ public string Description { get; }
+ /// The ID of the model to use.
+ public string Model { get; }
+ /// The system instructions for the assistant to use.
+ public string Instructions { get; }
+ ///
+ /// The collection of tools enabled for the assistant.
+ /// 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 IReadOnlyList Tools { get; }
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ public ToolResources ToolResources { get; }
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ public float? Temperature { get; }
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ public float? TopP { get; }
+ ///
+ /// The response format of the tool calls used by this assistant.
+ ///
+ /// To assign an object to this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ ///
+ /// Supported types:
+ ///
+ /// -
+ ///
+ ///
+ /// -
+ ///
+ ///
+ /// -
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// 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 ResponseFormat { 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.Assistants/src/Generated/AssistantObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantObject.cs
new file mode 100644
index 000000000000..38735abe3db1
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantObject.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.Assistants
+{
+ /// The Assistant_object.
+ public readonly partial struct AssistantObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string AssistantValue = "assistant";
+
+ /// assistant.
+ public static AssistantObject Assistant { get; } = new AssistantObject(AssistantValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantObject left, AssistantObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantObject left, AssistantObject right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AssistantObject(string value) => new AssistantObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantObject other && Equals(other);
+ ///
+ public bool Equals(AssistantObject 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.Assistants/src/Generated/AssistantStreamEvent.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantStreamEvent.cs
new file mode 100644
index 000000000000..d08704acaa25
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantStreamEvent.cs
@@ -0,0 +1,137 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.AI.Assistants
+{
+ ///
+ /// Each event in a server-sent events stream has an `event` and `data` property:
+ ///
+ /// ```
+ /// event: thread.created
+ /// data: {"id": "thread_123", "object": "thread", ...}
+ /// ```
+ ///
+ /// We emit events whenever a new object is created, transitions to a new state, or is being
+ /// streamed in parts (deltas). For example, we emit `thread.run.created` when a new run
+ /// is created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses
+ /// to create a message during a run, we emit a `thread.message.created event`, a
+ /// `thread.message.in_progress` event, many `thread.message.delta` events, and finally a
+ /// `thread.message.completed` event.
+ ///
+ /// We may add additional events over time, so we recommend handling unknown events gracefully
+ /// in your code.
+ ///
+ public readonly partial struct AssistantStreamEvent : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantStreamEvent(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string ThreadCreatedValue = "thread.created";
+ private const string ThreadRunCreatedValue = "thread.run.created";
+ private const string ThreadRunQueuedValue = "thread.run.queued";
+ private const string ThreadRunInProgressValue = "thread.run.in_progress";
+ private const string ThreadRunRequiresActionValue = "thread.run.requires_action";
+ private const string ThreadRunCompletedValue = "thread.run.completed";
+ private const string ThreadRunIncompleteValue = "thread.run.incomplete";
+ private const string ThreadRunFailedValue = "thread.run.failed";
+ private const string ThreadRunCancellingValue = "thread.run.cancelling";
+ private const string ThreadRunCancelledValue = "thread.run.cancelled";
+ private const string ThreadRunExpiredValue = "thread.run.expired";
+ private const string ThreadRunStepCreatedValue = "thread.run.step.created";
+ private const string ThreadRunStepInProgressValue = "thread.run.step.in_progress";
+ private const string ThreadRunStepDeltaValue = "thread.run.step.delta";
+ private const string ThreadRunStepCompletedValue = "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 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 ErrorValue = "error";
+ private const string DoneValue = "done";
+
+ /// Event sent when a new thread is created. The data of this event is of type AssistantThread.
+ public static AssistantStreamEvent ThreadCreated { get; } = new AssistantStreamEvent(ThreadCreatedValue);
+ /// Event sent when a new run is created. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunCreated { get; } = new AssistantStreamEvent(ThreadRunCreatedValue);
+ /// Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunQueued { get; } = new AssistantStreamEvent(ThreadRunQueuedValue);
+ /// Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunInProgress { get; } = new AssistantStreamEvent(ThreadRunInProgressValue);
+ /// Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunRequiresAction { get; } = new AssistantStreamEvent(ThreadRunRequiresActionValue);
+ /// Event sent when a run is completed. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunCompleted { get; } = new AssistantStreamEvent(ThreadRunCompletedValue);
+ /// Event sent when a run ends incomplete. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunIncomplete { get; } = new AssistantStreamEvent(ThreadRunIncompleteValue);
+ /// Event sent when a run fails. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunFailed { get; } = new AssistantStreamEvent(ThreadRunFailedValue);
+ /// Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunCancelling { get; } = new AssistantStreamEvent(ThreadRunCancellingValue);
+ /// Event sent when a run is cancelled. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunCancelled { get; } = new AssistantStreamEvent(ThreadRunCancelledValue);
+ /// Event sent when a run is expired. The data of this event is of type ThreadRun.
+ public static AssistantStreamEvent ThreadRunExpired { get; } = new AssistantStreamEvent(ThreadRunExpiredValue);
+ /// Event sent when a new thread run step is created. The data of this event is of type RunStep.
+ public static AssistantStreamEvent ThreadRunStepCreated { get; } = new AssistantStreamEvent(ThreadRunStepCreatedValue);
+ /// Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep.
+ public static AssistantStreamEvent ThreadRunStepInProgress { get; } = new AssistantStreamEvent(ThreadRunStepInProgressValue);
+ /// Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk.
+ public static AssistantStreamEvent ThreadRunStepDelta { get; } = new AssistantStreamEvent(ThreadRunStepDeltaValue);
+ /// Event sent when a run step is completed. The data of this event is of type RunStep.
+ public static AssistantStreamEvent ThreadRunStepCompleted { get; } = new AssistantStreamEvent(ThreadRunStepCompletedValue);
+ /// Event sent when a run step fails. The data of this event is of type RunStep.
+ public static AssistantStreamEvent ThreadRunStepFailed { get; } = new AssistantStreamEvent(ThreadRunStepFailedValue);
+ /// Event sent when a run step is cancelled. The data of this event is of type RunStep.
+ public static AssistantStreamEvent ThreadRunStepCancelled { get; } = new AssistantStreamEvent(ThreadRunStepCancelledValue);
+ /// Event sent when a run step is expired. The data of this event is of type RunStep.
+ public static AssistantStreamEvent ThreadRunStepExpired { get; } = new AssistantStreamEvent(ThreadRunStepExpiredValue);
+ /// Event sent when a new message is created. The data of this event is of type ThreadMessage.
+ public static AssistantStreamEvent ThreadMessageCreated { get; } = new AssistantStreamEvent(ThreadMessageCreatedValue);
+ /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage.
+ public static AssistantStreamEvent ThreadMessageInProgress { get; } = new AssistantStreamEvent(ThreadMessageInProgressValue);
+ /// Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk.
+ public static AssistantStreamEvent ThreadMessageDelta { get; } = new AssistantStreamEvent(ThreadMessageDeltaValue);
+ /// Event sent when a message is completed. The data of this event is of type ThreadMessage.
+ public static AssistantStreamEvent ThreadMessageCompleted { get; } = new AssistantStreamEvent(ThreadMessageCompletedValue);
+ /// Event sent before a message is completed. The data of this event is of type ThreadMessage.
+ public static AssistantStreamEvent ThreadMessageIncomplete { get; } = new AssistantStreamEvent(ThreadMessageIncompleteValue);
+ /// Event sent when an error occurs, such as an internal server error or a timeout.
+ public static AssistantStreamEvent Error { get; } = new AssistantStreamEvent(ErrorValue);
+ /// Event sent when the stream is done.
+ public static AssistantStreamEvent Done { get; } = new AssistantStreamEvent(DoneValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantStreamEvent left, AssistantStreamEvent right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantStreamEvent left, AssistantStreamEvent right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AssistantStreamEvent(string value) => new AssistantStreamEvent(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantStreamEvent other && Equals(other);
+ ///
+ public bool Equals(AssistantStreamEvent 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.Assistants/src/Generated/AssistantThread.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThread.Serialization.cs
new file mode 100644
index 000000000000..b3c7678b36a1
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThread.Serialization.cs
@@ -0,0 +1,215 @@
+// 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.Assistants
+{
+ public partial class AssistantThread : 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(AssistantThread)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("id"u8);
+ writer.WriteStringValue(Id);
+ writer.WritePropertyName("object"u8);
+ writer.WriteStringValue(Object.ToString());
+ writer.WritePropertyName("created_at"u8);
+ writer.WriteNumberValue(CreatedAt, "U");
+ if (ToolResources != null)
+ {
+ writer.WritePropertyName("tool_resources"u8);
+ writer.WriteObjectValue(ToolResources, options);
+ }
+ else
+ {
+ writer.WriteNull("tool_resources");
+ }
+ if (Metadata != null && Optional.IsCollectionDefined(Metadata))
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ 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
+ }
+ }
+ }
+
+ AssistantThread 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(AssistantThread)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAssistantThread(document.RootElement, options);
+ }
+
+ internal static AssistantThread DeserializeAssistantThread(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ AssistantThreadObject @object = default;
+ DateTimeOffset createdAt = default;
+ ToolResources toolResources = default;
+ IReadOnlyDictionary metadata = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new AssistantThreadObject(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("created_at"u8))
+ {
+ createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64());
+ continue;
+ }
+ if (property.NameEquals("tool_resources"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ toolResources = null;
+ continue;
+ }
+ toolResources = ToolResources.DeserializeToolResources(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("metadata"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ metadata = new ChangeTrackingDictionary();
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ metadata = dictionary;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AssistantThread(
+ id,
+ @object,
+ createdAt,
+ toolResources,
+ metadata,
+ 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(AssistantThread)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AssistantThread 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 DeserializeAssistantThread(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AssistantThread)} 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 AssistantThread FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAssistantThread(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.Assistants/src/Generated/AssistantThread.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThread.cs
new file mode 100644
index 000000000000..8d2101d3d8d6
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThread.cs
@@ -0,0 +1,110 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Assistants
+{
+ /// Information about a single thread associated with an assistant.
+ public partial class AssistantThread
+ {
+ ///
+ /// 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 identifier, which can be referenced in API endpoints.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type
+ /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list
+ /// of vector store IDs.
+ ///
+ /// 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.
+ /// is null.
+ internal AssistantThread(string id, DateTimeOffset createdAt, ToolResources toolResources, IReadOnlyDictionary metadata)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+
+ Id = id;
+ CreatedAt = createdAt;
+ ToolResources = toolResources;
+ Metadata = metadata;
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type
+ /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list
+ /// of vector store IDs.
+ ///
+ /// 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 AssistantThread(string id, AssistantThreadObject @object, DateTimeOffset createdAt, ToolResources toolResources, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData)
+ {
+ Id = id;
+ Object = @object;
+ CreatedAt = createdAt;
+ ToolResources = toolResources;
+ Metadata = metadata;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AssistantThread()
+ {
+ }
+
+ /// The identifier, which can be referenced in API endpoints.
+ public string Id { get; }
+ /// The object type, which is always 'thread'.
+ public AssistantThreadObject Object { get; } = AssistantThreadObject.Thread;
+
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ public DateTimeOffset CreatedAt { get; }
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type
+ /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list
+ /// of vector store IDs.
+ ///
+ public ToolResources ToolResources { 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.Assistants/src/Generated/AssistantThreadCreationOptions.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThreadCreationOptions.Serialization.cs
new file mode 100644
index 000000000000..d5d407cff6b1
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThreadCreationOptions.Serialization.cs
@@ -0,0 +1,215 @@
+// 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.Assistants
+{
+ public partial class AssistantThreadCreationOptions : 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(AssistantThreadCreationOptions)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsCollectionDefined(Messages))
+ {
+ writer.WritePropertyName("messages"u8);
+ writer.WriteStartArray();
+ foreach (var item in Messages)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsDefined(ToolResources))
+ {
+ if (ToolResources != null)
+ {
+ writer.WritePropertyName("tool_resources"u8);
+ writer.WriteObjectValue(ToolResources, options);
+ }
+ else
+ {
+ writer.WriteNull("tool_resources");
+ }
+ }
+ if (Optional.IsCollectionDefined(Metadata))
+ {
+ if (Metadata != null)
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ }
+ 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
+ }
+ }
+ }
+
+ AssistantThreadCreationOptions 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(AssistantThreadCreationOptions)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAssistantThreadCreationOptions(document.RootElement, options);
+ }
+
+ internal static AssistantThreadCreationOptions DeserializeAssistantThreadCreationOptions(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IList messages = default;
+ ToolResources toolResources = default;
+ IDictionary metadata = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("messages"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(ThreadMessageOptions.DeserializeThreadMessageOptions(item, options));
+ }
+ messages = array;
+ continue;
+ }
+ if (property.NameEquals("tool_resources"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ toolResources = null;
+ continue;
+ }
+ toolResources = ToolResources.DeserializeToolResources(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("metadata"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ metadata = dictionary;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AssistantThreadCreationOptions(messages ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), 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(AssistantThreadCreationOptions)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AssistantThreadCreationOptions 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 DeserializeAssistantThreadCreationOptions(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AssistantThreadCreationOptions)} 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 AssistantThreadCreationOptions FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAssistantThreadCreationOptions(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.Assistants/src/Generated/AssistantThreadCreationOptions.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThreadCreationOptions.cs
new file mode 100644
index 000000000000..653efe0eb197
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThreadCreationOptions.cs
@@ -0,0 +1,83 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Assistants
+{
+ /// The details used to create a new assistant thread.
+ public partial class AssistantThreadCreationOptions
+ {
+ ///
+ /// 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 .
+ public AssistantThreadCreationOptions()
+ {
+ Messages = new ChangeTrackingList();
+ Metadata = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The initial messages to associate with the new thread.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the
+ /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires
+ /// a list of vector store IDs.
+ ///
+ /// 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 AssistantThreadCreationOptions(IList messages, ToolResources toolResources, IDictionary metadata, IDictionary serializedAdditionalRawData)
+ {
+ Messages = messages;
+ ToolResources = toolResources;
+ Metadata = metadata;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The initial messages to associate with the new thread.
+ public IList Messages { get; }
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the
+ /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires
+ /// a list of vector store IDs.
+ ///
+ public ToolResources ToolResources { get; set; }
+ /// 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 IDictionary Metadata { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThreadObject.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThreadObject.cs
new file mode 100644
index 000000000000..10ddbcf28e62
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantThreadObject.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.Assistants
+{
+ /// The AssistantThread_object.
+ public readonly partial struct AssistantThreadObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantThreadObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string ThreadValue = "thread";
+
+ /// thread.
+ public static AssistantThreadObject Thread { get; } = new AssistantThreadObject(ThreadValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantThreadObject left, AssistantThreadObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantThreadObject left, AssistantThreadObject right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AssistantThreadObject(string value) => new AssistantThreadObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantThreadObject other && Equals(other);
+ ///
+ public bool Equals(AssistantThreadObject 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.Assistants/src/Generated/AssistantsApiResponseFormat.Serialization.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiResponseFormat.Serialization.cs
new file mode 100644
index 000000000000..179d2d3ac79c
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiResponseFormat.Serialization.cs
@@ -0,0 +1,149 @@
+// 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.Assistants
+{
+ public partial class AssistantsApiResponseFormat : 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(AssistantsApiResponseFormat)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsDefined(Type))
+ {
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(Type.Value.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, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AssistantsApiResponseFormat 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(AssistantsApiResponseFormat)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAssistantsApiResponseFormat(document.RootElement, options);
+ }
+
+ internal static AssistantsApiResponseFormat DeserializeAssistantsApiResponseFormat(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ ResponseFormat? type = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ type = new ResponseFormat(property.Value.GetString());
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AssistantsApiResponseFormat(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(AssistantsApiResponseFormat)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AssistantsApiResponseFormat 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 DeserializeAssistantsApiResponseFormat(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AssistantsApiResponseFormat)} 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 AssistantsApiResponseFormat FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAssistantsApiResponseFormat(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.Assistants/src/Generated/AssistantsApiResponseFormat.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiResponseFormat.cs
new file mode 100644
index 000000000000..9f7b32b8688a
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiResponseFormat.cs
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Assistants
+{
+ ///
+ /// 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 AssistantsApiResponseFormat
+ {
+ ///
+ /// 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 .
+ public AssistantsApiResponseFormat()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Must be one of `text` or `json_object`.
+ /// Keeps track of any properties unknown to the library.
+ internal AssistantsApiResponseFormat(ResponseFormat? type, IDictionary serializedAdditionalRawData)
+ {
+ Type = type;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Must be one of `text` or `json_object`.
+ public ResponseFormat? Type { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiResponseFormatMode.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiResponseFormatMode.cs
new file mode 100644
index 000000000000..acfd2b32cfa6
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiResponseFormatMode.cs
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.AI.Assistants
+{
+ /// Represents the mode in which the model will handle the return format of a tool call.
+ public readonly partial struct AssistantsApiResponseFormatMode : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantsApiResponseFormatMode(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string AutoValue = "auto";
+ private const string NoneValue = "none";
+
+ /// Default value. Let the model handle the return format.
+ public static AssistantsApiResponseFormatMode Auto { get; } = new AssistantsApiResponseFormatMode(AutoValue);
+ /// Setting the value to `none`, will result in a 400 Bad request.
+ public static AssistantsApiResponseFormatMode None { get; } = new AssistantsApiResponseFormatMode(NoneValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantsApiResponseFormatMode left, AssistantsApiResponseFormatMode right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantsApiResponseFormatMode left, AssistantsApiResponseFormatMode right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AssistantsApiResponseFormatMode(string value) => new AssistantsApiResponseFormatMode(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantsApiResponseFormatMode other && Equals(other);
+ ///
+ public bool Equals(AssistantsApiResponseFormatMode 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.Assistants/src/Generated/AssistantsApiToolChoiceOptionMode.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiToolChoiceOptionMode.cs
new file mode 100644
index 000000000000..a41159351374
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsApiToolChoiceOptionMode.cs
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.AI.Assistants
+{
+ /// Specifies how the tool choice will be used.
+ public readonly partial struct AssistantsApiToolChoiceOptionMode : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantsApiToolChoiceOptionMode(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string NoneValue = "none";
+ private const string AutoValue = "auto";
+
+ /// The model will not call a function and instead generates a message.
+ public static AssistantsApiToolChoiceOptionMode None { get; } = new AssistantsApiToolChoiceOptionMode(NoneValue);
+ /// The model can pick between generating a message or calling a function.
+ public static AssistantsApiToolChoiceOptionMode Auto { get; } = new AssistantsApiToolChoiceOptionMode(AutoValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantsApiToolChoiceOptionMode left, AssistantsApiToolChoiceOptionMode right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantsApiToolChoiceOptionMode left, AssistantsApiToolChoiceOptionMode right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AssistantsApiToolChoiceOptionMode(string value) => new AssistantsApiToolChoiceOptionMode(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantsApiToolChoiceOptionMode other && Equals(other);
+ ///
+ public bool Equals(AssistantsApiToolChoiceOptionMode 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.Assistants/src/Generated/AssistantsClient.cs b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsClient.cs
new file mode 100644
index 000000000000..53ababfdc2a3
--- /dev/null
+++ b/sdk/ai/Azure.AI.Assistants/src/Generated/AssistantsClient.cs
@@ -0,0 +1,6009 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.AI.Assistants
+{
+ // Data plane generated client.
+ /// The Assistants service client.
+ public partial class AssistantsClient
+ {
+ private const string AuthorizationHeader = "Authorization";
+ private readonly AzureKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" };
+ private readonly TokenCredential _tokenCredential;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+ private readonly string _apiVersion;
+
+ /// The ClientDiagnostics is used to provide tracing support for the client library.
+ internal ClientDiagnostics ClientDiagnostics { get; }
+
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
+
+ /// Initializes a new instance of AssistantsClient for mocking.
+ protected AssistantsClient()
+ {
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>.
+ /// A credential used to authenticate to an Azure Service.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new AssistantsClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>.
+ /// A credential used to authenticate to an Azure Service.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AssistantsClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>.
+ /// A credential used to authenticate to an Azure Service.
+ /// The options for configuring the client.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, AzureKeyCredential credential, AssistantsClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AssistantsClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _keyCredential = credential;
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader, AuthorizationApiKeyPrefix) }, new ResponseClassifier());
+ _endpoint = endpoint;
+ _apiVersion = options.Version;
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>.
+ /// A credential used to authenticate to an Azure Service.
+ /// The options for configuring the client.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, TokenCredential credential, AssistantsClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AssistantsClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _tokenCredential = credential;
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier());
+ _endpoint = endpoint;
+ _apiVersion = options.Version;
+ }
+
+ /// Creates a new assistant.
+ /// The ID of the model to use.
+ /// The name of the new assistant.
+ /// The description of the new assistant.
+ /// The system instructions for the new assistant to use.
+ /// The collection of tools to enable for the new assistant.
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ /// The response format of the tool calls used by this assistant.
+ /// 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> CreateAssistantAsync(string model, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(model, nameof(model));
+
+ CreateAssistantRequest createAssistantRequest = new CreateAssistantRequest(
+ model,
+ name,
+ description,
+ instructions,
+ tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await CreateAssistantAsync(createAssistantRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ /// Creates a new assistant.
+ /// The ID of the model to use.
+ /// The name of the new assistant.
+ /// The description of the new assistant.
+ /// The system instructions for the new assistant to use.
+ /// The collection of tools to enable for the new assistant.
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ /// The response format of the tool calls used by this assistant.
+ /// 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 CreateAssistant(string model, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(model, nameof(model));
+
+ CreateAssistantRequest createAssistantRequest = new CreateAssistantRequest(
+ model,
+ name,
+ description,
+ instructions,
+ tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = CreateAssistant(createAssistantRequest.ToRequestContent(), context);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual async Task CreateAssistantAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateAssistantRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual Response CreateAssistant(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateAssistantRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of assistants that were previously created.
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The cancellation token to use.
+ internal virtual async Task> InternalGetAssistantsAsync(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetAssistantsAsync(limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfAssistant.FromResponse(response), response);
+ }
+
+ /// Gets a list of assistants that were previously created.
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The cancellation token to use.
+ internal virtual Response InternalGetAssistants(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetAssistants(limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfAssistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of assistants that were previously created.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc".
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task InternalGetAssistantsAsync(int? limit, string order, string after, string before, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetAssistants");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAssistantsRequest(limit, order, after, before, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of assistants that were previously created.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc".
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response InternalGetAssistants(int? limit, string order, string after, string before, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetAssistants");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAssistantsRequest(limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieves an existing assistant.
+ /// Identifier of the assistant.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetAssistantAsync(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetAssistantAsync(assistantId, context).ConfigureAwait(false);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ /// Retrieves an existing assistant.
+ /// Identifier of the assistant.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetAssistant(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetAssistant(assistantId, context);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Identifier of the assistant.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual async Task GetAssistantAsync(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAssistantRequest(assistantId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Identifier of the assistant.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual Response GetAssistant(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAssistantRequest(assistantId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Modifies an existing assistant.
+ /// The ID of the assistant to modify.
+ /// The ID of the model to use.
+ /// The modified name for the assistant to use.
+ /// The modified description for the assistant to use.
+ /// The modified system instructions for the new assistant to use.
+ /// The modified collection of tools to enable for the assistant.
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example,
+ /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ /// The response format of the tool calls used by this assistant.
+ /// 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.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> UpdateAssistantAsync(string assistantId, string model = null, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ UpdateAssistantRequest updateAssistantRequest = new UpdateAssistantRequest(
+ model,
+ name,
+ description,
+ instructions,
+ tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await UpdateAssistantAsync(assistantId, updateAssistantRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ /// Modifies an existing assistant.
+ /// The ID of the assistant to modify.
+ /// The ID of the model to use.
+ /// The modified name for the assistant to use.
+ /// The modified description for the assistant to use.
+ /// The modified system instructions for the new assistant to use.
+ /// The modified collection of tools to enable for the assistant.
+ ///
+ /// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example,
+ /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
+ ///
+ ///
+ /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ /// while lower values like 0.2 will make it more focused and deterministic.
+ ///
+ ///
+ /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
+ /// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
+ ///
+ /// We generally recommend altering this or temperature but not both.
+ ///
+ /// The response format of the tool calls used by this assistant.
+ /// 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.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response UpdateAssistant(string assistantId, string model = null, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ UpdateAssistantRequest updateAssistantRequest = new UpdateAssistantRequest(
+ model,
+ name,
+ description,
+ instructions,
+ tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = UpdateAssistant(assistantId, updateAssistantRequest.ToRequestContent(), context);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to modify.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual async Task UpdateAssistantAsync(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateAssistantRequest(assistantId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to modify.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual Response UpdateAssistant(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateAssistantRequest(assistantId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes an assistant.
+ /// Identifier of the assistant.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual async Task> InternalDeleteAssistantAsync(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalDeleteAssistantAsync(assistantId, context).ConfigureAwait(false);
+ return Response.FromValue(InternalAssistantDeletionStatus.FromResponse(response), response);
+ }
+
+ /// Deletes an assistant.
+ /// Identifier of the assistant.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual Response InternalDeleteAssistant(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalDeleteAssistant(assistantId, context);
+ return Response.FromValue(InternalAssistantDeletionStatus.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Deletes an assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Identifier of the assistant.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task InternalDeleteAssistantAsync(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteAssistantRequest(assistantId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Deletes an assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Identifier of the assistant.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response InternalDeleteAssistant(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteAssistantRequest(assistantId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a new thread. Threads contain messages and can be run by assistants.
+ /// The initial messages to associate with the new thread.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the
+ /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires
+ /// a list of vector store IDs.
+ ///
+ /// 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.
+ public virtual async Task> CreateThreadAsync(IEnumerable messages = null, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ CreateThreadRequest createThreadRequest = new CreateThreadRequest(messages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await CreateThreadAsync(createThreadRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ /// Creates a new thread. Threads contain messages and can be run by assistants.
+ /// The initial messages to associate with the new thread.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the
+ /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires
+ /// a list of vector store IDs.
+ ///
+ /// 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.
+ public virtual Response CreateThread(IEnumerable messages = null, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ CreateThreadRequest createThreadRequest = new CreateThreadRequest(messages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = CreateThread(createThreadRequest.ToRequestContent(), context);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by assistants.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual async Task CreateThreadAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateThreadRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by assistants.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual Response CreateThread(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateThreadRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets information about an existing thread.
+ /// Identifier of the thread.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetThreadAsync(string threadId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetThreadAsync(threadId, context).ConfigureAwait(false);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ /// Gets information about an existing thread.
+ /// Identifier of the thread.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetThread(string threadId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetThread(threadId, context);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets information about an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Identifier of the thread.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual async Task GetThreadAsync(string threadId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetThreadRequest(threadId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets information about an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Identifier of the thread.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual Response GetThread(string threadId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetThreadRequest(threadId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Modifies an existing thread.
+ /// The ID of the thread to modify.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the
+ /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires
+ /// a list of vector store IDs
+ ///
+ /// 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.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> UpdateThreadAsync(string threadId, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await UpdateThreadAsync(threadId, updateThreadRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ /// Modifies an existing thread.
+ /// The ID of the thread to modify.
+ ///
+ /// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the
+ /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires
+ /// a list of vector store IDs
+ ///
+ /// 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.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response UpdateThread(string threadId, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = UpdateThread(threadId, updateThreadRequest.ToRequestContent(), context);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to modify.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ public virtual async Task UpdateThreadAsync(string threadId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateThreadRequest(threadId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing thread.
+ ///
+ /// -
+ ///
+ /// This