diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/Azure.AI.OpenAI.Assistants.sln b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/Azure.AI.OpenAI.Assistants.sln
new file mode 100644
index 0000000000000..ac3546e02fe60
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/Azure.AI.OpenAI.Assistants.sln
@@ -0,0 +1,56 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.OpenAI.Assistants", "src\Azure.AI.OpenAI.Assistants.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.OpenAI.Assistants.Tests", "tests\Azure.AI.OpenAI.Assistants.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/CHANGELOG.md b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/CHANGELOG.md
new file mode 100644
index 0000000000000..13dd08af78abe
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/Directory.Build.props b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/Directory.Build.props
new file mode 100644
index 0000000000000..63bd836ad44b7
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/README.md b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/README.md
new file mode 100644
index 0000000000000..d31e78602f801
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/README.md
@@ -0,0 +1,86 @@
+# Azure.AI.OpenAI.Assistants client library for .NET
+
+Azure.AI.OpenAI.Assistants is a managed service that helps developers get secret simply and securely.
+
+Use the client library for to:
+
+* [Get secret](https://docs.microsoft.com/azure)
+
+[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples]
+
+ [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/assistants/Azure.AI.OpenAI.Assistants/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure)
+
+## Getting started
+
+This section should include everything a developer needs to do to install and create their first client connection *very quickly*.
+
+### Install the package
+
+First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository.
+
+Install the client library for .NET with [NuGet](https://www.nuget.org/ ):
+
+```dotnetcli
+dotnet add package Azure.AI.OpenAI.Assistants --prerelease
+```
+
+### Prerequisites
+
+Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB:
+
+> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`.
+
+### Authenticate the client
+
+If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating.
+
+For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object.
+
+## 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/assistants/Azure.AI.OpenAI.Assistants/samples).
+
+## Troubleshooting
+
+Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery.
+
+Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API.
+
+If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code.
+
+## Next steps
+
+* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory.
+* If appropriate, point users to other packages that might be useful.
+* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for.
+
+## Contributing
+
+This is a template, but your SDK readme should include details on how to contribute code to the repo/package.
+
+
+[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
+[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
+
+![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/assistants/Azure.AI.OpenAI.Assistants/README.png)
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Azure.AI.OpenAI.Assistants.csproj b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Azure.AI.OpenAI.Assistants.csproj
new file mode 100644
index 0000000000000..6c57df6627728
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Azure.AI.OpenAI.Assistants.csproj
@@ -0,0 +1,20 @@
+
+
+ This is the Azure.AI.OpenAI.Assistants client library for developing .NET applications with rich experience.
+ Azure SDK Code Generation Azure.AI.OpenAI.Assistants for Azure Data Plane
+ 1.0.0-beta.1
+ Azure.AI.OpenAI.Assistants
+ $(RequiredTargetFrameworks)
+ true
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AIOpenAIAssistantsClientBuilderExtensions.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AIOpenAIAssistantsClientBuilderExtensions.cs
new file mode 100644
index 0000000000000..23b1ed7ab371d
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AIOpenAIAssistantsClientBuilderExtensions.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.OpenAI.Assistants;
+using Azure.Core.Extensions;
+
+namespace Microsoft.Extensions.Azure
+{
+ /// Extension methods to add to client builder.
+ public static partial class AIOpenAIAssistantsClientBuilderExtensions
+ {
+ /// Registers a instance.
+ /// The builder to register with.
+ /// An OpenAI endpoint supporting assistants functionality.
+ /// A credential used to authenticate to an Azure Service.
+ public static IAzureClientBuilder AddAssistantsClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential)
+ where TBuilder : IAzureClientFactoryBuilder
+ {
+ return builder.RegisterClientFactory((options) => new AssistantsClient(endpoint, credential, options));
+ }
+
+ /// Registers a instance.
+ /// The builder to register with.
+ /// An OpenAI endpoint supporting assistants functionality.
+ public static IAzureClientBuilder AddAssistantsClient(this TBuilder builder, Uri endpoint)
+ where TBuilder : IAzureClientFactoryBuilderWithCredential
+ {
+ return builder.RegisterClientFactory((options, cred) => new AssistantsClient(endpoint, cred, options));
+ }
+
+ /// Registers a instance.
+ /// The builder to register with.
+ /// The configuration values.
+ public static IAzureClientBuilder AddAssistantsClient(this TBuilder builder, TConfiguration configuration)
+ where TBuilder : IAzureClientFactoryBuilderWithConfiguration
+ {
+ return builder.RegisterClientFactory(configuration);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AIOpenAIAssistantsModelFactory.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AIOpenAIAssistantsModelFactory.cs
new file mode 100644
index 0000000000000..3cd8bbce64ab5
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AIOpenAIAssistantsModelFactory.cs
@@ -0,0 +1,395 @@
+// 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.OpenAI.Assistants
+{
+ /// Model factory for models.
+ public static partial class AIOpenAIAssistantsModelFactory
+ {
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always assistant.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The name of the assistant.
+ /// The description of the assistant.
+ /// The ID of the model to use.
+ /// The system instructions for the assistant to use.
+ /// The collection of tools enabled for the assistant.
+ /// A list of attached file IDs, ordered by creation date in ascending order.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// A new instance for mocking.
+ public static Assistant Assistant(string id = null, AssistantObject @object = default, DateTimeOffset createdAt = default, string name = null, string description = null, string model = null, string instructions = null, IEnumerable tools = null, IEnumerable fileIds = null, IReadOnlyDictionary metadata = null)
+ {
+ tools ??= new List();
+ fileIds ??= new List();
+ metadata ??= new Dictionary();
+
+ return new Assistant(id, @object, createdAt, name, description, model, instructions, tools?.ToList(), fileIds?.ToList(), metadata);
+ }
+
+ /// 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 OpenAIPageableListOfAssistant OpenAIPageableListOfAssistant(OpenAIPageableListOfAssistantObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfAssistant(@object, data?.ToList(), firstId, lastId, hasMore);
+ }
+
+ /// 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 'assistant.deleted'.
+ /// A new instance for mocking.
+ public static InternalAssistantDeletionStatus InternalAssistantDeletionStatus(string id = null, bool deleted = default, InternalAssistantDeletionStatusObject @object = default)
+ {
+ return new InternalAssistantDeletionStatus(id, deleted, @object);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'assistant.file'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The assistant ID that the file is attached to.
+ /// A new instance for mocking.
+ public static AssistantFile AssistantFile(string id = null, AssistantFileObject @object = default, DateTimeOffset createdAt = default, string assistantId = null)
+ {
+ return new AssistantFile(id, @object, createdAt, assistantId);
+ }
+
+ /// 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 OpenAIPageableListOfAssistantFile OpenAIPageableListOfAssistantFile(OpenAIPageableListOfAssistantFileObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfAssistantFile(@object, data?.ToList(), firstId, lastId, hasMore);
+ }
+
+ /// 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 'assistant.file.deleted'.
+ /// A new instance for mocking.
+ public static InternalAssistantFileDeletionStatus InternalAssistantFileDeletionStatus(string id = null, bool deleted = default, InternalAssistantFileDeletionStatusObject @object = default)
+ {
+ return new InternalAssistantFileDeletionStatus(id, deleted, @object);
+ }
+
+ /// 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 up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// A new instance for mocking.
+ public static AssistantThread AssistantThread(string id = null, AssistantThreadObject @object = default, DateTimeOffset createdAt = default, IReadOnlyDictionary metadata = null)
+ {
+ metadata ??= new Dictionary();
+
+ return new AssistantThread(id, @object, createdAt, metadata);
+ }
+
+ /// 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 'thread.deleted'.
+ /// A new instance for mocking.
+ public static ThreadDeletionStatus ThreadDeletionStatus(string id = null, bool deleted = default, ThreadDeletionStatusObject @object = default)
+ {
+ return new ThreadDeletionStatus(id, deleted, @object);
+ }
+
+ /// 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 role associated with the assistant thread message.
+ /// The list of content items associated with the assistant thread message.
+ /// If applicable, the ID of the assistant that authored this message.
+ /// If applicable, the ID of the run associated with the authoring of this message.
+ ///
+ /// A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can
+ /// access files.
+ ///
+ /// 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, MessageRole role = default, IEnumerable contentItems = null, string assistantId = null, string runId = null, IEnumerable fileIds = null, IReadOnlyDictionary metadata = null)
+ {
+ contentItems ??= new List();
+ fileIds ??= new List();
+ metadata ??= new Dictionary();
+
+ return new ThreadMessage(id, @object, createdAt, threadId, role, contentItems?.ToList(), assistantId, runId, fileIds?.ToList(), metadata);
+ }
+
+ /// 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 OpenAIPageableListOfThreadMessage OpenAIPageableListOfThreadMessage(OpenAIPageableListOfThreadMessageObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfThreadMessage(@object, data?.ToList(), firstId, lastId, hasMore);
+ }
+
+ /// 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 OpenAIPageableListOfMessageFile OpenAIPageableListOfMessageFile(OpenAIPageableListOfMessageFileObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfMessageFile(@object, data?.ToList(), firstId, lastId, hasMore);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread.message.file'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The ID of the message that this file is attached to.
+ /// A new instance for mocking.
+ public static MessageFile MessageFile(string id = null, MessageFileObject @object = default, DateTimeOffset createdAt = default, string messageId = null)
+ {
+ return new MessageFile(id, @object, createdAt, messageId);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread.run'.
+ /// The ID of the thread associated with this run.
+ /// The ID of the assistant associated with the thread this run was performed against.
+ /// The status of the assistant thread run.
+ /// The details of the action required for the assistant thread run to continue.
+ /// The last error, if any, encountered by this assistant thread run.
+ /// The ID of the model to use.
+ /// The overridden system instructions used for this assistant thread run.
+ /// The overridden enabled tools used for this assistant thread run.
+ /// A list of attached file IDs, ordered by creation date in ascending order.
+ /// 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.
+ /// 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 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, IEnumerable fileIds = null, DateTimeOffset createdAt = default, DateTimeOffset? expiresAt = null, DateTimeOffset? startedAt = null, DateTimeOffset? completedAt = null, DateTimeOffset? cancelledAt = null, DateTimeOffset? failedAt = null, IReadOnlyDictionary metadata = null)
+ {
+ tools ??= new List();
+ fileIds ??= new List();
+ metadata ??= new Dictionary();
+
+ return new ThreadRun(id, @object, threadId, assistantId, status, requiredAction, lastError, model, instructions, tools?.ToList(), fileIds?.ToList(), createdAt, expiresAt, startedAt, completedAt, cancelledAt, failedAt, metadata);
+ }
+
+ /// Initializes a new instance of .
+ /// The status for the error.
+ /// The human-readable text associated with the error.
+ /// or is null.
+ /// A new instance for mocking.
+ public static RunError RunError(string code = null, string message = null)
+ {
+ if (code == null)
+ {
+ throw new ArgumentNullException(nameof(code));
+ }
+ if (message == null)
+ {
+ throw new ArgumentNullException(nameof(message));
+ }
+
+ return new RunError(code, message);
+ }
+
+ /// 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 OpenAIPageableListOfThreadRun OpenAIPageableListOfThreadRun(OpenAIPageableListOfThreadRunObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfThreadRun(@object, data?.ToList(), firstId, lastId, hasMore);
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread.run.step'.
+ /// The type of run step, which can be either message_creation or tool_calls.
+ /// The ID of the assistant associated with the run step.
+ /// The ID of the thread that was run.
+ /// The ID of the run that this run step is a part of.
+ /// The status of this run step.
+ /// The details for this run step.
+ /// 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.
+ /// 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, IReadOnlyDictionary metadata = null)
+ {
+ metadata ??= new Dictionary();
+
+ return new RunStep(id, @object, type, assistantId, threadId, runId, status, stepDetails, lastError, createdAt, expiredAt, completedAt, cancelledAt, failedAt, metadata);
+ }
+
+ /// Initializes a new instance of .
+ /// The error code for this error.
+ /// The human-readable text associated with this error.
+ /// is null.
+ /// A new instance for mocking.
+ public static RunStepError RunStepError(RunStepErrorCode code = default, string message = null)
+ {
+ if (message == null)
+ {
+ throw new ArgumentNullException(nameof(message));
+ }
+
+ return new RunStepError(code, message);
+ }
+
+ /// 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 OpenAIPageableListOfRunStep OpenAIPageableListOfRunStep(OpenAIPageableListOfRunStepObject @object = default, IEnumerable data = null, string firstId = null, string lastId = null, bool hasMore = default)
+ {
+ data ??= new List();
+
+ return new OpenAIPageableListOfRunStep(@object, data?.ToList(), firstId, lastId, hasMore);
+ }
+
+ /// Initializes a new instance of .
+ /// The object type, which is always 'list'.
+ /// The files returned for the request.
+ /// A new instance for mocking.
+ public static InternalFileListResponse InternalFileListResponse(InternalFileListResponseObject @object = default, IEnumerable data = null)
+ {
+ data ??= new List();
+
+ return new InternalFileListResponse(@object, data?.ToList());
+ }
+
+ /// 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.
+ /// 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)
+ {
+ return new OpenAIFile(@object, id, size, filename, createdAt, purpose);
+ }
+
+ /// 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 'file'.
+ /// A new instance for mocking.
+ public static InternalFileDeletionStatus InternalFileDeletionStatus(string id = null, bool deleted = default, InternalFileDeletionStatusObject @object = default)
+ {
+ return new InternalFileDeletionStatus(id, deleted, @object);
+ }
+
+ /// 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 ToolCall ToolCall(string type = null, string id = null)
+ {
+ return new UnknownToolCall(type, id);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// The key/value pairs produced by the retrieval tool.
+ /// A new instance for mocking.
+ public static RetrievalToolCall RetrievalToolCall(string id = null, IReadOnlyDictionary retrieval = null)
+ {
+ retrieval ??= new Dictionary();
+
+ return new RetrievalToolCall("retrieval", id, retrieval);
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// The textual content associated with this text annotation item.
+ /// 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 MessageTextAnnotation MessageTextAnnotation(string type = null, string text = null, int startIndex = default, int endIndex = default)
+ {
+ return new UnknownMessageTextAnnotation(type, text, startIndex, endIndex);
+ }
+
+ /// 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, messageCreation);
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the message created by this run step.
+ /// is null.
+ /// A new instance for mocking.
+ public static RunStepMessageCreationReference RunStepMessageCreationReference(string messageId = null)
+ {
+ if (messageId == null)
+ {
+ throw new ArgumentNullException(nameof(messageId));
+ }
+
+ return new RunStepMessageCreationReference(messageId);
+ }
+
+ /// Initializes a new instance of .
+ /// A list of tool call details for this run step.
+ /// A new instance for mocking.
+ public static RunStepToolCallDetails RunStepToolCallDetails(IEnumerable toolCalls = null)
+ {
+ toolCalls ??= new List();
+
+ return new RunStepToolCallDetails(RunStepType.ToolCalls, toolCalls?.ToList());
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/Assistant.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/Assistant.Serialization.cs
new file mode 100644
index 0000000000000..3db5ab5b801fd
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/Assistant.Serialization.cs
@@ -0,0 +1,133 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class Assistant
+ {
+ internal static Assistant DeserializeAssistant(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ AssistantObject @object = default;
+ DateTimeOffset createdAt = default;
+ string name = default;
+ string description = default;
+ string model = default;
+ string instructions = default;
+ IReadOnlyList tools = default;
+ IReadOnlyList fileIds = default;
+ IReadOnlyDictionary metadata = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new AssistantObject(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("created_at"u8))
+ {
+ createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64());
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ name = null;
+ continue;
+ }
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("description"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ description = null;
+ continue;
+ }
+ description = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("model"u8))
+ {
+ model = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("instructions"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ instructions = null;
+ continue;
+ }
+ instructions = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("tools"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(ToolDefinition.DeserializeToolDefinition(item));
+ }
+ tools = array;
+ continue;
+ }
+ if (property.NameEquals("file_ids"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(item.GetString());
+ }
+ fileIds = array;
+ continue;
+ }
+ if (property.NameEquals("metadata"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ metadata = new ChangeTrackingDictionary();
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ metadata = dictionary;
+ continue;
+ }
+ }
+ return new Assistant(id, @object, createdAt, name, description, model, instructions, tools, fileIds, metadata);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static Assistant FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAssistant(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/Assistant.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/Assistant.cs
new file mode 100644
index 0000000000000..eb0fee27842b4
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/Assistant.cs
@@ -0,0 +1,98 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// Represents an assistant that can call the model and use tools.
+ public partial class Assistant
+ {
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The name of the assistant.
+ /// The description of the assistant.
+ /// The ID of the model to use.
+ /// The system instructions for the assistant to use.
+ /// The collection of tools enabled for the assistant.
+ /// A list of attached file IDs, ordered by creation date in ascending order.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// , , or is null.
+ internal Assistant(string id, DateTimeOffset createdAt, string name, string description, string model, string instructions, IEnumerable tools, IEnumerable fileIds, IReadOnlyDictionary metadata)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(model, nameof(model));
+ Argument.AssertNotNull(tools, nameof(tools));
+ Argument.AssertNotNull(fileIds, nameof(fileIds));
+
+ Id = id;
+ CreatedAt = createdAt;
+ Name = name;
+ Description = description;
+ Model = model;
+ Instructions = instructions;
+ Tools = tools.ToList();
+ FileIds = fileIds.ToList();
+ Metadata = metadata;
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always assistant.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The name of the assistant.
+ /// The description of the assistant.
+ /// The ID of the model to use.
+ /// The system instructions for the assistant to use.
+ /// The collection of tools enabled for the assistant.
+ /// A list of attached file IDs, ordered by creation date in ascending order.
+ /// 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.
+ internal Assistant(string id, AssistantObject @object, DateTimeOffset createdAt, string name, string description, string model, string instructions, IReadOnlyList tools, IReadOnlyList fileIds, IReadOnlyDictionary metadata)
+ {
+ Id = id;
+ Object = @object;
+ CreatedAt = createdAt;
+ Name = name;
+ Description = description;
+ Model = model;
+ Instructions = instructions;
+ Tools = tools;
+ FileIds = fileIds;
+ Metadata = metadata;
+ }
+
+ /// The identifier, which can be referenced in API endpoints.
+ public string Id { get; }
+ /// The object type, which is always assistant.
+ public AssistantObject Object { get; } = AssistantObject.Assistant;
+
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ public DateTimeOffset CreatedAt { get; }
+ /// The name of the assistant.
+ public string Name { get; }
+ /// The description of the assistant.
+ public string Description { get; }
+ /// The ID of the model to use.
+ public string Model { get; }
+ /// The system instructions for the assistant to use.
+ public string Instructions { get; }
+ ///
+ /// The collection of tools enabled for the assistant.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , and .
+ ///
+ public IReadOnlyList Tools { get; }
+ /// A list of attached file IDs, ordered by creation date in ascending order.
+ public IReadOnlyList FileIds { get; }
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ public IReadOnlyDictionary Metadata { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantCreationOptions.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantCreationOptions.Serialization.cs
new file mode 100644
index 0000000000000..d6257f00c532c
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantCreationOptions.Serialization.cs
@@ -0,0 +1,105 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class AssistantCreationOptions : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("model"u8);
+ writer.WriteStringValue(Model);
+ if (Optional.IsDefined(Name))
+ {
+ if (Name != null)
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ else
+ {
+ writer.WriteNull("name");
+ }
+ }
+ if (Optional.IsDefined(Description))
+ {
+ if (Description != null)
+ {
+ writer.WritePropertyName("description"u8);
+ writer.WriteStringValue(Description);
+ }
+ else
+ {
+ writer.WriteNull("description");
+ }
+ }
+ if (Optional.IsDefined(Instructions))
+ {
+ if (Instructions != null)
+ {
+ writer.WritePropertyName("instructions"u8);
+ writer.WriteStringValue(Instructions);
+ }
+ else
+ {
+ writer.WriteNull("instructions");
+ }
+ }
+ if (Optional.IsCollectionDefined(Tools))
+ {
+ writer.WritePropertyName("tools"u8);
+ writer.WriteStartArray();
+ foreach (var item in Tools)
+ {
+ writer.WriteObjectValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(FileIds))
+ {
+ writer.WritePropertyName("file_ids"u8);
+ writer.WriteStartArray();
+ foreach (var item in FileIds)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Metadata))
+ {
+ if (Metadata != null)
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantCreationOptions.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantCreationOptions.cs
new file mode 100644
index 0000000000000..c8c897f61149d
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantCreationOptions.cs
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The request details to use when creating a new assistant.
+ public partial class AssistantCreationOptions
+ {
+ /// Initializes a new instance of .
+ /// The ID of the model to use.
+ /// is null.
+ public AssistantCreationOptions(string model)
+ {
+ Argument.AssertNotNull(model, nameof(model));
+
+ Model = model;
+ Tools = new ChangeTrackingList();
+ FileIds = new ChangeTrackingList();
+ Metadata = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the model to use.
+ /// The name of the new assistant.
+ /// The description of the new assistant.
+ /// The system instructions for the new assistant to use.
+ /// The collection of tools to enable for the new assistant.
+ /// A list of previously uploaded file IDs to attach to the assistant.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ internal AssistantCreationOptions(string model, string name, string description, string instructions, IList tools, IList fileIds, IDictionary metadata)
+ {
+ Model = model;
+ Name = name;
+ Description = description;
+ Instructions = instructions;
+ Tools = tools;
+ FileIds = fileIds;
+ Metadata = metadata;
+ }
+
+ /// The ID of the model to use.
+ public string Model { get; }
+ /// The name of the new assistant.
+ public string Name { get; set; }
+ /// The description of the new assistant.
+ public string Description { get; set; }
+ /// The system instructions for the new assistant to use.
+ public string Instructions { get; set; }
+ ///
+ /// The collection of tools to enable for the new assistant.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , and .
+ ///
+ public IList Tools { get; }
+ /// A list of previously uploaded file IDs to attach to the assistant.
+ public IList FileIds { get; }
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ public IDictionary Metadata { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFile.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFile.Serialization.cs
new file mode 100644
index 0000000000000..57e5470434c02
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFile.Serialization.cs
@@ -0,0 +1,60 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class AssistantFile
+ {
+ internal static AssistantFile DeserializeAssistantFile(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ AssistantFileObject @object = default;
+ DateTimeOffset createdAt = default;
+ string assistantId = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new AssistantFileObject(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("created_at"u8))
+ {
+ createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64());
+ continue;
+ }
+ if (property.NameEquals("assistant_id"u8))
+ {
+ assistantId = property.Value.GetString();
+ continue;
+ }
+ }
+ return new AssistantFile(id, @object, createdAt, assistantId);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AssistantFile FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAssistantFile(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFile.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFile.cs
new file mode 100644
index 0000000000000..2d7f5f2a3fd25
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFile.cs
@@ -0,0 +1,54 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// Information about a file attached to an assistant, as used by tools that can read files.
+ public partial class AssistantFile
+ {
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The assistant ID that the file is attached to.
+ /// or is null.
+ internal AssistantFile(string id, DateTimeOffset createdAt, string assistantId)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(assistantId, nameof(assistantId));
+
+ Id = id;
+ CreatedAt = createdAt;
+ AssistantId = assistantId;
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'assistant.file'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// The assistant ID that the file is attached to.
+ internal AssistantFile(string id, AssistantFileObject @object, DateTimeOffset createdAt, string assistantId)
+ {
+ Id = id;
+ Object = @object;
+ CreatedAt = createdAt;
+ AssistantId = assistantId;
+ }
+
+ /// The identifier, which can be referenced in API endpoints.
+ public string Id { get; }
+ /// The object type, which is always 'assistant.file'.
+ public AssistantFileObject Object { get; } = AssistantFileObject.AssistantFile;
+
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ public DateTimeOffset CreatedAt { get; }
+ /// The assistant ID that the file is attached to.
+ public string AssistantId { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFileObject.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFileObject.cs
new file mode 100644
index 0000000000000..d9bbdaaaedbaf
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantFileObject.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.OpenAI.Assistants
+{
+ /// The AssistantFile_object.
+ public readonly partial struct AssistantFileObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantFileObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string AssistantFileValue = "assistant.file";
+
+ /// assistant.file.
+ public static AssistantFileObject AssistantFile { get; } = new AssistantFileObject(AssistantFileValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantFileObject left, AssistantFileObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantFileObject left, AssistantFileObject right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator AssistantFileObject(string value) => new AssistantFileObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantFileObject other && Equals(other);
+ ///
+ public bool Equals(AssistantFileObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantObject.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantObject.cs
new file mode 100644
index 0000000000000..0baba5629e487
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantObject.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The Assistant_object.
+ public readonly partial struct AssistantObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string AssistantValue = "assistant";
+
+ /// assistant.
+ public static AssistantObject Assistant { get; } = new AssistantObject(AssistantValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantObject left, AssistantObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantObject left, AssistantObject right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator AssistantObject(string value) => new AssistantObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantObject other && Equals(other);
+ ///
+ public bool Equals(AssistantObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThread.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThread.Serialization.cs
new file mode 100644
index 0000000000000..af7d166214b93
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThread.Serialization.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;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class AssistantThread
+ {
+ internal static AssistantThread DeserializeAssistantThread(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ AssistantThreadObject @object = default;
+ DateTimeOffset createdAt = default;
+ IReadOnlyDictionary metadata = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new AssistantThreadObject(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("created_at"u8))
+ {
+ createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64());
+ continue;
+ }
+ if (property.NameEquals("metadata"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ metadata = new ChangeTrackingDictionary();
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ metadata = dictionary;
+ continue;
+ }
+ }
+ return new AssistantThread(id, @object, createdAt, metadata);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AssistantThread FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAssistantThread(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThread.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThread.cs
new file mode 100644
index 0000000000000..8a0de3db209e5
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThread.cs
@@ -0,0 +1,54 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// Information about a single thread associated with an assistant.
+ public partial class AssistantThread
+ {
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// is null.
+ internal AssistantThread(string id, DateTimeOffset createdAt, IReadOnlyDictionary metadata)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+
+ Id = id;
+ CreatedAt = createdAt;
+ Metadata = metadata;
+ }
+
+ /// Initializes a new instance of .
+ /// The identifier, which can be referenced in API endpoints.
+ /// The object type, which is always 'thread'.
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ /// A set of 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.
+ internal AssistantThread(string id, AssistantThreadObject @object, DateTimeOffset createdAt, IReadOnlyDictionary metadata)
+ {
+ Id = id;
+ Object = @object;
+ CreatedAt = createdAt;
+ Metadata = metadata;
+ }
+
+ /// The identifier, which can be referenced in API endpoints.
+ public string Id { get; }
+ /// The object type, which is always 'thread'.
+ public AssistantThreadObject Object { get; } = AssistantThreadObject.Thread;
+
+ /// The Unix timestamp, in seconds, representing when this object was created.
+ public DateTimeOffset CreatedAt { get; }
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ public IReadOnlyDictionary Metadata { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadCreationOptions.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadCreationOptions.Serialization.cs
new file mode 100644
index 0000000000000..7e3f83fccc997
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadCreationOptions.Serialization.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class AssistantThreadCreationOptions : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Messages))
+ {
+ writer.WritePropertyName("messages"u8);
+ writer.WriteStartArray();
+ foreach (var item in Messages)
+ {
+ writer.WriteObjectValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Metadata))
+ {
+ if (Metadata != null)
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadCreationOptions.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadCreationOptions.cs
new file mode 100644
index 0000000000000..67912f83c9f47
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadCreationOptions.cs
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The details used to create a new assistant thread.
+ public partial class AssistantThreadCreationOptions
+ {
+ /// Initializes a new instance of .
+ public AssistantThreadCreationOptions()
+ {
+ Messages = new ChangeTrackingList();
+ Metadata = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The initial messages to associate with the new thread.
+ /// A set of 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.
+ internal AssistantThreadCreationOptions(IList messages, IDictionary metadata)
+ {
+ Messages = messages;
+ Metadata = metadata;
+ }
+
+ /// The initial messages to associate with the new thread.
+ public IList Messages { get; }
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ public IDictionary Metadata { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadObject.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadObject.cs
new file mode 100644
index 0000000000000..de51338222605
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantThreadObject.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The AssistantThread_object.
+ public readonly partial struct AssistantThreadObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AssistantThreadObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string ThreadValue = "thread";
+
+ /// thread.
+ public static AssistantThreadObject Thread { get; } = new AssistantThreadObject(ThreadValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AssistantThreadObject left, AssistantThreadObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AssistantThreadObject left, AssistantThreadObject right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator AssistantThreadObject(string value) => new AssistantThreadObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AssistantThreadObject other && Equals(other);
+ ///
+ public bool Equals(AssistantThreadObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantsClient.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantsClient.cs
new file mode 100644
index 0000000000000..ebf56dddbd916
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantsClient.cs
@@ -0,0 +1,4117 @@
+// 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;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ // Data plane generated client.
+ /// Azure OpenAI APIs for Assistants.
+ public partial class AssistantsClient
+ {
+ private const string AuthorizationHeader = "api-key";
+ private readonly AzureKeyCredential _keyCredential;
+ private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" };
+ private readonly TokenCredential _tokenCredential;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+
+ /// The ClientDiagnostics is used to provide tracing support for the client library.
+ internal ClientDiagnostics ClientDiagnostics { get; }
+
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
+
+ /// Initializes a new instance of AssistantsClient for mocking.
+ protected AssistantsClient()
+ {
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// An OpenAI endpoint supporting assistants functionality.
+ /// A credential used to authenticate to an Azure Service.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new AssistantsClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// An OpenAI endpoint supporting assistants functionality.
+ /// A credential used to authenticate to an Azure Service.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AssistantsClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// An OpenAI endpoint supporting assistants functionality.
+ /// A credential used to authenticate to an Azure Service.
+ /// The options for configuring the client.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, AzureKeyCredential credential, AssistantsClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AssistantsClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _keyCredential = credential;
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }, new ResponseClassifier());
+ _endpoint = endpoint;
+ }
+
+ /// Initializes a new instance of AssistantsClient.
+ /// An OpenAI endpoint supporting assistants functionality.
+ /// A credential used to authenticate to an Azure Service.
+ /// The options for configuring the client.
+ /// or is null.
+ public AssistantsClient(Uri endpoint, TokenCredential credential, AssistantsClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AssistantsClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _tokenCredential = credential;
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier());
+ _endpoint = endpoint;
+ }
+
+ /// Creates a new assistant.
+ /// The request details to use when creating a new assistant.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> CreateAssistantAsync(AssistantCreationOptions assistantCreationOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(assistantCreationOptions, nameof(assistantCreationOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = assistantCreationOptions.ToRequestContent();
+ Response response = await CreateAssistantAsync(content, context).ConfigureAwait(false);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ /// Creates a new assistant.
+ /// The request details to use when creating a new assistant.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response CreateAssistant(AssistantCreationOptions assistantCreationOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(assistantCreationOptions, nameof(assistantCreationOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = assistantCreationOptions.ToRequestContent();
+ Response response = CreateAssistant(content, context);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual async Task CreateAssistantAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateAssistantRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual Response CreateAssistant(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateAssistantRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of assistants that were previously created.
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The cancellation token to use.
+ public virtual async Task> InternalGetAssistantsAsync(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetAssistantsAsync(limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfAssistant.FromResponse(response), response);
+ }
+
+ /// Gets a list of assistants that were previously created.
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The cancellation token to use.
+ public virtual Response InternalGetAssistants(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetAssistants(limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfAssistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of assistants that were previously created.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc".
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task InternalGetAssistantsAsync(int? limit, string order, string after, string before, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetAssistants");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAssistantsRequest(limit, order, after, before, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of assistants that were previously created.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
+ /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc".
+ /// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ /// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response InternalGetAssistants(int? limit, string order, string after, string before, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetAssistants");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAssistantsRequest(limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieves an existing assistant.
+ /// The ID of the assistant to retrieve.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetAssistantAsync(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetAssistantAsync(assistantId, context).ConfigureAwait(false);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ /// Retrieves an existing assistant.
+ /// The ID of the assistant to retrieve.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetAssistant(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetAssistant(assistantId, context);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to retrieve.
+ /// 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 GetAssistantAsync(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAssistantRequest(assistantId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to retrieve.
+ /// 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 GetAssistant(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAssistantRequest(assistantId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Modifies an existing assistant.
+ /// The ID of the assistant to modify.
+ /// The details of the modification to perform on the specified assistant.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> UpdateAssistantAsync(string assistantId, UpdateAssistantOptions updateAssistantOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(updateAssistantOptions, nameof(updateAssistantOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = updateAssistantOptions.ToRequestContent();
+ Response response = await UpdateAssistantAsync(assistantId, content, context).ConfigureAwait(false);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ /// Modifies an existing assistant.
+ /// The ID of the assistant to modify.
+ /// The details of the modification to perform on the specified assistant.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response UpdateAssistant(string assistantId, UpdateAssistantOptions updateAssistantOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(updateAssistantOptions, nameof(updateAssistantOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = updateAssistantOptions.ToRequestContent();
+ Response response = UpdateAssistant(assistantId, content, context);
+ return Response.FromValue(Assistant.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to modify.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task UpdateAssistantAsync(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateAssistantRequest(assistantId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to modify.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response UpdateAssistant(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateAssistantRequest(assistantId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes an assistant.
+ /// The ID of the assistant to delete.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalDeleteAssistantAsync(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalDeleteAssistantAsync(assistantId, context).ConfigureAwait(false);
+ return Response.FromValue(InternalAssistantDeletionStatus.FromResponse(response), response);
+ }
+
+ /// Deletes an assistant.
+ /// The ID of the assistant to delete.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response InternalDeleteAssistant(string assistantId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalDeleteAssistant(assistantId, context);
+ return Response.FromValue(InternalAssistantDeletionStatus.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Deletes an assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to delete.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task InternalDeleteAssistantAsync(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteAssistantRequest(assistantId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Deletes an assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to delete.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response InternalDeleteAssistant(string assistantId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteAssistant");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteAssistantRequest(assistantId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ /// The ID of the assistant to attach the file to.
+ /// The ID of the previously uploaded file to attach.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> LinkAssistantFileAsync(string assistantId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ CreateAssistantFileRequest createAssistantFileRequest = new CreateAssistantFileRequest(fileId);
+ Response response = await LinkAssistantFileAsync(assistantId, createAssistantFileRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(AssistantFile.FromResponse(response), response);
+ }
+
+ /// Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ /// The ID of the assistant to attach the file to.
+ /// The ID of the previously uploaded file to attach.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response LinkAssistantFile(string assistantId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ CreateAssistantFileRequest createAssistantFileRequest = new CreateAssistantFileRequest(fileId);
+ Response response = LinkAssistantFile(assistantId, createAssistantFileRequest.ToRequestContent(), context);
+ return Response.FromValue(AssistantFile.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to attach the file to.
+ /// 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.
+ internal virtual async Task LinkAssistantFileAsync(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.LinkAssistantFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateLinkAssistantFileRequest(assistantId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Attaches a previously uploaded file to an assistant for use by tools that can read files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to attach the file to.
+ /// 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.
+ internal virtual Response LinkAssistantFile(string assistantId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.LinkAssistantFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateLinkAssistantFileRequest(assistantId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ /// The ID of the assistant to retrieve the list of attached files for.
+ /// 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.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalGetAssistantFilesAsync(string assistantId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetAssistantFilesAsync(assistantId, limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfAssistantFile.FromResponse(response), response);
+ }
+
+ /// Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ /// The ID of the assistant to retrieve the list of attached files for.
+ /// 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.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response InternalGetAssistantFiles(string assistantId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetAssistantFiles(assistantId, limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfAssistantFile.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of files attached to a specific assistant, as used by tools that can read files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to retrieve the list of attached files for.
+ /// 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.
+ /// 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 InternalGetAssistantFilesAsync(string assistantId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetAssistantFiles");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAssistantFilesRequest(assistantId, 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 files attached to a specific assistant, as used by tools that can read files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant to retrieve the list of attached files for.
+ /// 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.
+ /// 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 InternalGetAssistantFiles(string assistantId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetAssistantFiles");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetAssistantFilesRequest(assistantId, limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieves a file attached to an assistant.
+ /// The ID of the assistant associated with the attached file.
+ /// The ID of the file to retrieve.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetAssistantFileAsync(string assistantId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetAssistantFileAsync(assistantId, fileId, context).ConfigureAwait(false);
+ return Response.FromValue(AssistantFile.FromResponse(response), response);
+ }
+
+ /// Retrieves a file attached to an assistant.
+ /// The ID of the assistant associated with the attached file.
+ /// The ID of the file to retrieve.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response GetAssistantFile(string assistantId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetAssistantFile(assistantId, fileId, context);
+ return Response.FromValue(AssistantFile.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves a file attached to an assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant associated with the attached file.
+ /// The ID of the file to retrieve.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetAssistantFileAsync(string assistantId, string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetAssistantFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAssistantFileRequest(assistantId, fileId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Retrieves a file attached to an assistant.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant associated with the attached file.
+ /// The ID of the file to retrieve.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetAssistantFile(string assistantId, string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetAssistantFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAssistantFileRequest(assistantId, fileId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ /// files.
+ ///
+ /// The ID of the assistant from which the specified file should be unlinked.
+ /// The ID of the file to unlink from the specified assistant.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalUnlinkAssistantFileAsync(string assistantId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalUnlinkAssistantFileAsync(assistantId, fileId, context).ConfigureAwait(false);
+ return Response.FromValue(InternalAssistantFileDeletionStatus.FromResponse(response), response);
+ }
+
+ ///
+ /// Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ /// files.
+ ///
+ /// The ID of the assistant from which the specified file should be unlinked.
+ /// The ID of the file to unlink from the specified assistant.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response InternalUnlinkAssistantFile(string assistantId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalUnlinkAssistantFile(assistantId, fileId, context);
+ return Response.FromValue(InternalAssistantFileDeletionStatus.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ /// files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant from which the specified file should be unlinked.
+ /// The ID of the file to unlink from the specified assistant.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 InternalUnlinkAssistantFileAsync(string assistantId, string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalUnlinkAssistantFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalUnlinkAssistantFileRequest(assistantId, fileId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
+ /// files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the assistant from which the specified file should be unlinked.
+ /// The ID of the file to unlink from the specified assistant.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 InternalUnlinkAssistantFile(string assistantId, string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalUnlinkAssistantFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalUnlinkAssistantFileRequest(assistantId, fileId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a new thread. Threads contain messages and can be run by assistants.
+ /// The details used to create a new assistant thread.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> CreateThreadAsync(AssistantThreadCreationOptions assistantThreadCreationOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(assistantThreadCreationOptions, nameof(assistantThreadCreationOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = assistantThreadCreationOptions.ToRequestContent();
+ Response response = await CreateThreadAsync(content, context).ConfigureAwait(false);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ /// Creates a new thread. Threads contain messages and can be run by assistants.
+ /// The details used to create a new assistant thread.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response CreateThread(AssistantThreadCreationOptions assistantThreadCreationOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(assistantThreadCreationOptions, nameof(assistantThreadCreationOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = assistantThreadCreationOptions.ToRequestContent();
+ Response response = CreateThread(content, context);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by assistants.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual async Task CreateThreadAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateThreadRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by assistants.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual Response CreateThread(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateThreadRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets information about an existing thread.
+ /// The ID of the thread to retrieve information about.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetThreadAsync(string threadId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetThreadAsync(threadId, context).ConfigureAwait(false);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ /// Gets information about an existing thread.
+ /// The ID of the thread to retrieve information about.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetThread(string threadId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetThread(threadId, context);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets information about an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to retrieve information about.
+ /// 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 GetThreadAsync(string threadId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetThreadRequest(threadId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets information about an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to retrieve information about.
+ /// 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 GetThread(string threadId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetThreadRequest(threadId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Modifies an existing thread.
+ /// The ID of the thread to modify.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> UpdateThreadAsync(string threadId, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest()
+ {
+ Metadata = metadata
+ };
+ Response response = await UpdateThreadAsync(threadId, updateThreadRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ /// Modifies an existing thread.
+ /// The ID of the thread to modify.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response UpdateThread(string threadId, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest()
+ {
+ Metadata = metadata
+ };
+ Response response = UpdateThread(threadId, updateThreadRequest.ToRequestContent(), context);
+ return Response.FromValue(AssistantThread.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to modify.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task UpdateThreadAsync(string threadId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateThreadRequest(threadId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to modify.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response UpdateThread(string threadId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateThreadRequest(threadId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes an existing thread.
+ /// The ID of the thread to delete.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalDeleteThreadAsync(string threadId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalDeleteThreadAsync(threadId, context).ConfigureAwait(false);
+ return Response.FromValue(ThreadDeletionStatus.FromResponse(response), response);
+ }
+
+ /// Deletes an existing thread.
+ /// The ID of the thread to delete.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response InternalDeleteThread(string threadId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalDeleteThread(threadId, context);
+ return Response.FromValue(ThreadDeletionStatus.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Deletes an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to delete.
+ /// 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 InternalDeleteThreadAsync(string threadId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteThreadRequest(threadId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Deletes an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to delete.
+ /// 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 InternalDeleteThread(string threadId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteThread");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteThreadRequest(threadId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a new message on a specified thread.
+ /// The ID of the thread to create the new message on.
+ /// The role to associate with the new message.
+ /// The textual content for the new message.
+ /// A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> CreateMessageAsync(string threadId, MessageRole role, string content, IEnumerable fileIds = null, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ CreateMessageRequest createMessageRequest = new CreateMessageRequest(role, content)
+ {
+ Metadata = metadata
+ };
+ if (fileIds != null)
+ {
+ foreach (var value in fileIds)
+ {
+ createMessageRequest.FileIds.Add(value);
+ }
+ }
+ CreateMessageRequest createMessageRequest0 = createMessageRequest;
+ Response response = await CreateMessageAsync(threadId, createMessageRequest0.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(ThreadMessage.FromResponse(response), response);
+ }
+
+ /// Creates a new message on a specified thread.
+ /// The ID of the thread to create the new message on.
+ /// The role to associate with the new message.
+ /// The textual content for the new message.
+ /// A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response CreateMessage(string threadId, MessageRole role, string content, IEnumerable fileIds = null, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ CreateMessageRequest createMessageRequest = new CreateMessageRequest(role, content)
+ {
+ Metadata = metadata
+ };
+ if (fileIds != null)
+ {
+ foreach (var value in fileIds)
+ {
+ createMessageRequest.FileIds.Add(value);
+ }
+ }
+ CreateMessageRequest createMessageRequest0 = createMessageRequest;
+ Response response = CreateMessage(threadId, createMessageRequest0.ToRequestContent(), context);
+ return Response.FromValue(ThreadMessage.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new message on a specified thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to create the new message on.
+ /// 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.
+ internal virtual async Task CreateMessageAsync(string threadId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateMessage");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateMessageRequest(threadId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new message on a specified thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to create the new message on.
+ /// 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.
+ internal virtual Response CreateMessage(string threadId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateMessage");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateMessageRequest(threadId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of messages that exist on a thread.
+ /// The ID of the thread to list messages from.
+ /// 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.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalGetMessagesAsync(string threadId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetMessagesAsync(threadId, limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfThreadMessage.FromResponse(response), response);
+ }
+
+ /// Gets a list of messages that exist on a thread.
+ /// The ID of the thread to list messages from.
+ /// 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.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response InternalGetMessages(string threadId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetMessages(threadId, limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfThreadMessage.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of messages that exist on a thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to list messages from.
+ /// 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.
+ /// 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 InternalGetMessagesAsync(string threadId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetMessages");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetMessagesRequest(threadId, 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 messages that exist on a thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to list messages from.
+ /// 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.
+ /// 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 InternalGetMessages(string threadId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetMessages");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetMessagesRequest(threadId, limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets an existing message from an existing thread.
+ /// The ID of the thread to retrieve the specified message from.
+ /// The ID of the message to retrieve from the specified thread.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetMessageAsync(string threadId, string messageId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetMessageAsync(threadId, messageId, context).ConfigureAwait(false);
+ return Response.FromValue(ThreadMessage.FromResponse(response), response);
+ }
+
+ /// Gets an existing message from an existing thread.
+ /// The ID of the thread to retrieve the specified message from.
+ /// The ID of the message to retrieve from the specified thread.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response GetMessage(string threadId, string messageId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetMessage(threadId, messageId, context);
+ return Response.FromValue(ThreadMessage.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets an existing message from an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to retrieve the specified message from.
+ /// The ID of the message to retrieve from the specified thread.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetMessageAsync(string threadId, string messageId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetMessage");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetMessageRequest(threadId, messageId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets an existing message from an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to retrieve the specified message from.
+ /// The ID of the message to retrieve from the specified thread.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetMessage(string threadId, string messageId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetMessage");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetMessageRequest(threadId, messageId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Modifies an existing message on an existing thread.
+ /// The ID of the thread containing the specified message to modify.
+ /// The ID of the message to modify on the specified thread.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> UpdateMessageAsync(string threadId, string messageId, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UpdateMessageRequest updateMessageRequest = new UpdateMessageRequest()
+ {
+ Metadata = metadata
+ };
+ Response response = await UpdateMessageAsync(threadId, messageId, updateMessageRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(ThreadMessage.FromResponse(response), response);
+ }
+
+ /// Modifies an existing message on an existing thread.
+ /// The ID of the thread containing the specified message to modify.
+ /// The ID of the message to modify on the specified thread.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response UpdateMessage(string threadId, string messageId, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UpdateMessageRequest updateMessageRequest = new UpdateMessageRequest()
+ {
+ Metadata = metadata
+ };
+ Response response = UpdateMessage(threadId, messageId, updateMessageRequest.ToRequestContent(), context);
+ return Response.FromValue(ThreadMessage.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing message on an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread containing the specified message to modify.
+ /// The ID of the message to modify on the specified thread.
+ /// 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.
+ /// or 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 UpdateMessageAsync(string threadId, string messageId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateMessage");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateMessageRequest(threadId, messageId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing message on an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread containing the specified message to modify.
+ /// The ID of the message to modify on the specified thread.
+ /// 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.
+ /// or 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 UpdateMessage(string threadId, string messageId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateMessage");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateMessageRequest(threadId, messageId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of previously uploaded files associated with a message from a thread.
+ /// The ID of the thread containing the message to list files from.
+ /// The ID of the message to list files from.
+ /// 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.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalGetMessageFilesAsync(string threadId, string messageId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetMessageFilesAsync(threadId, messageId, limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfMessageFile.FromResponse(response), response);
+ }
+
+ /// Gets a list of previously uploaded files associated with a message from a thread.
+ /// The ID of the thread containing the message to list files from.
+ /// The ID of the message to list files from.
+ /// 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.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response InternalGetMessageFiles(string threadId, string messageId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetMessageFiles(threadId, messageId, limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfMessageFile.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of previously uploaded files associated with a message from a thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread containing the message to list files from.
+ /// The ID of the message to list files from.
+ /// 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.
+ /// or is null.
+ /// or 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 InternalGetMessageFilesAsync(string threadId, string messageId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetMessageFiles");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetMessageFilesRequest(threadId, messageId, 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 previously uploaded files associated with a message from a thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread containing the message to list files from.
+ /// The ID of the message to list files from.
+ /// 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.
+ /// or is null.
+ /// or 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 InternalGetMessageFiles(string threadId, string messageId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetMessageFiles");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetMessageFilesRequest(threadId, messageId, limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets information about a file attachment to a message within a thread.
+ /// The ID of the thread containing the message to get information from.
+ /// The ID of the message to get information from.
+ /// The ID of the file to get information about.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetMessageFileAsync(string threadId, string messageId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetMessageFileAsync(threadId, messageId, fileId, context).ConfigureAwait(false);
+ return Response.FromValue(MessageFile.FromResponse(response), response);
+ }
+
+ /// Gets information about a file attachment to a message within a thread.
+ /// The ID of the thread containing the message to get information from.
+ /// The ID of the message to get information from.
+ /// The ID of the file to get information about.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public virtual Response GetMessageFile(string threadId, string messageId, string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetMessageFile(threadId, messageId, fileId, context);
+ return Response.FromValue(MessageFile.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets information about a file attachment to a message within a thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread containing the message to get information from.
+ /// The ID of the message to get information from.
+ /// The ID of the file to get information about.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// , or 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 GetMessageFileAsync(string threadId, string messageId, string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetMessageFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetMessageFileRequest(threadId, messageId, fileId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets information about a file attachment to a message within a thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread containing the message to get information from.
+ /// The ID of the message to get information from.
+ /// The ID of the file to get information about.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// , or 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 GetMessageFile(string threadId, string messageId, string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(messageId, nameof(messageId));
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetMessageFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetMessageFileRequest(threadId, messageId, fileId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a new run for an assistant thread.
+ /// The ID of the thread to run.
+ /// The ID of the assistant that should run the thread.
+ /// The overridden model name that the assistant should use to run the thread.
+ /// The overridden system instructions that the assistant should use to run the thread.
+ /// The overridden list of enabled tools that the assistant should use to run the thread.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ CreateRunRequest createRunRequest = new CreateRunRequest(assistantId)
+ {
+ OverrideModelName = overrideModelName,
+ OverrideInstructions = overrideInstructions,
+ Metadata = metadata
+ };
+ if (overrideTools != null)
+ {
+ foreach (var value in overrideTools)
+ {
+ createRunRequest.OverrideTools.Add(value);
+ }
+ }
+ CreateRunRequest createRunRequest0 = createRunRequest;
+ Response response = await CreateRunAsync(threadId, createRunRequest0.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ /// Creates a new run for an assistant thread.
+ /// The ID of the thread to run.
+ /// The ID of the assistant that should run the thread.
+ /// The overridden model name that the assistant should use to run the thread.
+ /// The overridden system instructions that the assistant should use to run the thread.
+ /// The overridden list of enabled tools that the assistant should use to run the thread.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(assistantId, nameof(assistantId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ CreateRunRequest createRunRequest = new CreateRunRequest(assistantId)
+ {
+ OverrideModelName = overrideModelName,
+ OverrideInstructions = overrideInstructions,
+ Metadata = metadata
+ };
+ if (overrideTools != null)
+ {
+ foreach (var value in overrideTools)
+ {
+ createRunRequest.OverrideTools.Add(value);
+ }
+ }
+ CreateRunRequest createRunRequest0 = createRunRequest;
+ Response response = CreateRun(threadId, createRunRequest0.ToRequestContent(), context);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new run for an assistant thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to run.
+ /// 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.
+ internal virtual async Task CreateRunAsync(string threadId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateRunRequest(threadId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new run for an assistant thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to run.
+ /// 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.
+ internal virtual Response CreateRun(string threadId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateRunRequest(threadId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of runs for a specified thread.
+ /// The ID of the thread to list runs from.
+ /// 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.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalGetRunsAsync(string threadId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetRunsAsync(threadId, limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfThreadRun.FromResponse(response), response);
+ }
+
+ /// Gets a list of runs for a specified thread.
+ /// The ID of the thread to list runs from.
+ /// 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.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response InternalGetRuns(string threadId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetRuns(threadId, limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of runs for a specified thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to list runs from.
+ /// 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.
+ /// 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 InternalGetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetRuns");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetRunsRequest(threadId, 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 runs for a specified thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to list runs from.
+ /// 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.
+ /// 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 InternalGetRuns(string threadId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetRuns");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetRunsRequest(threadId, limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets an existing run from an existing thread.
+ /// The ID of the thread to retrieve run information from.
+ /// The ID of the thread to retrieve information about.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetRunAsync(string threadId, string runId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetRunAsync(threadId, runId, context).ConfigureAwait(false);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ /// Gets an existing run from an existing thread.
+ /// The ID of the thread to retrieve run information from.
+ /// The ID of the thread to retrieve information about.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response GetRun(string threadId, string runId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetRun(threadId, runId, context);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets an existing run from an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to retrieve run information from.
+ /// The ID of the thread to retrieve information about.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetRunAsync(string threadId, string runId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetRunRequest(threadId, runId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets an existing run from an existing thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread to retrieve run information from.
+ /// The ID of the thread to retrieve information about.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetRun(string threadId, string runId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetRunRequest(threadId, runId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Modifies an existing thread run.
+ /// The ID of the thread associated with the specified run.
+ /// The ID of the run to modify.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> UpdateRunAsync(string threadId, string runId, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UpdateRunRequest updateRunRequest = new UpdateRunRequest()
+ {
+ Metadata = metadata
+ };
+ Response response = await UpdateRunAsync(threadId, runId, updateRunRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ /// Modifies an existing thread run.
+ /// The ID of the thread associated with the specified run.
+ /// The ID of the run to modify.
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response UpdateRun(string threadId, string runId, IDictionary metadata = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UpdateRunRequest updateRunRequest = new UpdateRunRequest()
+ {
+ Metadata = metadata
+ };
+ Response response = UpdateRun(threadId, runId, updateRunRequest.ToRequestContent(), context);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing thread run.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread associated with the specified run.
+ /// The ID of the run 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.
+ /// or 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 UpdateRunAsync(string threadId, string runId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateRunRequest(threadId, runId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Modifies an existing thread run.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread associated with the specified run.
+ /// The ID of the run 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.
+ /// or 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 UpdateRun(string threadId, string runId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UpdateRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdateRunRequest(threadId, runId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.
+ /// The ID of the thread that was run.
+ /// The ID of the run that requires tool outputs.
+ /// The list of tool outputs requested by tool calls from the specified run.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> SubmitToolOutputsToRunAsync(string threadId, string runId, IEnumerable toolOutputs, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNull(toolOutputs, nameof(toolOutputs));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ SubmitToolOutputsToRunRequest submitToolOutputsToRunRequest = new SubmitToolOutputsToRunRequest(toolOutputs.ToList());
+ Response response = await SubmitToolOutputsToRunAsync(threadId, runId, submitToolOutputsToRunRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ /// Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.
+ /// The ID of the thread that was run.
+ /// The ID of the run that requires tool outputs.
+ /// The list of tool outputs requested by tool calls from the specified run.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response SubmitToolOutputsToRun(string threadId, string runId, IEnumerable toolOutputs, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNull(toolOutputs, nameof(toolOutputs));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ SubmitToolOutputsToRunRequest submitToolOutputsToRunRequest = new SubmitToolOutputsToRunRequest(toolOutputs.ToList());
+ Response response = SubmitToolOutputsToRun(threadId, runId, submitToolOutputsToRunRequest.ToRequestContent(), context);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread that was run.
+ /// The ID of the run that requires tool outputs.
+ /// 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.
+ /// or 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 SubmitToolOutputsToRunAsync(string threadId, string runId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.SubmitToolOutputsToRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateSubmitToolOutputsToRunRequest(threadId, runId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread that was run.
+ /// The ID of the run that requires tool outputs.
+ /// 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.
+ /// or 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 SubmitToolOutputsToRun(string threadId, string runId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.SubmitToolOutputsToRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateSubmitToolOutputsToRunRequest(threadId, runId, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Cancels a run of an in progress thread.
+ /// The ID of the thread being run.
+ /// The ID of the run to cancel.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> CancelRunAsync(string threadId, string runId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await CancelRunAsync(threadId, runId, context).ConfigureAwait(false);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ /// Cancels a run of an in progress thread.
+ /// The ID of the thread being run.
+ /// The ID of the run to cancel.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response CancelRun(string threadId, string runId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = CancelRun(threadId, runId, context);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Cancels a run of an in progress thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread being run.
+ /// The ID of the run to cancel.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 CancelRunAsync(string threadId, string runId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CancelRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCancelRunRequest(threadId, runId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Cancels a run of an in progress thread.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread being run.
+ /// The ID of the run to cancel.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 CancelRun(string threadId, string runId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CancelRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCancelRunRequest(threadId, runId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a new assistant thread and immediately starts a run using that new thread.
+ /// The details used when creating and immediately running a new assistant thread.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> CreateThreadAndRunAsync(CreateAndRunThreadOptions createAndRunThreadOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(createAndRunThreadOptions, nameof(createAndRunThreadOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = createAndRunThreadOptions.ToRequestContent();
+ Response response = await CreateThreadAndRunAsync(content, context).ConfigureAwait(false);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ /// Creates a new assistant thread and immediately starts a run using that new thread.
+ /// The details used when creating and immediately running a new assistant thread.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response CreateThreadAndRun(CreateAndRunThreadOptions createAndRunThreadOptions, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(createAndRunThreadOptions, nameof(createAndRunThreadOptions));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ using RequestContent content = createAndRunThreadOptions.ToRequestContent();
+ Response response = CreateThreadAndRun(content, context);
+ return Response.FromValue(ThreadRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new assistant 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.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual async Task CreateThreadAndRunAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.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 assistant 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.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual Response CreateThreadAndRun(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.CreateThreadAndRun");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateThreadAndRunRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a single run step from a thread run.
+ /// The ID of the thread that was run.
+ /// The ID of the specific run to retrieve the step from.
+ /// The ID of the step to retrieve information about.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetRunStepAsync(string threadId, string runId, string stepId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNullOrEmpty(stepId, nameof(stepId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetRunStepAsync(threadId, runId, stepId, context).ConfigureAwait(false);
+ return Response.FromValue(RunStep.FromResponse(response), response);
+ }
+
+ /// Gets a single run step from a thread run.
+ /// The ID of the thread that was run.
+ /// The ID of the specific run to retrieve the step from.
+ /// The ID of the step to retrieve information about.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public virtual Response GetRunStep(string threadId, string runId, string stepId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNullOrEmpty(stepId, nameof(stepId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetRunStep(threadId, runId, stepId, context);
+ return Response.FromValue(RunStep.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a single run step from a thread run.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread that was run.
+ /// The ID of the specific run to retrieve the step from.
+ /// The ID of the step to retrieve information about.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// , or 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 GetRunStepAsync(string threadId, string runId, string stepId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNullOrEmpty(stepId, nameof(stepId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetRunStep");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetRunStepRequest(threadId, runId, stepId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets a single run step from a thread run.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread that was run.
+ /// The ID of the specific run to retrieve the step from.
+ /// The ID of the step to retrieve information about.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// , or 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 GetRunStep(string threadId, string runId, string stepId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+ Argument.AssertNotNullOrEmpty(stepId, nameof(stepId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetRunStep");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetRunStepRequest(threadId, runId, stepId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of run steps from a thread run.
+ /// The ID of the thread that was run.
+ /// The ID of the run to list steps from.
+ /// 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.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalGetRunStepsAsync(string threadId, string runId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalGetRunStepsAsync(threadId, runId, limit, order?.ToString(), after, before, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIPageableListOfRunStep.FromResponse(response), response);
+ }
+
+ /// Gets a list of run steps from a thread run.
+ /// The ID of the thread that was run.
+ /// The ID of the run to list steps from.
+ /// 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.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public virtual Response InternalGetRunSteps(string threadId, string runId, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalGetRunSteps(threadId, runId, limit, order?.ToString(), after, before, context);
+ return Response.FromValue(OpenAIPageableListOfRunStep.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of run steps from a thread run.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread that was run.
+ /// The ID of the run to list steps from.
+ /// 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.
+ /// or is null.
+ /// or 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 InternalGetRunStepsAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetRunSteps");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetRunStepsRequest(threadId, runId, 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 run steps from a thread run.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the thread that was run.
+ /// The ID of the run to list steps from.
+ /// 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.
+ /// or is null.
+ /// or 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 InternalGetRunSteps(string threadId, string runId, int? limit, string order, string after, string before, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
+ Argument.AssertNotNullOrEmpty(runId, nameof(runId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalGetRunSteps");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalGetRunStepsRequest(threadId, runId, limit, order, after, before, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of previously uploaded files.
+ /// A value that, when provided, limits list results to files matching the corresponding purpose.
+ /// The cancellation token to use.
+ public virtual async Task> InternalListFilesAsync(OpenAIFilePurpose? purpose = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalListFilesAsync(purpose?.ToString(), context).ConfigureAwait(false);
+ return Response.FromValue(InternalFileListResponse.FromResponse(response), response);
+ }
+
+ /// Gets a list of previously uploaded files.
+ /// A value that, when provided, limits list results to files matching the corresponding purpose.
+ /// The cancellation token to use.
+ public virtual Response InternalListFiles(OpenAIFilePurpose? purpose = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalListFiles(purpose?.ToString(), context);
+ return Response.FromValue(InternalFileListResponse.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of previously uploaded files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// A value that, when provided, limits list results to files matching the corresponding purpose. Allowed values: "fine-tune" | "fine-tune-results" | "assistants" | "assistants_output".
+ /// 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 InternalListFilesAsync(string purpose, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalListFiles");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalListFilesRequest(purpose, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets a list of previously uploaded files.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// A value that, when provided, limits list results to files matching the corresponding purpose. Allowed values: "fine-tune" | "fine-tune-results" | "assistants" | "assistants_output".
+ /// 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 InternalListFiles(string purpose, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalListFiles");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalListFilesRequest(purpose, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Uploads a file for use by other operations.
+ /// The file data (not filename) to upload.
+ /// The intended purpose of the file.
+ /// A filename to associate with the uploaded data.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> UploadFileAsync(BinaryData data, OpenAIFilePurpose purpose, string filename = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(data, nameof(data));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UploadFileRequest uploadFileRequest = new UploadFileRequest(data, purpose)
+ {
+ Filename = filename
+ };
+ Response response = await UploadFileAsync(uploadFileRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIFile.FromResponse(response), response);
+ }
+
+ /// Uploads a file for use by other operations.
+ /// The file data (not filename) to upload.
+ /// The intended purpose of the file.
+ /// A filename to associate with the uploaded data.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response UploadFile(BinaryData data, OpenAIFilePurpose purpose, string filename = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(data, nameof(data));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ UploadFileRequest uploadFileRequest = new UploadFileRequest(data, purpose)
+ {
+ Filename = filename
+ };
+ Response response = UploadFile(uploadFileRequest.ToRequestContent(), context);
+ return Response.FromValue(OpenAIFile.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Uploads a file for use by other operations.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual async Task UploadFileAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UploadFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUploadFileRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Uploads a file for use by other operations.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// 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.
+ internal virtual Response UploadFile(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.UploadFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUploadFileRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete a previously uploaded file.
+ /// The ID of the file to delete.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> InternalDeleteFileAsync(string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await InternalDeleteFileAsync(fileId, context).ConfigureAwait(false);
+ return Response.FromValue(InternalFileDeletionStatus.FromResponse(response), response);
+ }
+
+ /// Delete a previously uploaded file.
+ /// The ID of the file to delete.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response InternalDeleteFile(string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = InternalDeleteFile(fileId, context);
+ return Response.FromValue(InternalFileDeletionStatus.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Delete a previously uploaded file.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the file to delete.
+ /// 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 InternalDeleteFileAsync(string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteFileRequest(fileId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Delete a previously uploaded file.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the file to delete.
+ /// 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 InternalDeleteFile(string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.InternalDeleteFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateInternalDeleteFileRequest(fileId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Returns information about a specific file. Does not retrieve file content.
+ /// The ID of the file to retrieve.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetFileAsync(string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetFileAsync(fileId, context).ConfigureAwait(false);
+ return Response.FromValue(OpenAIFile.FromResponse(response), response);
+ }
+
+ /// Returns information about a specific file. Does not retrieve file content.
+ /// The ID of the file to retrieve.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetFile(string fileId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetFile(fileId, context);
+ return Response.FromValue(OpenAIFile.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Returns information about a specific file. Does not retrieve file content.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the file to retrieve.
+ /// 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 GetFileAsync(string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetFileRequest(fileId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Returns information about a specific file. Does not retrieve file content.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the file to retrieve.
+ /// 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 GetFile(string fileId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
+
+ using var scope = ClientDiagnostics.CreateScope("AssistantsClient.GetFile");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetFileRequest(fileId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ internal HttpMessage CreateCreateAssistantRequest(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);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalGetAssistantsRequest(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);
+ 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 CreateGetAssistantRequest(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);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpdateAssistantRequest(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);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalDeleteAssistantRequest(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);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateLinkAssistantFileRequest(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.AppendPath("/files", false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalGetAssistantFilesRequest(string assistantId, 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.AppendPath(assistantId, true);
+ uri.AppendPath("/files", false);
+ 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 CreateGetAssistantFileRequest(string assistantId, string fileId, 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.AppendPath("/files/", false);
+ uri.AppendPath(fileId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateInternalUnlinkAssistantFileRequest(string assistantId, string fileId, 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.AppendPath("/files/", false);
+ uri.AppendPath(fileId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateThreadRequest(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", false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateGetThreadRequest(string threadId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpdateThreadRequest(string threadId, 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/", false);
+ uri.AppendPath(threadId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalDeleteThreadRequest(string threadId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateMessageRequest(string threadId, 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/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/messages", false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalGetMessagesRequest(string threadId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/messages", false);
+ 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 CreateGetMessageRequest(string threadId, string messageId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/messages/", false);
+ uri.AppendPath(messageId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpdateMessageRequest(string threadId, string messageId, 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/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/messages/", false);
+ uri.AppendPath(messageId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalGetMessageFilesRequest(string threadId, string messageId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/messages/", false);
+ uri.AppendPath(messageId, true);
+ uri.AppendPath("/files", false);
+ 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 CreateGetMessageFileRequest(string threadId, string messageId, string fileId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/messages/", false);
+ uri.AppendPath(messageId, true);
+ uri.AppendPath("/files/", false);
+ uri.AppendPath(fileId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateRunRequest(string threadId, 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/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs", false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalGetRunsRequest(string threadId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs", false);
+ 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 CreateGetRunRequest(string threadId, string runId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs/", false);
+ uri.AppendPath(runId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpdateRunRequest(string threadId, string runId, 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/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs/", false);
+ uri.AppendPath(runId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateSubmitToolOutputsToRunRequest(string threadId, string runId, 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/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs/", false);
+ uri.AppendPath(runId, true);
+ uri.AppendPath("/submit_tool_outputs", false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateCancelRunRequest(string threadId, string runId, 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/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs/", false);
+ uri.AppendPath(runId, true);
+ uri.AppendPath("/cancel", false);
+ 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);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateGetRunStepRequest(string threadId, string runId, string stepId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs/", false);
+ uri.AppendPath(runId, true);
+ uri.AppendPath("/steps/", false);
+ uri.AppendPath(stepId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateInternalGetRunStepsRequest(string threadId, string runId, 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("/threads/", false);
+ uri.AppendPath(threadId, true);
+ uri.AppendPath("/runs/", false);
+ uri.AppendPath(runId, true);
+ uri.AppendPath("/steps", false);
+ 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 CreateInternalListFilesRequest(string purpose, 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("/files", false);
+ if (purpose != null)
+ {
+ uri.AppendQuery("purpose", purpose, true);
+ }
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUploadFileRequest(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("/files", false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("content-type", "multipart/form-data");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateInternalDeleteFileRequest(string fileId, 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("/files/", false);
+ uri.AppendPath(fileId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetFileRequest(string fileId, 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("/files/", false);
+ uri.AppendPath(fileId, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ 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/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantsClientOptions.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantsClientOptions.cs
new file mode 100644
index 0000000000000..a847db2052bd4
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/AssistantsClientOptions.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.OpenAI.Assistants
+{
+ /// Client options for AssistantsClient.
+ public partial class AssistantsClientOptions : ClientOptions
+ {
+ private const ServiceVersion LatestVersion = ServiceVersion.V2024_02_15_Preview;
+
+ /// The version of the service to use.
+ public enum ServiceVersion
+ {
+ /// Service version "2024-02-15-preview".
+ V2024_02_15_Preview = 1,
+ }
+
+ internal string Version { get; }
+
+ /// Initializes new instance of AssistantsClientOptions.
+ public AssistantsClientOptions(ServiceVersion version = LatestVersion)
+ {
+ Version = version switch
+ {
+ ServiceVersion.V2024_02_15_Preview => "2024-02-15-preview",
+ _ => throw new NotSupportedException()
+ };
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageOutput.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageOutput.Serialization.cs
new file mode 100644
index 0000000000000..f003236cc8a0b
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageOutput.Serialization.cs
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class CodeInterpreterImageOutput
+ {
+ internal static CodeInterpreterImageOutput DeserializeCodeInterpreterImageOutput(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ CodeInterpreterImageReference image = default;
+ string type = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("image"u8))
+ {
+ image = CodeInterpreterImageReference.DeserializeCodeInterpreterImageReference(property.Value);
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ }
+ return new CodeInterpreterImageOutput(type, image);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new CodeInterpreterImageOutput FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCodeInterpreterImageOutput(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageOutput.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageOutput.cs
new file mode 100644
index 0000000000000..942b1a12d5f63
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageOutput.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// A representation of an image output emitted by a code interpreter tool in response to a tool call by the model.
+ internal partial class CodeInterpreterImageOutput : CodeInterpreterToolCallOutput
+ {
+ /// Initializes a new instance of .
+ /// Referential information for the image associated with this output.
+ /// is null.
+ internal CodeInterpreterImageOutput(CodeInterpreterImageReference image)
+ {
+ Argument.AssertNotNull(image, nameof(image));
+
+ Type = "image";
+ Image = image;
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// Referential information for the image associated with this output.
+ internal CodeInterpreterImageOutput(string type, CodeInterpreterImageReference image) : base(type)
+ {
+ Image = image;
+ }
+
+ /// Referential information for the image associated with this output.
+ public CodeInterpreterImageReference Image { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageReference.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageReference.Serialization.cs
new file mode 100644
index 0000000000000..bc77e14dbfab9
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageReference.Serialization.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class CodeInterpreterImageReference
+ {
+ internal static CodeInterpreterImageReference DeserializeCodeInterpreterImageReference(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string fileId = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("file_id"u8))
+ {
+ fileId = property.Value.GetString();
+ continue;
+ }
+ }
+ return new CodeInterpreterImageReference(fileId);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static CodeInterpreterImageReference FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCodeInterpreterImageReference(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageReference.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageReference.cs
new file mode 100644
index 0000000000000..6d02bf9a5824b
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterImageReference.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// An image reference emitted by a code interpreter tool in response to a tool call by the model.
+ internal partial class CodeInterpreterImageReference
+ {
+ /// Initializes a new instance of .
+ /// The ID of the file associated with this image.
+ /// is null.
+ internal CodeInterpreterImageReference(string fileId)
+ {
+ Argument.AssertNotNull(fileId, nameof(fileId));
+
+ FileId = fileId;
+ }
+
+ /// The ID of the file associated with this image.
+ public string FileId { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterLogOutput.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterLogOutput.Serialization.cs
new file mode 100644
index 0000000000000..bd37e8a83d38c
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterLogOutput.Serialization.cs
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class CodeInterpreterLogOutput
+ {
+ internal static CodeInterpreterLogOutput DeserializeCodeInterpreterLogOutput(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string logs = default;
+ string type = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("logs"u8))
+ {
+ logs = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ }
+ return new CodeInterpreterLogOutput(type, logs);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new CodeInterpreterLogOutput FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCodeInterpreterLogOutput(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterLogOutput.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterLogOutput.cs
new file mode 100644
index 0000000000000..214b008484427
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterLogOutput.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// A representation of a log output emitted by a code interpreter tool in response to a tool call by the model.
+ internal partial class CodeInterpreterLogOutput : CodeInterpreterToolCallOutput
+ {
+ /// Initializes a new instance of .
+ /// The serialized log output emitted by the code interpreter.
+ /// is null.
+ internal CodeInterpreterLogOutput(string logs)
+ {
+ Argument.AssertNotNull(logs, nameof(logs));
+
+ Type = "logs";
+ Logs = logs;
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// The serialized log output emitted by the code interpreter.
+ internal CodeInterpreterLogOutput(string type, string logs) : base(type)
+ {
+ Logs = logs;
+ }
+
+ /// The serialized log output emitted by the code interpreter.
+ public string Logs { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCall.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCall.Serialization.cs
new file mode 100644
index 0000000000000..d80e710382f68
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCall.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class CodeInterpreterToolCall
+ {
+ internal static CodeInterpreterToolCall DeserializeCodeInterpreterToolCall(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ InternalCodeInterpreterToolCallDetails codeInterpreter = default;
+ string type = default;
+ string id = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("code_interpreter"u8))
+ {
+ codeInterpreter = InternalCodeInterpreterToolCallDetails.DeserializeInternalCodeInterpreterToolCallDetails(property.Value);
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ }
+ return new CodeInterpreterToolCall(type, id, codeInterpreter);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new CodeInterpreterToolCall FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCodeInterpreterToolCall(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCall.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCall.cs
new file mode 100644
index 0000000000000..33639e3ce4d75
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCall.cs
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ ///
+ /// A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that
+ /// represents inputs and outputs consumed and emitted by the code interpreter.
+ ///
+ public partial class CodeInterpreterToolCall : ToolCall
+ {
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// The details of the tool call to the code interpreter tool.
+ /// or is null.
+ internal CodeInterpreterToolCall(string id, InternalCodeInterpreterToolCallDetails internalDetails) : base(id)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(internalDetails, nameof(internalDetails));
+
+ Type = "code_interpreter";
+ InternalDetails = internalDetails;
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// The details of the tool call to the code interpreter tool.
+ internal CodeInterpreterToolCall(string type, string id, InternalCodeInterpreterToolCallDetails internalDetails) : base(type, id)
+ {
+ InternalDetails = internalDetails;
+ }
+
+ /// The details of the tool call to the code interpreter tool.
+ public InternalCodeInterpreterToolCallDetails InternalDetails { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCallOutput.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCallOutput.Serialization.cs
new file mode 100644
index 0000000000000..71ad82fedf705
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCallOutput.Serialization.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class CodeInterpreterToolCallOutput
+ {
+ internal static CodeInterpreterToolCallOutput DeserializeCodeInterpreterToolCallOutput(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ if (element.TryGetProperty("type", out JsonElement discriminator))
+ {
+ switch (discriminator.GetString())
+ {
+ case "logs": return CodeInterpreterLogOutput.DeserializeCodeInterpreterLogOutput(element);
+ case "image": return CodeInterpreterImageOutput.DeserializeCodeInterpreterImageOutput(element);
+ }
+ }
+ return UnknownCodeInterpreterToolCallOutput.DeserializeUnknownCodeInterpreterToolCallOutput(element);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static CodeInterpreterToolCallOutput FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCodeInterpreterToolCallOutput(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCallOutput.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCallOutput.cs
new file mode 100644
index 0000000000000..1bdebefe97a28
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolCallOutput.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ ///
+ /// An abstract representation of an emitted output from a code interpreter tool.
+ /// 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 .
+ ///
+ internal abstract partial class CodeInterpreterToolCallOutput
+ {
+ /// Initializes a new instance of .
+ protected CodeInterpreterToolCallOutput()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ internal CodeInterpreterToolCallOutput(string type)
+ {
+ Type = type;
+ }
+
+ /// The object type.
+ internal string Type { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolDefinition.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolDefinition.Serialization.cs
new file mode 100644
index 0000000000000..e86daf800d775
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolDefinition.Serialization.cs
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class CodeInterpreterToolDefinition : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(Type);
+ writer.WriteEndObject();
+ }
+
+ internal static CodeInterpreterToolDefinition DeserializeCodeInterpreterToolDefinition(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string type = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ }
+ return new CodeInterpreterToolDefinition(type);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new CodeInterpreterToolDefinition FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCodeInterpreterToolDefinition(document.RootElement);
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolDefinition.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolDefinition.cs
new file mode 100644
index 0000000000000..a7109a1953fa3
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CodeInterpreterToolDefinition.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The input definition information for a code interpreter tool as used to configure an assistant.
+ public partial class CodeInterpreterToolDefinition : ToolDefinition
+ {
+ /// Initializes a new instance of .
+ public CodeInterpreterToolDefinition()
+ {
+ Type = "code_interpreter";
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ internal CodeInterpreterToolDefinition(string type) : base(type)
+ {
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAndRunThreadOptions.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAndRunThreadOptions.Serialization.cs
new file mode 100644
index 0000000000000..fa7217f816f9a
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAndRunThreadOptions.Serialization.cs
@@ -0,0 +1,74 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class CreateAndRunThreadOptions : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("assistant_id"u8);
+ writer.WriteStringValue(AssistantId);
+ if (Optional.IsDefined(Thread))
+ {
+ writer.WritePropertyName("thread"u8);
+ writer.WriteObjectValue(Thread);
+ }
+ if (Optional.IsDefined(OverrideModelName))
+ {
+ writer.WritePropertyName("model"u8);
+ writer.WriteStringValue(OverrideModelName);
+ }
+ if (Optional.IsDefined(OverrideInstructions))
+ {
+ writer.WritePropertyName("instructions"u8);
+ writer.WriteStringValue(OverrideInstructions);
+ }
+ if (Optional.IsCollectionDefined(OverrideTools))
+ {
+ writer.WritePropertyName("tools"u8);
+ writer.WriteStartArray();
+ foreach (var item in OverrideTools)
+ {
+ writer.WriteObjectValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Metadata))
+ {
+ if (Metadata != null)
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAndRunThreadOptions.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAndRunThreadOptions.cs
new file mode 100644
index 0000000000000..d663adb7dde8f
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAndRunThreadOptions.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The details used when creating and immediately running a new assistant thread.
+ public partial class CreateAndRunThreadOptions
+ {
+ /// Initializes a new instance of .
+ /// The ID of the assistant for which the thread should be created.
+ /// is null.
+ public CreateAndRunThreadOptions(string assistantId)
+ {
+ Argument.AssertNotNull(assistantId, nameof(assistantId));
+
+ AssistantId = assistantId;
+ OverrideTools = new ChangeTrackingList();
+ Metadata = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the assistant for which the thread should be created.
+ /// The details used to create the new thread.
+ /// The overridden model that the assistant should use to run the thread.
+ /// The overridden system instructions the assistant should use to run the thread.
+ /// The overridden list of enabled tools the assistant should use to run the thread.
+ /// 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.
+ internal CreateAndRunThreadOptions(string assistantId, AssistantThreadCreationOptions thread, string overrideModelName, string overrideInstructions, IList overrideTools, IDictionary metadata)
+ {
+ AssistantId = assistantId;
+ Thread = thread;
+ OverrideModelName = overrideModelName;
+ OverrideInstructions = overrideInstructions;
+ OverrideTools = overrideTools;
+ Metadata = metadata;
+ }
+
+ /// The ID of the assistant for which the thread should be created.
+ public string AssistantId { get; }
+ /// The details used to create the new thread.
+ public AssistantThreadCreationOptions Thread { get; set; }
+ /// The overridden model that the assistant should use to run the thread.
+ public string OverrideModelName { get; set; }
+ /// The overridden system instructions the assistant should use to run the thread.
+ public string OverrideInstructions { get; set; }
+ ///
+ /// The overridden list of enabled tools the assistant should use to run the thread.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , and .
+ ///
+ public IList OverrideTools { get; }
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ public IDictionary Metadata { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAssistantFileRequest.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAssistantFileRequest.Serialization.cs
new file mode 100644
index 0000000000000..16635b518b79c
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAssistantFileRequest.Serialization.cs
@@ -0,0 +1,31 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class CreateAssistantFileRequest : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("file_id"u8);
+ writer.WriteStringValue(FileId);
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAssistantFileRequest.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAssistantFileRequest.cs
new file mode 100644
index 0000000000000..762b79d212ed8
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateAssistantFileRequest.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The CreateAssistantFileRequest.
+ internal partial class CreateAssistantFileRequest
+ {
+ /// Initializes a new instance of .
+ /// The ID of the previously uploaded file to attach.
+ /// is null.
+ public CreateAssistantFileRequest(string fileId)
+ {
+ Argument.AssertNotNull(fileId, nameof(fileId));
+
+ FileId = fileId;
+ }
+
+ /// The ID of the previously uploaded file to attach.
+ public string FileId { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateMessageRequest.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateMessageRequest.Serialization.cs
new file mode 100644
index 0000000000000..14c7ce78000ab
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateMessageRequest.Serialization.cs
@@ -0,0 +1,61 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class CreateMessageRequest : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("role"u8);
+ writer.WriteStringValue(Role.ToString());
+ writer.WritePropertyName("content"u8);
+ writer.WriteStringValue(Content);
+ if (Optional.IsCollectionDefined(FileIds))
+ {
+ writer.WritePropertyName("file_ids"u8);
+ writer.WriteStartArray();
+ foreach (var item in FileIds)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Metadata))
+ {
+ if (Metadata != null)
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateMessageRequest.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateMessageRequest.cs
new file mode 100644
index 0000000000000..5104620eb279b
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateMessageRequest.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The CreateMessageRequest.
+ internal partial class CreateMessageRequest
+ {
+ /// Initializes a new instance of .
+ /// The role to associate with the new message.
+ /// The textual content for the new message.
+ /// is null.
+ public CreateMessageRequest(MessageRole role, string content)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ Role = role;
+ Content = content;
+ FileIds = new ChangeTrackingList();
+ Metadata = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The role to associate with the new message.
+ /// The textual content for the new message.
+ /// A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.
+ /// 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.
+ internal CreateMessageRequest(MessageRole role, string content, IList fileIds, IDictionary metadata)
+ {
+ Role = role;
+ Content = content;
+ FileIds = fileIds;
+ Metadata = metadata;
+ }
+
+ /// The role to associate with the new message.
+ public MessageRole Role { get; }
+ /// The textual content for the new message.
+ public string Content { get; }
+ /// A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.
+ public IList FileIds { get; }
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ public IDictionary Metadata { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateRunRequest.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateRunRequest.Serialization.cs
new file mode 100644
index 0000000000000..efc7a99383019
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateRunRequest.Serialization.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class CreateRunRequest : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("assistant_id"u8);
+ writer.WriteStringValue(AssistantId);
+ if (Optional.IsDefined(OverrideModelName))
+ {
+ writer.WritePropertyName("model"u8);
+ writer.WriteStringValue(OverrideModelName);
+ }
+ if (Optional.IsDefined(OverrideInstructions))
+ {
+ writer.WritePropertyName("instructions"u8);
+ writer.WriteStringValue(OverrideInstructions);
+ }
+ if (Optional.IsCollectionDefined(OverrideTools))
+ {
+ writer.WritePropertyName("tools"u8);
+ writer.WriteStartArray();
+ foreach (var item in OverrideTools)
+ {
+ writer.WriteObjectValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Metadata))
+ {
+ if (Metadata != null)
+ {
+ writer.WritePropertyName("metadata"u8);
+ writer.WriteStartObject();
+ foreach (var item in Metadata)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull("metadata");
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateRunRequest.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateRunRequest.cs
new file mode 100644
index 0000000000000..62c1f406617c5
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/CreateRunRequest.cs
@@ -0,0 +1,59 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The CreateRunRequest.
+ internal partial class CreateRunRequest
+ {
+ /// Initializes a new instance of .
+ /// The ID of the assistant that should run the thread.
+ /// is null.
+ public CreateRunRequest(string assistantId)
+ {
+ Argument.AssertNotNull(assistantId, nameof(assistantId));
+
+ AssistantId = assistantId;
+ OverrideTools = new ChangeTrackingList();
+ Metadata = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the assistant that should run the thread.
+ /// The overridden model name that the assistant should use to run the thread.
+ /// The overridden system instructions that the assistant should use to run the thread.
+ /// The overridden list of enabled tools that the assistant should use to run the thread.
+ /// 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.
+ internal CreateRunRequest(string assistantId, string overrideModelName, string overrideInstructions, IList overrideTools, IDictionary metadata)
+ {
+ AssistantId = assistantId;
+ OverrideModelName = overrideModelName;
+ OverrideInstructions = overrideInstructions;
+ OverrideTools = overrideTools;
+ Metadata = metadata;
+ }
+
+ /// The ID of the assistant that should run the thread.
+ public string AssistantId { get; }
+ /// The overridden model name that the assistant should use to run the thread.
+ public string OverrideModelName { get; set; }
+ /// The overridden system instructions that the assistant should use to run the thread.
+ public string OverrideInstructions { get; set; }
+ ///
+ /// The overridden list of enabled tools that the assistant should use to run the thread.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , and .
+ ///
+ public IList OverrideTools { get; }
+ /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
+ public IDictionary Metadata { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolCall.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolCall.Serialization.cs
new file mode 100644
index 0000000000000..2b7e33546f652
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolCall.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class FunctionToolCall
+ {
+ internal static FunctionToolCall DeserializeFunctionToolCall(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ InternalFunctionToolCallDetails function = default;
+ string type = default;
+ string id = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("function"u8))
+ {
+ function = InternalFunctionToolCallDetails.DeserializeInternalFunctionToolCallDetails(property.Value);
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ }
+ return new FunctionToolCall(type, id, function);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new FunctionToolCall FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeFunctionToolCall(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolCall.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolCall.cs
new file mode 100644
index 0000000000000..cd4ecf83c0455
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolCall.cs
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ ///
+ /// A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs
+ /// and output consumed and emitted by the specified function.
+ ///
+ public partial class FunctionToolCall : ToolCall
+ {
+ /// Initializes a new instance of .
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// The detailed information about the function called by the model.
+ /// or is null.
+ internal FunctionToolCall(string id, InternalFunctionToolCallDetails internalDetails) : base(id)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(internalDetails, nameof(internalDetails));
+
+ Type = "function";
+ InternalDetails = internalDetails;
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// The ID of the tool call. This ID must be referenced when you submit tool outputs.
+ /// The detailed information about the function called by the model.
+ internal FunctionToolCall(string type, string id, InternalFunctionToolCallDetails internalDetails) : base(type, id)
+ {
+ InternalDetails = internalDetails;
+ }
+
+ /// The detailed information about the function called by the model.
+ public InternalFunctionToolCallDetails InternalDetails { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolDefinition.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolDefinition.Serialization.cs
new file mode 100644
index 0000000000000..b27e41a52a5ff
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolDefinition.Serialization.cs
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class FunctionToolDefinition : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("function"u8);
+ writer.WriteObjectValue(InternalFunction);
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(Type);
+ writer.WriteEndObject();
+ }
+
+ internal static FunctionToolDefinition DeserializeFunctionToolDefinition(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ InternalFunctionDefinition function = default;
+ string type = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("function"u8))
+ {
+ function = InternalFunctionDefinition.DeserializeInternalFunctionDefinition(property.Value);
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ }
+ return new FunctionToolDefinition(type, function);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new FunctionToolDefinition FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeFunctionToolDefinition(document.RootElement);
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolDefinition.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolDefinition.cs
new file mode 100644
index 0000000000000..36b364b2fb8b1
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/FunctionToolDefinition.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The input definition information for a function tool as used to configure an assistant.
+ public partial class FunctionToolDefinition : ToolDefinition
+ {
+ /// Initializes a new instance of .
+ /// The definition of the concrete function that the function tool should call.
+ /// is null.
+ public FunctionToolDefinition(InternalFunctionDefinition internalFunction)
+ {
+ Argument.AssertNotNull(internalFunction, nameof(internalFunction));
+
+ Type = "function";
+ InternalFunction = internalFunction;
+ }
+
+ /// Initializes a new instance of .
+ /// The object type.
+ /// The definition of the concrete function that the function tool should call.
+ internal FunctionToolDefinition(string type, InternalFunctionDefinition internalFunction) : base(type)
+ {
+ InternalFunction = internalFunction;
+ }
+
+ /// The definition of the concrete function that the function tool should call.
+ public InternalFunctionDefinition InternalFunction { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatus.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatus.Serialization.cs
new file mode 100644
index 0000000000000..234d72d2f1f20
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatus.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class InternalAssistantDeletionStatus
+ {
+ internal static InternalAssistantDeletionStatus DeserializeInternalAssistantDeletionStatus(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ bool deleted = default;
+ InternalAssistantDeletionStatusObject @object = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("deleted"u8))
+ {
+ deleted = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new InternalAssistantDeletionStatusObject(property.Value.GetString());
+ continue;
+ }
+ }
+ return new InternalAssistantDeletionStatus(id, deleted, @object);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalAssistantDeletionStatus FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalAssistantDeletionStatus(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatus.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatus.cs
new file mode 100644
index 0000000000000..286fefd9c951e
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatus.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The status of an assistant deletion operation.
+ public partial class InternalAssistantDeletionStatus
+ {
+ /// Initializes a new instance of .
+ /// The ID of the resource specified for deletion.
+ /// A value indicating whether deletion was successful.
+ /// is null.
+ internal InternalAssistantDeletionStatus(string id, bool deleted)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+
+ Id = id;
+ Deleted = deleted;
+ }
+
+ /// 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 'assistant.deleted'.
+ internal InternalAssistantDeletionStatus(string id, bool deleted, InternalAssistantDeletionStatusObject @object)
+ {
+ Id = id;
+ Deleted = deleted;
+ Object = @object;
+ }
+
+ /// The ID of the resource specified for deletion.
+ public string Id { get; }
+ /// A value indicating whether deletion was successful.
+ public bool Deleted { get; }
+ /// The object type, which is always 'assistant.deleted'.
+ public InternalAssistantDeletionStatusObject Object { get; } = InternalAssistantDeletionStatusObject.AssistantDeleted;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatusObject.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatusObject.cs
new file mode 100644
index 0000000000000..7359266165cd2
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantDeletionStatusObject.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.OpenAI.Assistants
+{
+ /// The InternalAssistantDeletionStatus_object.
+ public readonly partial struct InternalAssistantDeletionStatusObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public InternalAssistantDeletionStatusObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string AssistantDeletedValue = "assistant.deleted";
+
+ /// assistant.deleted.
+ public static InternalAssistantDeletionStatusObject AssistantDeleted { get; } = new InternalAssistantDeletionStatusObject(AssistantDeletedValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(InternalAssistantDeletionStatusObject left, InternalAssistantDeletionStatusObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(InternalAssistantDeletionStatusObject left, InternalAssistantDeletionStatusObject right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator InternalAssistantDeletionStatusObject(string value) => new InternalAssistantDeletionStatusObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is InternalAssistantDeletionStatusObject other && Equals(other);
+ ///
+ public bool Equals(InternalAssistantDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatus.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatus.Serialization.cs
new file mode 100644
index 0000000000000..a434730c3d76a
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatus.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class InternalAssistantFileDeletionStatus
+ {
+ internal static InternalAssistantFileDeletionStatus DeserializeInternalAssistantFileDeletionStatus(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ bool deleted = default;
+ InternalAssistantFileDeletionStatusObject @object = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("deleted"u8))
+ {
+ deleted = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new InternalAssistantFileDeletionStatusObject(property.Value.GetString());
+ continue;
+ }
+ }
+ return new InternalAssistantFileDeletionStatus(id, deleted, @object);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalAssistantFileDeletionStatus FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalAssistantFileDeletionStatus(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatus.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatus.cs
new file mode 100644
index 0000000000000..79c8fad957602
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatus.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The status of an assistant file deletion operation.
+ public partial class InternalAssistantFileDeletionStatus
+ {
+ /// Initializes a new instance of .
+ /// The ID of the resource specified for deletion.
+ /// A value indicating whether deletion was successful.
+ /// is null.
+ internal InternalAssistantFileDeletionStatus(string id, bool deleted)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+
+ Id = id;
+ Deleted = deleted;
+ }
+
+ /// 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 'assistant.file.deleted'.
+ internal InternalAssistantFileDeletionStatus(string id, bool deleted, InternalAssistantFileDeletionStatusObject @object)
+ {
+ Id = id;
+ Deleted = deleted;
+ Object = @object;
+ }
+
+ /// The ID of the resource specified for deletion.
+ public string Id { get; }
+ /// A value indicating whether deletion was successful.
+ public bool Deleted { get; }
+ /// The object type, which is always 'assistant.file.deleted'.
+ public InternalAssistantFileDeletionStatusObject Object { get; } = InternalAssistantFileDeletionStatusObject.AssistantFileDeleted;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatusObject.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatusObject.cs
new file mode 100644
index 0000000000000..01ef618231fef
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalAssistantFileDeletionStatusObject.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.OpenAI.Assistants
+{
+ /// The InternalAssistantFileDeletionStatus_object.
+ public readonly partial struct InternalAssistantFileDeletionStatusObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public InternalAssistantFileDeletionStatusObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string AssistantFileDeletedValue = "assistant.file.deleted";
+
+ /// assistant.file.deleted.
+ public static InternalAssistantFileDeletionStatusObject AssistantFileDeleted { get; } = new InternalAssistantFileDeletionStatusObject(AssistantFileDeletedValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(InternalAssistantFileDeletionStatusObject left, InternalAssistantFileDeletionStatusObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(InternalAssistantFileDeletionStatusObject left, InternalAssistantFileDeletionStatusObject right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator InternalAssistantFileDeletionStatusObject(string value) => new InternalAssistantFileDeletionStatusObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is InternalAssistantFileDeletionStatusObject other && Equals(other);
+ ///
+ public bool Equals(InternalAssistantFileDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs
new file mode 100644
index 0000000000000..961918d214b17
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalCodeInterpreterToolCallDetails
+ {
+ internal static InternalCodeInterpreterToolCallDetails DeserializeInternalCodeInterpreterToolCallDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string input = default;
+ IReadOnlyList outputs = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("input"u8))
+ {
+ input = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("outputs"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(CodeInterpreterToolCallOutput.DeserializeCodeInterpreterToolCallOutput(item));
+ }
+ outputs = array;
+ continue;
+ }
+ }
+ return new InternalCodeInterpreterToolCallDetails(input, outputs);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalCodeInterpreterToolCallDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalCodeInterpreterToolCallDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.cs
new file mode 100644
index 0000000000000..0ca3c2e9f6727
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalCodeInterpreterToolCallDetails.cs
@@ -0,0 +1,49 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The detailed information about a code interpreter invocation by the model.
+ internal partial class InternalCodeInterpreterToolCallDetails
+ {
+ /// Initializes a new instance of .
+ /// The input provided by the model to the code interpreter tool.
+ /// The outputs produced by the code interpreter tool back to the model in response to the tool call.
+ /// or is null.
+ internal InternalCodeInterpreterToolCallDetails(string input, IEnumerable outputs)
+ {
+ Argument.AssertNotNull(input, nameof(input));
+ Argument.AssertNotNull(outputs, nameof(outputs));
+
+ Input = input;
+ Outputs = outputs.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// The input provided by the model to the code interpreter tool.
+ /// The outputs produced by the code interpreter tool back to the model in response to the tool call.
+ internal InternalCodeInterpreterToolCallDetails(string input, IReadOnlyList outputs)
+ {
+ Input = input;
+ Outputs = outputs;
+ }
+
+ /// The input provided by the model to the code interpreter tool.
+ public string Input { get; }
+ ///
+ /// The outputs produced by the code interpreter tool back to the model in response to the tool call.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ public IReadOnlyList Outputs { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatus.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatus.Serialization.cs
new file mode 100644
index 0000000000000..61f6ed36ea4da
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatus.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class InternalFileDeletionStatus
+ {
+ internal static InternalFileDeletionStatus DeserializeInternalFileDeletionStatus(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ bool deleted = default;
+ InternalFileDeletionStatusObject @object = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("deleted"u8))
+ {
+ deleted = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("object"u8))
+ {
+ @object = new InternalFileDeletionStatusObject(property.Value.GetString());
+ continue;
+ }
+ }
+ return new InternalFileDeletionStatus(id, deleted, @object);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalFileDeletionStatus FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalFileDeletionStatus(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatus.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatus.cs
new file mode 100644
index 0000000000000..930a282105505
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatus.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// A status response from a file deletion operation.
+ public partial class InternalFileDeletionStatus
+ {
+ /// Initializes a new instance of .
+ /// The ID of the resource specified for deletion.
+ /// A value indicating whether deletion was successful.
+ /// is null.
+ internal InternalFileDeletionStatus(string id, bool deleted)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+
+ Id = id;
+ Deleted = deleted;
+ }
+
+ /// 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 'file'.
+ internal InternalFileDeletionStatus(string id, bool deleted, InternalFileDeletionStatusObject @object)
+ {
+ Id = id;
+ Deleted = deleted;
+ Object = @object;
+ }
+
+ /// The ID of the resource specified for deletion.
+ public string Id { get; }
+ /// A value indicating whether deletion was successful.
+ public bool Deleted { get; }
+ /// The object type, which is always 'file'.
+ public InternalFileDeletionStatusObject Object { get; } = InternalFileDeletionStatusObject.File;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatusObject.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatusObject.cs
new file mode 100644
index 0000000000000..aee444c1aac24
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileDeletionStatusObject.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.OpenAI.Assistants
+{
+ /// The InternalFileDeletionStatus_object.
+ public readonly partial struct InternalFileDeletionStatusObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public InternalFileDeletionStatusObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string FileValue = "file";
+
+ /// file.
+ public static InternalFileDeletionStatusObject File { get; } = new InternalFileDeletionStatusObject(FileValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(InternalFileDeletionStatusObject left, InternalFileDeletionStatusObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(InternalFileDeletionStatusObject left, InternalFileDeletionStatusObject right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator InternalFileDeletionStatusObject(string value) => new InternalFileDeletionStatusObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is InternalFileDeletionStatusObject other && Equals(other);
+ ///
+ public bool Equals(InternalFileDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponse.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponse.Serialization.cs
new file mode 100644
index 0000000000000..2833ec2eedffe
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponse.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ public partial class InternalFileListResponse
+ {
+ internal static InternalFileListResponse DeserializeInternalFileListResponse(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ InternalFileListResponseObject @object = default;
+ IReadOnlyList data = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("object"u8))
+ {
+ @object = new InternalFileListResponseObject(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("data"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(OpenAIFile.DeserializeOpenAIFile(item));
+ }
+ data = array;
+ continue;
+ }
+ }
+ return new InternalFileListResponse(@object, data);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalFileListResponse FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalFileListResponse(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponse.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponse.cs
new file mode 100644
index 0000000000000..026707a7dc5db
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponse.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The response data from a file list operation.
+ public partial class InternalFileListResponse
+ {
+ /// Initializes a new instance of .
+ /// The files returned for the request.
+ /// is null.
+ internal InternalFileListResponse(IEnumerable data)
+ {
+ Argument.AssertNotNull(data, nameof(data));
+
+ Data = data.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// The object type, which is always 'list'.
+ /// The files returned for the request.
+ internal InternalFileListResponse(InternalFileListResponseObject @object, IReadOnlyList data)
+ {
+ Object = @object;
+ Data = data;
+ }
+
+ /// The object type, which is always 'list'.
+ public InternalFileListResponseObject Object { get; } = InternalFileListResponseObject.List;
+
+ /// The files returned for the request.
+ public IReadOnlyList Data { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponseObject.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponseObject.cs
new file mode 100644
index 0000000000000..c189c9c81aafa
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFileListResponseObject.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.OpenAI.Assistants
+{
+ /// The InternalFileListResponse_object.
+ public readonly partial struct InternalFileListResponseObject : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public InternalFileListResponseObject(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string ListValue = "list";
+
+ /// list.
+ public static InternalFileListResponseObject List { get; } = new InternalFileListResponseObject(ListValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(InternalFileListResponseObject left, InternalFileListResponseObject right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(InternalFileListResponseObject left, InternalFileListResponseObject right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator InternalFileListResponseObject(string value) => new InternalFileListResponseObject(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is InternalFileListResponseObject other && Equals(other);
+ ///
+ public bool Equals(InternalFileListResponseObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionDefinition.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionDefinition.Serialization.cs
new file mode 100644
index 0000000000000..4e6e43d5897f4
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionDefinition.Serialization.cs
@@ -0,0 +1,85 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalFunctionDefinition : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ if (Optional.IsDefined(Description))
+ {
+ writer.WritePropertyName("description"u8);
+ writer.WriteStringValue(Description);
+ }
+ writer.WritePropertyName("parameters"u8);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(Parameters);
+#else
+ using (JsonDocument document = JsonDocument.Parse(Parameters))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ writer.WriteEndObject();
+ }
+
+ internal static InternalFunctionDefinition DeserializeInternalFunctionDefinition(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string name = default;
+ Optional description = default;
+ BinaryData parameters = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("description"u8))
+ {
+ description = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("parameters"u8))
+ {
+ parameters = BinaryData.FromString(property.Value.GetRawText());
+ continue;
+ }
+ }
+ return new InternalFunctionDefinition(name, description.Value, parameters);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalFunctionDefinition FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalFunctionDefinition(document.RootElement);
+ }
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionDefinition.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionDefinition.cs
new file mode 100644
index 0000000000000..9202e6a4df870
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionDefinition.cs
@@ -0,0 +1,76 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The input definition information for a function.
+ internal partial class InternalFunctionDefinition
+ {
+ /// Initializes a new instance of .
+ /// The name of the function to be called.
+ /// The parameters the functions accepts, described as a JSON Schema object.
+ /// or is null.
+ public InternalFunctionDefinition(string name, BinaryData parameters)
+ {
+ Argument.AssertNotNull(name, nameof(name));
+ Argument.AssertNotNull(parameters, nameof(parameters));
+
+ Name = name;
+ Parameters = parameters;
+ }
+
+ /// Initializes a new instance of .
+ /// The name of the function to be called.
+ /// A description of what the function does, used by the model to choose when and how to call the function.
+ /// The parameters the functions accepts, described as a JSON Schema object.
+ internal InternalFunctionDefinition(string name, string description, BinaryData parameters)
+ {
+ Name = name;
+ Description = description;
+ Parameters = parameters;
+ }
+
+ /// The name of the function to be called.
+ public string Name { get; set; }
+ /// A description of what the function does, used by the model to choose when and how to call the function.
+ public string Description { get; set; }
+ ///
+ /// The parameters the functions accepts, described as a JSON Schema object.
+ ///
+ /// To assign an object to this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ public BinaryData Parameters { get; set; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionToolCallDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionToolCallDetails.Serialization.cs
new file mode 100644
index 0000000000000..7215403be3096
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionToolCallDetails.Serialization.cs
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalFunctionToolCallDetails
+ {
+ internal static InternalFunctionToolCallDetails DeserializeInternalFunctionToolCallDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string name = default;
+ string arguments = default;
+ string output = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("arguments"u8))
+ {
+ arguments = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("output"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ output = null;
+ continue;
+ }
+ output = property.Value.GetString();
+ continue;
+ }
+ }
+ return new InternalFunctionToolCallDetails(name, arguments, output);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalFunctionToolCallDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalFunctionToolCallDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionToolCallDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionToolCallDetails.cs
new file mode 100644
index 0000000000000..ae250e18735a3
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalFunctionToolCallDetails.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The detailed information about the function called by the model.
+ internal partial class InternalFunctionToolCallDetails
+ {
+ /// Initializes a new instance of .
+ /// The name of the function.
+ /// The arguments that the model requires are provided to the named function.
+ /// The output of the function, only populated for function calls that have already have had their outputs submitted.
+ /// or is null.
+ internal InternalFunctionToolCallDetails(string name, string arguments, string output)
+ {
+ Argument.AssertNotNull(name, nameof(name));
+ Argument.AssertNotNull(arguments, nameof(arguments));
+
+ Name = name;
+ Arguments = arguments;
+ Output = output;
+ }
+
+ /// The name of the function.
+ public string Name { get; }
+ /// The arguments that the model requires are provided to the named function.
+ public string Arguments { get; }
+ /// The output of the function, only populated for function calls that have already have had their outputs submitted.
+ public string Output { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileDetails.Serialization.cs
new file mode 100644
index 0000000000000..a03d109c7b5ae
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileDetails.Serialization.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalMessageImageFileDetails
+ {
+ internal static InternalMessageImageFileDetails DeserializeInternalMessageImageFileDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ InternalMessageImageFileIdDetails fileId = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("file_id"u8))
+ {
+ fileId = InternalMessageImageFileIdDetails.DeserializeInternalMessageImageFileIdDetails(property.Value);
+ continue;
+ }
+ }
+ return new InternalMessageImageFileDetails(fileId);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalMessageImageFileDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalMessageImageFileDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileDetails.cs
new file mode 100644
index 0000000000000..42c7412fcd4eb
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileDetails.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// An image reference, as represented in thread message content.
+ internal partial class InternalMessageImageFileDetails
+ {
+ /// Initializes a new instance of .
+ /// The ID for the file associated with this image.
+ /// is null.
+ internal InternalMessageImageFileDetails(InternalMessageImageFileIdDetails internalDetails)
+ {
+ Argument.AssertNotNull(internalDetails, nameof(internalDetails));
+
+ InternalDetails = internalDetails;
+ }
+
+ /// The ID for the file associated with this image.
+ public InternalMessageImageFileIdDetails InternalDetails { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileIdDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileIdDetails.Serialization.cs
new file mode 100644
index 0000000000000..6a8e7b8e40651
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileIdDetails.Serialization.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalMessageImageFileIdDetails
+ {
+ internal static InternalMessageImageFileIdDetails DeserializeInternalMessageImageFileIdDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string fileId = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("file_id"u8))
+ {
+ fileId = property.Value.GetString();
+ continue;
+ }
+ }
+ return new InternalMessageImageFileIdDetails(fileId);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalMessageImageFileIdDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalMessageImageFileIdDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileIdDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileIdDetails.cs
new file mode 100644
index 0000000000000..f69325bb05427
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageImageFileIdDetails.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// An encapsulation of an image file ID, as used by message image content.
+ internal partial class InternalMessageImageFileIdDetails
+ {
+ /// Initializes a new instance of .
+ /// The ID of the specific image file.
+ /// is null.
+ internal InternalMessageImageFileIdDetails(string fileId)
+ {
+ Argument.AssertNotNull(fileId, nameof(fileId));
+
+ FileId = fileId;
+ }
+
+ /// The ID of the specific image file.
+ public string FileId { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextDetails.Serialization.cs
new file mode 100644
index 0000000000000..4107400831b80
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextDetails.Serialization.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalMessageTextDetails
+ {
+ internal static InternalMessageTextDetails DeserializeInternalMessageTextDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string value = default;
+ IReadOnlyList annotations = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("value"u8))
+ {
+ value = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("annotations"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(MessageTextAnnotation.DeserializeMessageTextAnnotation(item));
+ }
+ annotations = array;
+ continue;
+ }
+ }
+ return new InternalMessageTextDetails(value, annotations);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalMessageTextDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalMessageTextDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextDetails.cs
new file mode 100644
index 0000000000000..84f5a03f57ceb
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextDetails.cs
@@ -0,0 +1,49 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The text and associated annotations for a single item of assistant thread message content.
+ internal partial class InternalMessageTextDetails
+ {
+ /// Initializes a new instance of .
+ /// The text data.
+ /// A list of annotations associated with this text.
+ /// or is null.
+ internal InternalMessageTextDetails(string text, IEnumerable annotations)
+ {
+ Argument.AssertNotNull(text, nameof(text));
+ Argument.AssertNotNull(annotations, nameof(annotations));
+
+ Text = text;
+ Annotations = annotations.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// The text data.
+ /// A list of annotations associated with this text.
+ internal InternalMessageTextDetails(string text, IReadOnlyList annotations)
+ {
+ Text = text;
+ Annotations = annotations;
+ }
+
+ /// The text data.
+ public string Text { get; }
+ ///
+ /// A list of annotations associated with this 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 .
+ ///
+ public IReadOnlyList Annotations { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.Serialization.cs
new file mode 100644
index 0000000000000..21da36cc36739
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.Serialization.cs
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalMessageTextFileCitationDetails
+ {
+ internal static InternalMessageTextFileCitationDetails DeserializeInternalMessageTextFileCitationDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string fileId = default;
+ string quote = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("file_id"u8))
+ {
+ fileId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("quote"u8))
+ {
+ quote = property.Value.GetString();
+ continue;
+ }
+ }
+ return new InternalMessageTextFileCitationDetails(fileId, quote);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalMessageTextFileCitationDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalMessageTextFileCitationDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.cs
new file mode 100644
index 0000000000000..ea056e46c5d17
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFileCitationDetails.cs
@@ -0,0 +1,34 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// A representation of a file-based text citation, as used in a file-based annotation of text thread message content.
+ internal partial class InternalMessageTextFileCitationDetails
+ {
+ /// Initializes a new instance of .
+ /// The ID of the file associated with this citation.
+ /// The specific quote cited in the associated file.
+ /// or is null.
+ internal InternalMessageTextFileCitationDetails(string fileId, string quote)
+ {
+ Argument.AssertNotNull(fileId, nameof(fileId));
+ Argument.AssertNotNull(quote, nameof(quote));
+
+ FileId = fileId;
+ Quote = quote;
+ }
+
+ /// The ID of the file associated with this citation.
+ public string FileId { get; }
+ /// The specific quote cited in the associated file.
+ public string Quote { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFilePathDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFilePathDetails.Serialization.cs
new file mode 100644
index 0000000000000..569554542dc42
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFilePathDetails.Serialization.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalMessageTextFilePathDetails
+ {
+ internal static InternalMessageTextFilePathDetails DeserializeInternalMessageTextFilePathDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string fileId = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("file_id"u8))
+ {
+ fileId = property.Value.GetString();
+ continue;
+ }
+ }
+ return new InternalMessageTextFilePathDetails(fileId);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalMessageTextFilePathDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalMessageTextFilePathDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFilePathDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFilePathDetails.cs
new file mode 100644
index 0000000000000..60dc0f0b42e67
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalMessageTextFilePathDetails.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// An encapsulation of an image file ID, as used by message image content.
+ internal partial class InternalMessageTextFilePathDetails
+ {
+ /// Initializes a new instance of .
+ /// The ID of the specific file that the citation is from.
+ /// is null.
+ internal InternalMessageTextFilePathDetails(string fileId)
+ {
+ Argument.AssertNotNull(fileId, nameof(fileId));
+
+ FileId = fileId;
+ }
+
+ /// The ID of the specific file that the citation is from.
+ public string FileId { get; }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs
new file mode 100644
index 0000000000000..ba3ba9a78e57f
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ internal partial class InternalSubmitToolOutputsDetails
+ {
+ internal static InternalSubmitToolOutputsDetails DeserializeInternalSubmitToolOutputsDetails(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyList toolCalls = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("tool_calls"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(RequiredToolCall.DeserializeRequiredToolCall(item));
+ }
+ toolCalls = array;
+ continue;
+ }
+ }
+ return new InternalSubmitToolOutputsDetails(toolCalls);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static InternalSubmitToolOutputsDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeInternalSubmitToolOutputsDetails(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.cs b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.cs
new file mode 100644
index 0000000000000..60d6550f38d23
--- /dev/null
+++ b/sdk/openai/assistants/Azure.AI.OpenAI.Assistants/src/Generated/InternalSubmitToolOutputsDetails.cs
@@ -0,0 +1,42 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.AI.OpenAI.Assistants
+{
+ /// The details describing tools that should be called to submit tool outputs.
+ internal partial class InternalSubmitToolOutputsDetails
+ {
+ /// Initializes a new instance of .
+ /// The list of tool calls that must be resolved for the assistant thread run to continue.
+ /// is null.
+ internal InternalSubmitToolOutputsDetails(IEnumerable toolCalls)
+ {
+ Argument.AssertNotNull(toolCalls, nameof(toolCalls));
+
+ ToolCalls = toolCalls.ToList();
+ }
+
+ /// Initializes a new instance of