struct

Arcana::AI::Chat::Message

Inherits Struct < Value < Object

A single message in a chat conversation.

Constructors

assistant(content : String) : self
Source
new(role : String, content : String | Nil = nil, name : String | Nil = nil, tool_calls : Array(ToolCall) | Nil = nil, tool_call_id : String | Nil = nil)
Source
system(content : String) : self
Source
user(content : String, name : String | Nil = nil) : self
Source

Instance methods

content
Source
content=(content : String | Nil)
Source
name
Source
name=(name : String | Nil)
Source
role
Source
role=(role : String)
Source
to_json(json : JSON::Builder) : Nil

Serialize to the OpenAI-compatible JSON format.

Source
tool_call_id
Source
tool_call_id=(tool_call_id : String | Nil)
Source
tool_calls
Source
tool_calls=(tool_calls : Array(ToolCall) | Nil)
Source