AI DevKit
Search Results for

    Show / Hide Table of Contents

    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
    OpenAIModelBase
    ChatCompletion
    Implements
    IGeneratedText
    IGeneratedResult
    Inherited Members
    OpenAIModelBase.Id
    OpenAIModelBase.Object
    OpenAIModelBase.Model
    OpenAIModelBase.CreatedAt
    OpenAIModelBase.Metadata
    OpenAIModelBase.Usage
    Namespace: Glitch9.AIDevKit
    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
    Type Description
    ChatChoice[]

    Count

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    IsEmpty

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool

    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
    Type Description
    string

    Methods

    FirstContent()

    Declaration
    public ChatContent FirstContent()
    Returns
    Type Description
    ChatContent

    FirstDelta()

    Declaration
    public ChatDelta FirstDelta()
    Returns
    Type Description
    ChatDelta

    FirstResponseMessage()

    Declaration
    public AssistantMessage FirstResponseMessage()
    Returns
    Type Description
    AssistantMessage

    GetContents()

    Declaration
    public ChatContent[] GetContents()
    Returns
    Type Description
    ChatContent[]

    GetDeltaChunks()

    Declaration
    public ChatDelta[] GetDeltaChunks()
    Returns
    Type Description
    ChatDelta[]

    GetResponseMessages()

    Declaration
    public AssistantMessage[] GetResponseMessages()
    Returns
    Type Description
    AssistantMessage[]

    GetToolCalls()

    Declaration
    public ToolCall[] GetToolCalls()
    Returns
    Type Description
    ToolCall[]

    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
    Type Name Description
    ChatCompletion chat
    Returns
    Type Description
    ChatContent

    implicit operator string(ChatCompletion)

    Declaration
    public static implicit operator string(ChatCompletion chat)
    Parameters
    Type Name Description
    ChatCompletion chat
    Returns
    Type Description
    string

    Implements

    IGeneratedText
    IGeneratedResult
    In this article
    Back to top Generated by DocFX