struct OpenAI::ChatMessage

Included Modules

Extended Modules

Defined in:

openai/api/chat.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]
def self.new(role : OpenAI::ChatMessageRole, content : Nil | String = nil, name : Nil | String = nil, function_call : OpenAI::ChatFunctionCall | Nil = nil, tokens : Int32 = 0, tool_calls : Nil | Array(OpenAI::ChatToolCall) = nil, tool_call_id : Nil | String = nil) #

[View source]

Instance Method Detail

def content : String | Nil #

[View source]
def function_call : ChatFunctionCall | Nil #

[View source]
def name : String | Nil #

The name of the author of this message. name is required if role is function, and it should be the name of the function whose response is in the content. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.


[View source]
def role : ChatMessageRole #

The role of the messages author. One of system, user, assistant, or function.


[View source]
def tokens : Int32 #

[View source]
def tokens=(tokens : Int32) #

[View source]
def tool_call_id : String | Nil #

For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool.


[View source]
def tool_calls : Array(ChatToolCall) | Nil #

The tool calls generated by the model, such as function calls.


[View source]