diff --git a/sdk/ai/Azure.AI.Agents.Persistent/Azure.AI.Agents.Persistent.sln b/sdk/ai/Azure.AI.Agents.Persistent/Azure.AI.Agents.Persistent.sln
new file mode 100644
index 000000000000..de57a7dfc048
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/Azure.AI.Agents.Persistent.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.Agents.Persistent", "src\Azure.AI.Agents.Persistent.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Agents.Persistent.Tests", "tests\Azure.AI.Agents.Persistent.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.Agents.Persistent/CHANGELOG.md b/sdk/ai/Azure.AI.Agents.Persistent/CHANGELOG.md
new file mode 100644
index 000000000000..8b33f0fedccc
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/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.Agents.Persistent/Directory.Build.props b/sdk/ai/Azure.AI.Agents.Persistent/Directory.Build.props
new file mode 100644
index 000000000000..63bd836ad44b
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/README.md b/sdk/ai/Azure.AI.Agents.Persistent/README.md
new file mode 100644
index 000000000000..7bbf14933332
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/README.md
@@ -0,0 +1,107 @@
+# Azure.AI.Agents.Persistent client library for .NET
+
+Azure.AI.Agents.Persistent 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.Agents.Persistent/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.Agents.Persistent --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.Agents.Persistent/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.Agents.Persistent/src/Azure.AI.Agents.Persistent.csproj b/sdk/ai/Azure.AI.Agents.Persistent/src/Azure.AI.Agents.Persistent.csproj
new file mode 100644
index 000000000000..4a6d17091404
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Azure.AI.Agents.Persistent.csproj
@@ -0,0 +1,20 @@
+
+
+ This is the Azure.AI.Agents.Persistent client library for developing .NET applications with rich experience.
+ Azure SDK Code Generation Azure.AI.Agents.Persistent for Azure Data Plane
+ 1.0.0-beta.1
+ Azure.AI.Agents.Persistent
+ $(RequiredTargetFrameworks)
+ true
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.cs
new file mode 100644
index 000000000000..6d32869cfc02
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.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.Agents.Persistent;
+using Azure.Core.Extensions;
+
+namespace Microsoft.Extensions.Azure
+{
+ /// Extension methods to add to client builder.
+ public static partial class AIAgentsPersistentClientBuilderExtensions
+ {
+ /// 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 AddAgentsAdministrationClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential)
+ where TBuilder : IAzureClientFactoryBuilder
+ {
+ return builder.RegisterClientFactory((options) => new AgentsAdministrationClient(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 AddAgentsAdministrationClient(this TBuilder builder, Uri endpoint)
+ where TBuilder : IAzureClientFactoryBuilderWithCredential
+ {
+ return builder.RegisterClientFactory((options, cred) => new AgentsAdministrationClient(endpoint, cred, options));
+ }
+
+ /// Registers a instance.
+ /// The builder to register with.
+ /// The configuration values.
+ public static IAzureClientBuilder AddAgentsAdministrationClient(this TBuilder builder, TConfiguration configuration)
+ where TBuilder : IAzureClientFactoryBuilderWithConfiguration
+ {
+ return builder.RegisterClientFactory(configuration);
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentModelFactory.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentModelFactory.cs
new file mode 100644
index 000000000000..e132b9a38a1d
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentModelFactory.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.Agents.Persistent
+{
+ /// Model factory for models.
+ public static partial class AIAgentsPersistentModelFactory
+ {
+ /// 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 agent.
+ /// The description of the agent.
+ /// The ID of the model to use.
+ /// The system instructions for the agent to use.
+ ///
+ /// The collection of tools enabled for the agent.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , , , , , , , , and .
+ ///
+ ///
+ /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// 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 agent.
+ /// 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 PersistentAgent PersistentAgent(string id = null, PersistentAgentObject @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 PersistentAgent(
+ 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.run'.
+ /// The ID of the thread associated with this run.
+ /// The ID of the agent associated with the thread this run was performed against.
+ /// The status of the agent thread run.
+ ///
+ /// The details of the action required for the agent 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 agent thread run.
+ /// The ID of the model to use.
+ /// The overridden system instructions used for this agent thread run.
+ ///
+ /// The overridden enabled tools used for this agent thread run.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , , , , , , , , and .
+ ///
+ /// The 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 agent can use for this run. This is useful for modifying the behavior on a per-run basis.
+ /// Determines if tools can be executed in parallel within the run.
+ /// 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'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ ///
+ /// A set of resources that are made available to the agent'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 PersistentAgentThread PersistentAgentThread(string id = null, PersistentAgentThreadObject @object = default, DateTimeOffset createdAt = default, ToolResources toolResources = null, IReadOnlyDictionary metadata = null)
+ {
+ metadata ??= new Dictionary();
+
+ return new PersistentAgentThread(
+ 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 agent thread message.
+ ///
+ /// The list of content items associated with the agent 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 agent 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.step'.
+ /// The type of run step, which can be either message_creation or tool_calls.
+ /// The ID of the agent 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 Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning.
+ /// The name of the file.
+ /// 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.Agents.Persistent/src/Generated/AISearchIndexResource.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AISearchIndexResource.Serialization.cs
new file mode 100644
index 000000000000..aa1282c94b61
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/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.Agents.Persistent
+{
+ 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.Agents.Persistent/src/Generated/AISearchIndexResource.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AISearchIndexResource.cs
new file mode 100644
index 000000000000..01a796b1e166
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/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.Agents.Persistent
+{
+ /// 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 agent.
+ /// The name of an index in an IndexResource attached to this agent.
+ /// 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 agent.
+ /// The name of an index in an IndexResource attached to this agent.
+ /// Type of query in an AIIndexResource attached to this agent.
+ /// Number of documents to retrieve from search and present to the model.
+ /// Odata filter string for search resource.
+ /// Keeps track of any properties unknown to the library.
+ internal 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 agent.
+ public string IndexConnectionId { get; set; }
+ /// The name of an index in an IndexResource attached to this agent.
+ public string IndexName { get; set; }
+ /// Type of query in an AIIndexResource attached to this agent.
+ public AzureAISearchQueryType? QueryType { get; set; }
+ /// Number of documents to retrieve from search and present to the model.
+ public int? TopK { get; set; }
+ /// Odata filter string for search resource.
+ public string Filter { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AgentsAdministrationClient.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AgentsAdministrationClient.cs
new file mode 100644
index 000000000000..eef847e1a8be
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AgentsAdministrationClient.cs
@@ -0,0 +1,1138 @@
+// 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.Agents.Persistent
+{
+ // Data plane generated client.
+ /// The AgentsAdministration service client.
+ public partial class AgentsAdministrationClient
+ {
+ 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 AgentsAdministrationClient for mocking.
+ protected AgentsAdministrationClient()
+ {
+ }
+
+ /// Initializes a new instance of AgentsAdministrationClient.
+ /// 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 AgentsAdministrationClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new AgentsAdministrationClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AgentsAdministrationClient.
+ /// 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 AgentsAdministrationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AgentsAdministrationClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AgentsAdministrationClient.
+ /// 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 AgentsAdministrationClient(Uri endpoint, AzureKeyCredential credential, AgentsAdministrationClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AgentsAdministrationClientOptions();
+
+ 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 AgentsAdministrationClient.
+ /// 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 AgentsAdministrationClient(Uri endpoint, TokenCredential credential, AgentsAdministrationClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AgentsAdministrationClientOptions();
+
+ 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 agent.
+ /// The ID of the model to use.
+ /// The name of the new agent.
+ /// The description of the new agent.
+ /// The system instructions for the new agent to use.
+ /// The collection of tools to enable for the new agent.
+ ///
+ /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// 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 agent.
+ /// 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> CreateAgentAsync(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));
+
+ CreateAgentRequest createAgentRequest = new CreateAgentRequest(
+ 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 CreateAgentAsync(createAgentRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(PersistentAgent.FromResponse(response), response);
+ }
+
+ /// Creates a new agent.
+ /// The ID of the model to use.
+ /// The name of the new agent.
+ /// The description of the new agent.
+ /// The system instructions for the new agent to use.
+ /// The collection of tools to enable for the new agent.
+ ///
+ /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter`
+ /// 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 agent.
+ /// 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 CreateAgent(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));
+
+ CreateAgentRequest createAgentRequest = new CreateAgentRequest(
+ model,
+ name,
+ description,
+ instructions,
+ tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = CreateAgent(createAgentRequest.ToRequestContent(), context);
+ return Response.FromValue(PersistentAgent.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new agent.
+ ///
+ /// -
+ ///
+ /// 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 CreateAgentAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.CreateAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateAgentRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new agent.
+ ///
+ /// -
+ ///
+ /// 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 CreateAgent(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.CreateAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateAgentRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of agents 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> InternalGetAgentsAsync(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetAgentsAsync(limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfAgent.FromResponse(response), response);
+ }
+
+ /// Gets a list of agents 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 InternalGetAgents(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetAgents(limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfAgent.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of agents 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 InternalGetAgentsAsync(int? limit, string order, string after, string before, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.InternalGetAgents");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAgentsRequest(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 agents 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 InternalGetAgents(int? limit, string order, string after, string before, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.InternalGetAgents");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAgentsRequest(limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieves an existing agent.
+ /// Identifier of the agent.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetAgentAsync(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetAgentAsync(assistantId, context).ConfigureAwait(false);
+ return Response.FromValue(PersistentAgent.FromResponse(response), response);
+ }
+
+ /// Retrieves an existing agent.
+ /// Identifier of the agent.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetAgent(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetAgent(assistantId, context);
+ return Response.FromValue(PersistentAgent.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an existing agent.
+ ///
+ /// -
+ ///
+ /// 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 agent.
+ /// 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 GetAgentAsync(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.GetAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAgentRequest(assistantId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an existing agent.
+ ///
+ /// -
+ ///
+ /// 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 agent.
+ /// 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 GetAgent(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.GetAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAgentRequest(assistantId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Modifies an existing agent.
+ /// The ID of the agent to modify.
+ /// The ID of the model to use.
+ /// The modified name for the agent to use.
+ /// The modified description for the agent to use.
+ /// The modified system instructions for the new agent to use.
+ /// The modified collection of tools to enable for the agent.
+ ///
+ /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example,
+ /// the `code_interpreter` 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 agent.
+ /// 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> UpdateAgentAsync(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));
+
+ UpdateAgentRequest updateAgentRequest = new UpdateAgentRequest(
+ 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 UpdateAgentAsync(assistantId, updateAgentRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(PersistentAgent.FromResponse(response), response);
+ }
+
+ /// Modifies an existing agent.
+ /// The ID of the agent to modify.
+ /// The ID of the model to use.
+ /// The modified name for the agent to use.
+ /// The modified description for the agent to use.
+ /// The modified system instructions for the new agent to use.
+ /// The modified collection of tools to enable for the agent.
+ ///
+ /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example,
+ /// the `code_interpreter` 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 agent.
+ /// 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 UpdateAgent(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));
+
+ UpdateAgentRequest updateAgentRequest = new UpdateAgentRequest(
+ model,
+ name,
+ description,
+ instructions,
+ tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ temperature,
+ topP,
+ responseFormat,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = UpdateAgent(assistantId, updateAgentRequest.ToRequestContent(), context);
+ return Response.FromValue(PersistentAgent.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing agent.
+ ///
+ /// -
+ ///
+ /// 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 agent 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 UpdateAgentAsync(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.UpdateAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateAgentRequest(assistantId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing agent.
+ ///
+ /// -
+ ///
+ /// 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 agent 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 UpdateAgent(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.UpdateAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateAgentRequest(assistantId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes an agent.
+ /// Identifier of the agent.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual async Task> InternalDeleteAgentAsync(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalDeleteAgentAsync(assistantId, context).ConfigureAwait(false);
+ return Response.FromValue(InternalAgentDeletionStatus.FromResponse(response), response);
+ }
+
+ /// Deletes an agent.
+ /// Identifier of the agent.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual Response InternalDeleteAgent(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalDeleteAgent(assistantId, context);
+ return Response.FromValue(InternalAgentDeletionStatus.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Deletes an agent.
+ ///
+ /// -
+ ///
+ /// 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 agent.
+ /// 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 InternalDeleteAgentAsync(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.InternalDeleteAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteAgentRequest(assistantId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Deletes an agent.
+ ///
+ /// -
+ ///
+ /// 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 agent.
+ /// 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 InternalDeleteAgent(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.InternalDeleteAgent");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteAgentRequest(assistantId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a new agent thread and immediately starts a run using that new thread.
+ /// The ID of the agent for which the thread should be created.
+ /// The details used to create the new thread. If no thread is provided, an empty one will be created.
+ /// The overridden model that the agent should use to run the thread.
+ /// The overridden system instructions the agent should use to run the thread.
+ /// The overridden list of enabled tools the agent should use to run the thread.
+ /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis.
+ ///
+ /// If `true`, returns a stream of events that happen during the Run as server-sent events,
+ /// terminating when the Run enters a terminal state with a `data: [DONE]` message.
+ ///
+ ///
+ /// 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 maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only
+ /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified,
+ /// the run will end with status `incomplete`. See `incomplete_details` for more info.
+ ///
+ ///
+ /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only
+ /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens
+ /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
+ ///
+ /// The strategy to use for dropping messages as the context windows moves forward.
+ /// Controls whether or not and which tool is called by the model.
+ /// Specifies the format that the model must output.
+ /// If `true` functions will run in parallel during tool use.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> CreateThreadAndRunAsync(string assistantId, PersistentAgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(assistantId, nameof(assistantId));
+
+ CreateThreadAndRunRequest createThreadAndRunRequest = new CreateThreadAndRunRequest(
+ assistantId,
+ thread,
+ overrideModelName,
+ overrideInstructions,
+ overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ stream,
+ temperature,
+ topP,
+ maxPromptTokens,
+ maxCompletionTokens,
+ truncationStrategy,
+ toolChoice,
+ responseFormat,
+ parallelToolCalls,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await CreateThreadAndRunAsync(createThreadAndRunRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ /// Creates a new agent thread and immediately starts a run using that new thread.
+ /// The ID of the agent for which the thread should be created.
+ /// The details used to create the new thread. If no thread is provided, an empty one will be created.
+ /// The overridden model that the agent should use to run the thread.
+ /// The overridden system instructions the agent should use to run the thread.
+ /// The overridden list of enabled tools the agent should use to run the thread.
+ /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis.
+ ///
+ /// If `true`, returns a stream of events that happen during the Run as server-sent events,
+ /// terminating when the Run enters a terminal state with a `data: [DONE]` message.
+ ///
+ ///
+ /// 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 maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only
+ /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified,
+ /// the run will end with status `incomplete`. See `incomplete_details` for more info.
+ ///
+ ///
+ /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only
+ /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens
+ /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
+ ///
+ /// The strategy to use for dropping messages as the context windows moves forward.
+ /// Controls whether or not and which tool is called by the model.
+ /// Specifies the format that the model must output.
+ /// If `true` functions will run in parallel during tool use.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response CreateThreadAndRun(string assistantId, PersistentAgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, TruncationObject truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(assistantId, nameof(assistantId));
+
+ CreateThreadAndRunRequest createThreadAndRunRequest = new CreateThreadAndRunRequest(
+ assistantId,
+ thread,
+ overrideModelName,
+ overrideInstructions,
+ overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(),
+ toolResources,
+ stream,
+ temperature,
+ topP,
+ maxPromptTokens,
+ maxCompletionTokens,
+ truncationStrategy,
+ toolChoice,
+ responseFormat,
+ parallelToolCalls,
+ metadata ?? new ChangeTrackingDictionary(),
+ null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = CreateThreadAndRun(createThreadAndRunRequest.ToRequestContent(), context);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new agent thread and immediately starts a run using that new 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 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 CreateThreadAndRunAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.CreateThreadAndRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateThreadAndRunRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new agent thread and immediately starts a run using that new 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 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 CreateThreadAndRun(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AgentsAdministrationClient.CreateThreadAndRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateThreadAndRunRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ private Threads _cachedThreads;
+ private Messages _cachedMessages;
+ private Runs _cachedRuns;
+ private RunSteps _cachedRunSteps;
+ private Files _cachedFiles;
+ private VectorStores _cachedVectorStores;
+ private VectorStoreFiles _cachedVectorStoreFiles;
+ private VectorStoreFileBatches _cachedVectorStoreFileBatches;
+
+ /// Initializes a new instance of Threads.
+ public virtual Threads GetThreadsClient()
+ {
+ return Volatile.Read(ref _cachedThreads) ?? Interlocked.CompareExchange(ref _cachedThreads, new Threads(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedThreads;
+ }
+
+ /// Initializes a new instance of Messages.
+ public virtual Messages GetMessagesClient()
+ {
+ return Volatile.Read(ref _cachedMessages) ?? Interlocked.CompareExchange(ref _cachedMessages, new Messages(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedMessages;
+ }
+
+ /// Initializes a new instance of Runs.
+ public virtual Runs GetRunsClient()
+ {
+ return Volatile.Read(ref _cachedRuns) ?? Interlocked.CompareExchange(ref _cachedRuns, new Runs(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedRuns;
+ }
+
+ /// Initializes a new instance of RunSteps.
+ public virtual RunSteps GetRunStepsClient()
+ {
+ return Volatile.Read(ref _cachedRunSteps) ?? Interlocked.CompareExchange(ref _cachedRunSteps, new RunSteps(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedRunSteps;
+ }
+
+ /// Initializes a new instance of Files.
+ public virtual Files GetFilesClient()
+ {
+ return Volatile.Read(ref _cachedFiles) ?? Interlocked.CompareExchange(ref _cachedFiles, new Files(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedFiles;
+ }
+
+ /// Initializes a new instance of VectorStores.
+ public virtual VectorStores GetVectorStoresClient()
+ {
+ return Volatile.Read(ref _cachedVectorStores) ?? Interlocked.CompareExchange(ref _cachedVectorStores, new VectorStores(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedVectorStores;
+ }
+
+ /// Initializes a new instance of VectorStoreFiles.
+ public virtual VectorStoreFiles GetVectorStoreFilesClient()
+ {
+ return Volatile.Read(ref _cachedVectorStoreFiles) ?? Interlocked.CompareExchange(ref _cachedVectorStoreFiles, new VectorStoreFiles(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedVectorStoreFiles;
+ }
+
+ /// Initializes a new instance of VectorStoreFileBatches.
+ public virtual VectorStoreFileBatches GetVectorStoreFileBatchesClient()
+ {
+ return Volatile.Read(ref _cachedVectorStoreFileBatches) ?? Interlocked.CompareExchange(ref _cachedVectorStoreFileBatches, new VectorStoreFileBatches(ClientDiagnostics, _pipeline, _keyCredential, _tokenCredential, _endpoint, _apiVersion), null) ?? _cachedVectorStoreFileBatches;
+ }
+
+ internal HttpMessage CreateCreateAgentRequest(RequestContent content, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalGetAgentsRequest(int? limit, string order, string after, string before, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ if (limit != null)
+ {
+ uri.AppendQuery("limit", limit.Value, true);
+ }
+ if (order != null)
+ {
+ uri.AppendQuery("order", order, true);
+ }
+ if (after != null)
+ {
+ uri.AppendQuery("after", after, true);
+ }
+ if (before != null)
+ {
+ uri.AppendQuery("before", before, true);
+ }
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetAgentRequest(string assistantId, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants/", false);
+ uri.AppendPath(assistantId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpdateAgentRequest(string assistantId, RequestContent content, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants/", false);
+ uri.AppendPath(assistantId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalDeleteAgentRequest(string assistantId, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants/", false);
+ uri.AppendPath(assistantId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateThreadAndRunRequest(RequestContent content, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/threads/runs", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ private static RequestContext DefaultRequestContext = new RequestContext();
+ internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default)
+ {
+ if (!cancellationToken.CanBeCanceled)
+ {
+ return DefaultRequestContext;
+ }
+
+ return new RequestContext() { CancellationToken = cancellationToken };
+ }
+
+ private static ResponseClassifier _responseClassifier200;
+ private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 });
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AgentsAdministrationClientOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AgentsAdministrationClientOptions.cs
new file mode 100644
index 000000000000..721237fd271f
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AgentsAdministrationClientOptions.cs
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// Client options for AgentsAdministrationClient.
+ public partial class AgentsAdministrationClientOptions : ClientOptions
+ {
+ private const ServiceVersion LatestVersion = ServiceVersion.V2025_05_15_Preview;
+
+ /// The version of the service to use.
+ public enum ServiceVersion
+ {
+ /// Service version "2025-05-15-preview".
+ V2025_05_15_Preview = 1,
+ }
+
+ internal string Version { get; }
+
+ /// Initializes new instance of AgentsAdministrationClientOptions.
+ public AgentsAdministrationClientOptions(ServiceVersion version = LatestVersion)
+ {
+ Version = version switch
+ {
+ ServiceVersion.V2025_05_15_Preview => "2025-05-15-preview",
+ _ => throw new NotSupportedException()
+ };
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchQueryType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchQueryType.cs
new file mode 100644
index 000000000000..3a147da2e2ae
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchQueryType.cs
@@ -0,0 +1,60 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// Available query types for Azure AI Search tool.
+ public readonly partial struct AzureAISearchQueryType : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AzureAISearchQueryType(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string SimpleValue = "simple";
+ private const string SemanticValue = "semantic";
+ private const string VectorValue = "vector";
+ private const string VectorSimpleHybridValue = "vector_simple_hybrid";
+ private const string VectorSemanticHybridValue = "vector_semantic_hybrid";
+
+ /// Query type `simple`.
+ public static AzureAISearchQueryType Simple { get; } = new AzureAISearchQueryType(SimpleValue);
+ /// Query type `semantic`.
+ public static AzureAISearchQueryType Semantic { get; } = new AzureAISearchQueryType(SemanticValue);
+ /// Query type `vector`.
+ public static AzureAISearchQueryType Vector { get; } = new AzureAISearchQueryType(VectorValue);
+ /// Query type `vector_simple_hybrid`.
+ public static AzureAISearchQueryType VectorSimpleHybrid { get; } = new AzureAISearchQueryType(VectorSimpleHybridValue);
+ /// Query type `vector_semantic_hybrid`.
+ public static AzureAISearchQueryType VectorSemanticHybrid { get; } = new AzureAISearchQueryType(VectorSemanticHybridValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AzureAISearchQueryType left, AzureAISearchQueryType right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AzureAISearchQueryType left, AzureAISearchQueryType right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AzureAISearchQueryType(string value) => new AzureAISearchQueryType(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AzureAISearchQueryType other && Equals(other);
+ ///
+ public bool Equals(AzureAISearchQueryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.Serialization.cs
new file mode 100644
index 000000000000..c6a408ead617
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.Serialization.cs
@@ -0,0 +1,159 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ public partial class AzureAISearchResource : 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(AzureAISearchResource)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsCollectionDefined(IndexList))
+ {
+ writer.WritePropertyName("indexes"u8);
+ writer.WriteStartArray();
+ foreach (var item in IndexList)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ 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
+ }
+ }
+ }
+
+ AzureAISearchResource 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(AzureAISearchResource)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureAISearchResource(document.RootElement, options);
+ }
+
+ internal static AzureAISearchResource DeserializeAzureAISearchResource(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IList indexes = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("indexes"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(AISearchIndexResource.DeserializeAISearchIndexResource(item, options));
+ }
+ indexes = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureAISearchResource(indexes ?? new ChangeTrackingList(), 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(AzureAISearchResource)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureAISearchResource 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 DeserializeAzureAISearchResource(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureAISearchResource)} 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 AzureAISearchResource FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureAISearchResource(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.cs
new file mode 100644
index 000000000000..1c8d009cbb4e
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.cs
@@ -0,0 +1,72 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// A set of index resources used by the `azure_ai_search` tool.
+ public partial class AzureAISearchResource
+ {
+ ///
+ /// 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 AzureAISearchResource()
+ {
+ IndexList = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// The indices attached to this agent. There can be a maximum of 1 index
+ /// resource attached to the agent.
+ ///
+ /// Keeps track of any properties unknown to the library.
+ internal AzureAISearchResource(IList indexList, IDictionary serializedAdditionalRawData)
+ {
+ IndexList = indexList;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ ///
+ /// The indices attached to this agent. There can be a maximum of 1 index
+ /// resource attached to the agent.
+ ///
+ public IList IndexList { get; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.Serialization.cs
new file mode 100644
index 000000000000..8371e0d16839
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.Serialization.cs
@@ -0,0 +1,126 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ public partial class AzureAISearchToolDefinition : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ }
+
+ AzureAISearchToolDefinition 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(AzureAISearchToolDefinition)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureAISearchToolDefinition(document.RootElement, options);
+ }
+
+ internal static AzureAISearchToolDefinition DeserializeAzureAISearchToolDefinition(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string type = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureAISearchToolDefinition(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(AzureAISearchToolDefinition)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureAISearchToolDefinition 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 DeserializeAzureAISearchToolDefinition(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new AzureAISearchToolDefinition FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureAISearchToolDefinition(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.cs
new file mode 100644
index 000000000000..4e3f44492aad
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// The input definition information for an Azure AI search tool as used to configure an agent.
+ public partial class AzureAISearchToolDefinition : ToolDefinition
+ {
+ /// Initializes a new instance of .
+ public AzureAISearchToolDefinition()
+ {
+ Type = "azure_ai_search";
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// Keeps track of any properties unknown to the library.
+ internal AzureAISearchToolDefinition(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData)
+ {
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.Serialization.cs
new file mode 100644
index 000000000000..7463d73864cf
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.Serialization.cs
@@ -0,0 +1,150 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ public partial class AzureFunctionBinding : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(Type.ToString());
+ writer.WritePropertyName("storage_queue"u8);
+ writer.WriteObjectValue(StorageQueue, options);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AzureFunctionBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureFunctionBinding(document.RootElement, options);
+ }
+
+ internal static AzureFunctionBinding DeserializeAzureFunctionBinding(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ AzureFunctionBindingType type = default;
+ AzureFunctionStorageQueue storageQueue = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ type = new AzureFunctionBindingType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("storage_queue"u8))
+ {
+ storageQueue = AzureFunctionStorageQueue.DeserializeAzureFunctionStorageQueue(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureFunctionBinding(type, storageQueue, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureFunctionBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureFunctionBinding(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AzureFunctionBinding FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureFunctionBinding(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.cs
new file mode 100644
index 000000000000..7cc1a5a7cfd4
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.cs
@@ -0,0 +1,80 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// The structure for keeping storage queue name and URI.
+ public partial class AzureFunctionBinding
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// Storage queue.
+ /// is null.
+ public AzureFunctionBinding(AzureFunctionStorageQueue storageQueue)
+ {
+ Argument.AssertNotNull(storageQueue, nameof(storageQueue));
+
+ StorageQueue = storageQueue;
+ }
+
+ /// Initializes a new instance of .
+ /// The type of binding, which is always 'storage_queue'.
+ /// Storage queue.
+ /// Keeps track of any properties unknown to the library.
+ internal AzureFunctionBinding(AzureFunctionBindingType type, AzureFunctionStorageQueue storageQueue, IDictionary serializedAdditionalRawData)
+ {
+ Type = type;
+ StorageQueue = storageQueue;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AzureFunctionBinding()
+ {
+ }
+
+ /// The type of binding, which is always 'storage_queue'.
+ public AzureFunctionBindingType Type { get; } = AzureFunctionBindingType.StorageQueue;
+
+ /// Storage queue.
+ public AzureFunctionStorageQueue StorageQueue { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBindingType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBindingType.cs
new file mode 100644
index 000000000000..7c123058e5aa
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBindingType.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// The AzureFunctionBinding_type.
+ public readonly partial struct AzureFunctionBindingType : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AzureFunctionBindingType(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string StorageQueueValue = "storage_queue";
+
+ /// storage_queue.
+ public static AzureFunctionBindingType StorageQueue { get; } = new AzureFunctionBindingType(StorageQueueValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AzureFunctionBindingType left, AzureFunctionBindingType right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AzureFunctionBindingType left, AzureFunctionBindingType right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AzureFunctionBindingType(string value) => new AzureFunctionBindingType(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AzureFunctionBindingType other && Equals(other);
+ ///
+ public bool Equals(AzureFunctionBindingType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.Serialization.cs
new file mode 100644
index 000000000000..ef6e147973d1
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.Serialization.cs
@@ -0,0 +1,150 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ public partial class AzureFunctionStorageQueue : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("queue_service_endpoint"u8);
+ writer.WriteStringValue(StorageServiceEndpoint);
+ writer.WritePropertyName("queue_name"u8);
+ writer.WriteStringValue(QueueName);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AzureFunctionStorageQueue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureFunctionStorageQueue(document.RootElement, options);
+ }
+
+ internal static AzureFunctionStorageQueue DeserializeAzureFunctionStorageQueue(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string queueServiceEndpoint = default;
+ string queueName = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("queue_service_endpoint"u8))
+ {
+ queueServiceEndpoint = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("queue_name"u8))
+ {
+ queueName = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureFunctionStorageQueue(queueServiceEndpoint, queueName, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureFunctionStorageQueue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureFunctionStorageQueue(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AzureFunctionStorageQueue FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureFunctionStorageQueue(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.cs
new file mode 100644
index 000000000000..6e0515c5d320
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.cs
@@ -0,0 +1,82 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// The structure for keeping storage queue name and URI.
+ public partial class AzureFunctionStorageQueue
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// URI to the Azure Storage Queue service allowing you to manipulate a queue.
+ /// The name of an Azure function storage queue.
+ /// or is null.
+ public AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName)
+ {
+ Argument.AssertNotNull(storageServiceEndpoint, nameof(storageServiceEndpoint));
+ Argument.AssertNotNull(queueName, nameof(queueName));
+
+ StorageServiceEndpoint = storageServiceEndpoint;
+ QueueName = queueName;
+ }
+
+ /// Initializes a new instance of .
+ /// URI to the Azure Storage Queue service allowing you to manipulate a queue.
+ /// The name of an Azure function storage queue.
+ /// Keeps track of any properties unknown to the library.
+ internal AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName, IDictionary serializedAdditionalRawData)
+ {
+ StorageServiceEndpoint = storageServiceEndpoint;
+ QueueName = queueName;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AzureFunctionStorageQueue()
+ {
+ }
+
+ /// URI to the Azure Storage Queue service allowing you to manipulate a queue.
+ public string StorageServiceEndpoint { get; set; }
+ /// The name of an Azure function storage queue.
+ public string QueueName { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.Serialization.cs
new file mode 100644
index 000000000000..14afc89b261f
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.Serialization.cs
@@ -0,0 +1,134 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ public partial class AzureFunctionToolDefinition : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ writer.WritePropertyName("azure_function"u8);
+ writer.WriteObjectValue(InternalAzureFunction, options);
+ }
+
+ AzureFunctionToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureFunctionToolDefinition(document.RootElement, options);
+ }
+
+ internal static AzureFunctionToolDefinition DeserializeAzureFunctionToolDefinition(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ InternalAzureFunctionDefinition azureFunction = default;
+ string type = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("azure_function"u8))
+ {
+ azureFunction = InternalAzureFunctionDefinition.DeserializeInternalAzureFunctionDefinition(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureFunctionToolDefinition(type, serializedAdditionalRawData, azureFunction);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureFunctionToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureFunctionToolDefinition(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new AzureFunctionToolDefinition FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureFunctionToolDefinition(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.cs
new file mode 100644
index 000000000000..0b30c14d86e3
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.cs
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// The input definition information for a azure function tool as used to configure an agent.
+ public partial class AzureFunctionToolDefinition : ToolDefinition
+ {
+ /// Initializes a new instance of .
+ /// The definition of the concrete function that the function tool should call.
+ /// is null.
+ public AzureFunctionToolDefinition(InternalAzureFunctionDefinition internalAzureFunction)
+ {
+ Argument.AssertNotNull(internalAzureFunction, nameof(internalAzureFunction));
+
+ Type = "azure_function";
+ InternalAzureFunction = internalAzureFunction;
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// Keeps track of any properties unknown to the library.
+ /// The definition of the concrete function that the function tool should call.
+ internal AzureFunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, InternalAzureFunctionDefinition internalAzureFunction) : base(type, serializedAdditionalRawData)
+ {
+ InternalAzureFunction = internalAzureFunction;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AzureFunctionToolDefinition()
+ {
+ }
+
+ /// The definition of the concrete function that the function tool should call.
+ public InternalAzureFunctionDefinition InternalAzureFunction { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.Serialization.cs
new file mode 100644
index 000000000000..d427e97543f9
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.Serialization.cs
@@ -0,0 +1,134 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ public partial class BingCustomSearchToolDefinition : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BingCustomSearchToolDefinition)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ writer.WritePropertyName("bing_custom_search"u8);
+ writer.WriteObjectValue(BingCustomSearch, options);
+ }
+
+ BingCustomSearchToolDefinition 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(BingCustomSearchToolDefinition)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeBingCustomSearchToolDefinition(document.RootElement, options);
+ }
+
+ internal static BingCustomSearchToolDefinition DeserializeBingCustomSearchToolDefinition(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ SearchConfigurationList bingCustomSearch = default;
+ string type = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("bing_custom_search"u8))
+ {
+ bingCustomSearch = SearchConfigurationList.DeserializeSearchConfigurationList(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new BingCustomSearchToolDefinition(type, serializedAdditionalRawData, bingCustomSearch);
+ }
+
+ 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(BingCustomSearchToolDefinition)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ BingCustomSearchToolDefinition 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 DeserializeBingCustomSearchToolDefinition(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(BingCustomSearchToolDefinition)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new BingCustomSearchToolDefinition FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeBingCustomSearchToolDefinition(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.cs
new file mode 100644
index 000000000000..4988f226e07b
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.cs
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Agents.Persistent
+{
+ /// The input definition information for a Bing custom search tool as used to configure an agent.
+ public partial class BingCustomSearchToolDefinition : ToolDefinition
+ {
+ /// Initializes a new instance of .
+ /// The list of search configurations used by the bing custom search tool.
+ /// is null.
+ public BingCustomSearchToolDefinition(SearchConfigurationList bingCustomSearch)
+ {
+ Argument.AssertNotNull(bingCustomSearch, nameof(bingCustomSearch));
+
+ Type = "bing_custom_search";
+ BingCustomSearch = bingCustomSearch;
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// Keeps track of any properties unknown to the library.
+ /// The list of search configurations used by the bing custom search tool.
+ internal BingCustomSearchToolDefinition(string type, IDictionary serializedAdditionalRawData, SearchConfigurationList bingCustomSearch) : base(type, serializedAdditionalRawData)
+ {
+ BingCustomSearch = bingCustomSearch;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal BingCustomSearchToolDefinition()
+ {
+ }
+
+ /// The list of search configurations used by the bing custom search tool.
+ public SearchConfigurationList BingCustomSearch { get; set; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.Serialization.cs
new file mode 100644
index 000000000000..48b94715494c
--- /dev/null
+++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.Serialization.cs
@@ -0,0 +1,134 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Agents.Persistent
+{
+ public partial class BingGroundingToolDefinition : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ writer.WritePropertyName("bing_grounding"u8);
+ writer.WriteObjectValue(BingGrounding, options);
+ }
+
+ BingGroundingToolDefinition 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(BingGroundingToolDefinition)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeBingGroundingToolDefinition(document.RootElement, options);
+ }
+
+ internal static BingGroundingToolDefinition DeserializeBingGroundingToolDefinition(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ ToolConnectionList bingGrounding = default;
+ string type = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("bing_grounding"u8))
+ {
+ bingGrounding = ToolConnectionList.DeserializeToolConnectionList(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new BingGroundingToolDefinition(type, serializedAdditionalRawData, bingGrounding);
+ }
+
+ 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(BingGroundingToolDefinition)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ BingGroundingToolDefinition 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 DeserializeBingGroundingToolDefinition(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new BingGroundingToolDefinition FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeBingGroundingToolDefinition(document.RootElement);
+ }
+
+ /// Convert into a