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 · modecode

1using System;
2using System.ClientModel;
3using System.ClientModel.Primitives;
4using System.Threading;
5
6namespace OpenAI.Assistants;
7
8[CodeGenType("Messages")]
9[CodeGenSuppress("InternalAssistantMessageClient", typeof(ClientPipeline), typeof(ApiKeyCredential), typeof(Uri))]
10[CodeGenSuppress("CreateMessageAsync", typeof(string), typeof(MessageCreationOptions), typeof(CancellationToken))]
11[CodeGenSuppress("CreateMessage", typeof(string), typeof(MessageCreationOptions), typeof(CancellationToken))]
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))]
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))]
20internal partial class InternalAssistantMessageClient
21{
22 // CUSTOM:
23 // - Used a custom pipeline.
24 // - Demoted the endpoint parameter to be a property in the options class.
25 /// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
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.
35 /// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
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();
43
44 Pipeline = OpenAIClient.CreatePipeline(credential, options);
45 _endpoint = OpenAIClient.GetEndpoint(options);
46 }
47
48 // CUSTOM:
49 // - Used a custom pipeline.
50 // - Demoted the endpoint parameter to be a property in the options class.
51 // - Made protected.
52 /// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
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)
57 {
58 Argument.AssertNotNull(pipeline, nameof(pipeline));
59 options ??= new OpenAIClientOptions();
60
61 Pipeline = pipeline;
62 _endpoint = OpenAIClient.GetEndpoint(options);
63 }
64}
65