struct

OpenAI::ChatMessage

Inherits JSON::Serializable / Struct / Value / Object

Constructors

new(pull : JSON::PullParser)
Source
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)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

content

The contents of the message. content is required for all messages, and may be null for assistant messages with function calls.

Source
function_call

The name and arguments of a function that should be called, as generated by the model.

Source
name

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.

Source
role

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

Source
tokens
Source
tokens=(tokens : Int32)
Source
tool_call_id

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

Source
tool_calls

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

Source