Class ChatCompletion
Response from a LLM (Large Language Model) for a chat completion request.
This class contains a list of ChatChoice objects,
each representing a message generated by the model in response to a chat prompt.
ChatMessage can be accessed through the ChatChoice (e.g., Choices[0].Message).
If 'n' used in the request is greater than 1, this can contain multiple choices.
Otherwise, it will always contain a single choice.
If this is a streamed response,
the ChatChoice objects will contain ChatDelta instead of ChatMessage.
Inheritance
object
ChatCompletion
Assembly: .dll
Syntax
public class ChatCompletion : OpenAIModelBase, IGeneratedText, IGeneratedResult
Properties
Choices
A list of chat completion choices. Can be more than one if n is greater than 1.
If this is 'ChatCompletionChunk' which is a streamed response,
This can also be empty for the last chunk if you set stream_options: {"include_usage": true}.
Declaration
public ChatChoice[] Choices { get; set; }
Property Value
Count
Declaration
public int Count { get; }
Property Value
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
SystemFingerprint
This fingerprint represents the backend configuration that the model runs with.
Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might impact determinism.
Declaration
public string SystemFingerprint { get; set; }
Property Value
Methods
FirstContent()
Declaration
public ChatContent FirstContent()
Returns
FirstDelta()
Declaration
public ChatDelta FirstDelta()
Returns
FirstResponseMessage()
Declaration
public AssistantMessage FirstResponseMessage()
Returns
GetContents()
Declaration
public ChatContent[] GetContents()
Returns
GetDeltaChunks()
Declaration
public ChatDelta[] GetDeltaChunks()
Returns
GetResponseMessages()
Declaration
public AssistantMessage[] GetResponseMessages()
Returns
Declaration
public ToolCall[] GetToolCalls()
Returns
ToDeltaTextArray()
Declaration
public string[] ToDeltaTextArray()
Returns
Type |
Description |
string[] |
|
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type |
Description |
string |
A string that represents the current object.
|
Overrides
object.ToString()
ToStringArray()
Declaration
public string[] ToStringArray()
Returns
Type |
Description |
string[] |
|
Operators
implicit operator ChatContent(ChatCompletion)
Declaration
public static implicit operator ChatContent(ChatCompletion chat)
Parameters
Returns
implicit operator string(ChatCompletion)
Declaration
public static implicit operator string(ChatCompletion chat)
Parameters
Returns
Implements