openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.12

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Assistants/Internal/InternalAssistantMessageClient.cs

63lines · modecode

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