openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.2.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Custom/Assistants/Internal/InternalAssistantMessageClient.cs

64lines · modeblame

9f9f2936Jose Arriaga Maldonado2 years ago1using System;
2using System.ClientModel;
3using System.ClientModel.Primitives;
e0fee603Jose Arriaga Maldonado1 years ago4using System.Threading;
9f9f2936Jose Arriaga Maldonado2 years ago5
6namespace OpenAI.Assistants;
7
0ca4c062Jose Arriaga Maldonado1 years ago8[CodeGenType("Messages")]
9f9f2936Jose Arriaga Maldonado2 years ago9[CodeGenSuppress("InternalAssistantMessageClient", typeof(ClientPipeline), typeof(ApiKeyCredential), typeof(Uri))]
e0fee603Jose Arriaga Maldonado1 years ago10[CodeGenSuppress("CreateMessageAsync", typeof(string), typeof(MessageCreationOptions), typeof(CancellationToken))]
11[CodeGenSuppress("CreateMessage", typeof(string), typeof(MessageCreationOptions), typeof(CancellationToken))]
5dce104aJose Arriaga Maldonado1 years ago12[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 ago14[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 ago20internal partial class InternalAssistantMessageClient
21{
13a9c686Jose Arriaga Maldonado1 years ago22// CUSTOM:
23// - Used a custom pipeline.
24// - Demoted the endpoint parameter to be a property in the options class.
e0fee603Jose Arriaga Maldonado1 years ago25/// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
13a9c686Jose Arriaga Maldonado1 years ago26/// <param name="credential"> The API key to authenticate with the service. </param>
27/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
28public 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 ago35/// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
13a9c686Jose Arriaga Maldonado1 years ago36/// <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>
39public InternalAssistantMessageClient(ApiKeyCredential credential, OpenAIClientOptions options)
40{
41Argument.AssertNotNull(credential, nameof(credential));
42options ??= new OpenAIClientOptions();
9f9f2936Jose Arriaga Maldonado2 years ago43
e0fee603Jose Arriaga Maldonado1 years ago44Pipeline = OpenAIClient.CreatePipeline(credential, options);
13a9c686Jose Arriaga Maldonado1 years ago45_endpoint = OpenAIClient.GetEndpoint(options);
46}
9f9f2936Jose Arriaga Maldonado2 years ago47
13a9c686Jose Arriaga Maldonado1 years ago48// 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 ago52/// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
13a9c686Jose Arriaga Maldonado1 years ago53/// <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>
56protected internal InternalAssistantMessageClient(ClientPipeline pipeline, OpenAIClientOptions options)
9f9f2936Jose Arriaga Maldonado2 years ago57{
13a9c686Jose Arriaga Maldonado1 years ago58Argument.AssertNotNull(pipeline, nameof(pipeline));
59options ??= new OpenAIClientOptions();
60
e0fee603Jose Arriaga Maldonado1 years ago61Pipeline = pipeline;
13a9c686Jose Arriaga Maldonado1 years ago62_endpoint = OpenAIClient.GetEndpoint(options);
9f9f2936Jose Arriaga Maldonado2 years ago63}
64}