class

LLM::OpenAI::Message

Inherits JSON::Serializable < Reference < Object

Represents a message in a request to the LLM

Constructors

new(pull : JSON::PullParser)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

emit

Emit this message as one or more ChatEvent objects

Source
role
Source
role=(role : String)
Source
to_protocol_json(builder : JSON::Builder)

Used to encode message for sending to LLM. Can't use regular to_json since we need to handle some special cases for the protocol but we want to serialize whole entry for saving / restoring. This starts the object and calls protocol_fields_to_json. Do not override!

Source

Nested types