openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
achandmsft-patch-1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Chat/ChatFinishReason.cs

87lines · modecode

1namespace OpenAI.Chat;
2
3/// <summary>
4/// The reason the model stopped generating tokens. This will be:
5/// <list type="table">
6/// <listheader>
7/// <member>Property</member>
8/// <rest>REST</rest>
9/// <cond>Condition</cond>
10/// </listheader>
11/// <item>
12/// <member><see cref="Stop"/></member>
13/// <rest><c>stop</c></rest>
14/// <cond>The model encountered a natural stop point or provided stop sequence.</cond>
15/// </item>
16/// <item>
17/// <member><see cref="Length"/></member>
18/// <rest><c>length</c></rest>
19/// <cond>The maximum number of tokens specified in the request was reached.</cond>
20/// </item>
21/// <item>
22/// <member><see cref="ContentFilter"/></member>
23/// <rest><c>content_filter</c></rest>
24/// <cond>Content was omitted due to a triggered content filter rule.</cond>
25/// </item>
26/// <item>
27/// <member><see cref="ToolCalls"/></member>
28/// <rest><c>tool_calls</c></rest>
29/// <cond>
30/// With no explicit <c>tool_choice</c>, the model called one or more tools that were defined in the request.
31/// </cond>
32/// </item>
33/// <item>
34/// <member><see cref="FunctionCall"/></member>
35/// <rest><c>function_call</c></rest>
36/// <cond>(Deprecated) The model called a function that was defined in the request.</cond>
37/// </item>
38/// </list>
39/// </summary>
40[CodeGenType("CreateChatCompletionResponseChoiceFinishReason1")]
41public enum ChatFinishReason
42{
43 /// <summary>
44 /// Indicates that the model encountered a natural stop point or provided stop sequence.
45 /// </summary>
46 [CodeGenMember("Stop")]
47 Stop,
48
49 /// <summary>
50 /// Indicates that the model reached the maximum number of tokens allowed for the request.
51 /// </summary>
52 [CodeGenMember("Length")]
53 Length,
54
55 /// <summary>
56 /// Indicates that content was omitted due to a triggered content filter rule.
57 /// </summary>
58 [CodeGenMember("ContentFilter")]
59 ContentFilter,
60
61 /// <summary>
62 /// Indicates that the model called a function that was defined in the request.
63 /// </summary>
64 /// <remarks>
65 /// To resolve tool calls, append the message associated with the tool calls followed by matching instances of
66 /// <see cref="ToolChatMessage"/> for each tool call, then perform another chat completion with the combined
67 /// set of messages.
68 /// <para>
69 /// <b>Note</b>: <see cref="ToolCalls"/> is <i>not</i> provided as the <c>finish_reason</c> if the model calls a
70 /// tool in response to an explicit <c>tool_choice</c> via <see cref="ChatCompletionOptions.ToolChoice"/>.
71 /// In that case, calling the specified tool is assumed and the expected reason is <see cref="Stop"/>.
72 /// </para>
73 /// </remarks>
74 [CodeGenMember("ToolCalls")]
75 ToolCalls,
76
77 /// <summary>
78 /// Indicates that the model called a function that was defined in the request.
79 /// </summary>
80 /// <remarks>
81 /// To resolve a function call, append the message associated with the function call followed by a
82 /// <see cref="FunctionChatMessage"/> with the appropriate name and arguments, then perform another chat
83 /// completion with the combined set of messages.
84 /// </remarks>
85 [CodeGenMember("FunctionCall")]
86 FunctionCall,
87}
88