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/Assistant.cs

36lines · modecode

1using System.ClientModel;
2using System.ClientModel.Primitives;
3using System.Diagnostics.CodeAnalysis;
4using System.Text.Json;
5
6namespace OpenAI.Assistants;
7
8[Experimental("OPENAI001")]
9[CodeGenType("AssistantObject")]
10public partial class Assistant
11{
12 private const string AssistantValue = "assistant";
13
14 // CUSTOM: Made internal.
15 /// <summary> The object type, which is always `assistant`. </summary>
16 [CodeGenMember("Object")]
17 internal string Object { get; } = AssistantValue;
18
19 /// <inheritdoc cref="AssistantResponseFormat"/>
20 public AssistantResponseFormat ResponseFormat { get; }
21
22 /// <summary>
23 /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
24 ///
25 /// We generally recommend altering this or temperature but not both.
26 /// </summary>
27 [CodeGenMember("TopP")]
28 public float? NucleusSamplingFactor { get; }
29
30 internal static Assistant FromClientResult(ClientResult result)
31 {
32 using PipelineResponse response = result.GetRawResponse();
33 using JsonDocument document = JsonDocument.Parse(response.Content);
34 return DeserializeAssistant(document.RootElement, ModelSerializationExtensions.WireOptions);
35 }
36}
37