openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Assistants/Internal/InternalAssistantMessageClient.cs
64lines · modeblame
9f9f2936Jose Arriaga Maldonado2 years ago | 1 | using System; |
| 2 | using System.ClientModel; | |
| 3 | using System.ClientModel.Primitives; | |
e0fee603Jose Arriaga Maldonado1 years ago | 4 | using System.Threading; |
9f9f2936Jose Arriaga Maldonado2 years ago | 5 | |
| 6 | namespace OpenAI.Assistants; | |
| 7 | | |
0ca4c062Jose Arriaga Maldonado1 years ago | 8 | [CodeGenType("Messages")] |
9f9f2936Jose Arriaga Maldonado2 years ago | 9 | [CodeGenSuppress("InternalAssistantMessageClient", typeof(ClientPipeline), typeof(ApiKeyCredential), typeof(Uri))] |
e0fee603Jose Arriaga Maldonado1 years ago | 10 | [CodeGenSuppress("CreateMessageAsync", typeof(string), typeof(MessageCreationOptions), typeof(CancellationToken))] |
| 11 | [CodeGenSuppress("CreateMessage", typeof(string), typeof(MessageCreationOptions), typeof(CancellationToken))] | |
5dce104aJose Arriaga Maldonado1 years ago | 12 | [CodeGenSuppress("GetMessagesAsync", typeof(string), typeof(int?), typeof(OpenAI.VectorStores.VectorStoreCollectionOrder?), typeof(string), typeof(string), typeof(CancellationToken))] |
| 13 | [CodeGenSuppress("GetMessages", typeof(string), typeof(int?), typeof(OpenAI.VectorStores.VectorStoreCollectionOrder?), typeof(string), typeof(string), typeof(CancellationToken))] | |
e0fee603Jose Arriaga Maldonado1 years ago | 14 | [CodeGenSuppress("GetMessageAsync", typeof(string), typeof(string), typeof(CancellationToken))] |
| 15 | [CodeGenSuppress("GetMessage", typeof(string), typeof(string), typeof(CancellationToken))] | |
| 16 | [CodeGenSuppress("ModifyMessageAsync", typeof(string), typeof(string), typeof(MessageModificationOptions), typeof(CancellationToken))] | |
| 17 | [CodeGenSuppress("ModifyMessage", typeof(string), typeof(string), typeof(MessageModificationOptions), typeof(CancellationToken))] | |
| 18 | [CodeGenSuppress("DeleteMessageAsync", typeof(string), typeof(string), typeof(CancellationToken))] | |
| 19 | [CodeGenSuppress("DeleteMessage", typeof(string), typeof(string), typeof(CancellationToken))] | |
9f9f2936Jose Arriaga Maldonado2 years ago | 20 | internal partial class InternalAssistantMessageClient |
| 21 | { | |
13a9c686Jose Arriaga Maldonado1 years ago | 22 | // CUSTOM: |
| 23 | // - Used a custom pipeline. | |
| 24 | // - Demoted the endpoint parameter to be a property in the options class. | |
e0fee603Jose Arriaga Maldonado1 years ago | 25 | /// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary> |
13a9c686Jose Arriaga Maldonado1 years ago | 26 | /// <param name="credential"> The API key to authenticate with the service. </param> |
| 27 | /// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception> | |
| 28 | public InternalAssistantMessageClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions()) | |
| 29 | { | |
| 30 | } | |
| 31 | | |
| 32 | // CUSTOM: | |
| 33 | // - Used a custom pipeline. | |
| 34 | // - Demoted the endpoint parameter to be a property in the options class. | |
e0fee603Jose Arriaga Maldonado1 years ago | 35 | /// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary> |
13a9c686Jose Arriaga Maldonado1 years ago | 36 | /// <param name="credential"> The API key to authenticate with the service. </param> |
| 37 | /// <param name="options"> The options to configure the client. </param> | |
| 38 | /// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception> | |
| 39 | public InternalAssistantMessageClient(ApiKeyCredential credential, OpenAIClientOptions options) | |
| 40 | { | |
| 41 | Argument.AssertNotNull(credential, nameof(credential)); | |
| 42 | options ??= new OpenAIClientOptions(); | |
9f9f2936Jose Arriaga Maldonado2 years ago | 43 | |
e0fee603Jose Arriaga Maldonado1 years ago | 44 | Pipeline = OpenAIClient.CreatePipeline(credential, options); |
13a9c686Jose Arriaga Maldonado1 years ago | 45 | _endpoint = OpenAIClient.GetEndpoint(options); |
| 46 | } | |
9f9f2936Jose Arriaga Maldonado2 years ago | 47 | |
13a9c686Jose Arriaga Maldonado1 years ago | 48 | // CUSTOM: |
| 49 | // - Used a custom pipeline. | |
| 50 | // - Demoted the endpoint parameter to be a property in the options class. | |
| 51 | // - Made protected. | |
e0fee603Jose Arriaga Maldonado1 years ago | 52 | /// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary> |
13a9c686Jose Arriaga Maldonado1 years ago | 53 | /// <param name="pipeline"> The HTTP pipeline to send and receive REST requests and responses. </param> |
| 54 | /// <param name="options"> The options to configure the client. </param> | |
| 55 | /// <exception cref="ArgumentNullException"> <paramref name="pipeline"/> is null. </exception> | |
| 56 | protected internal InternalAssistantMessageClient(ClientPipeline pipeline, OpenAIClientOptions options) | |
9f9f2936Jose Arriaga Maldonado2 years ago | 57 | { |
13a9c686Jose Arriaga Maldonado1 years ago | 58 | Argument.AssertNotNull(pipeline, nameof(pipeline)); |
| 59 | options ??= new OpenAIClientOptions(); | |
| 60 | | |
e0fee603Jose Arriaga Maldonado1 years ago | 61 | Pipeline = pipeline; |
13a9c686Jose Arriaga Maldonado1 years ago | 62 | _endpoint = OpenAIClient.GetEndpoint(options); |
9f9f2936Jose Arriaga Maldonado2 years ago | 63 | } |
| 64 | } |