LLM::OpenAI::History
Inherits JSON::Serializable::Unmapped < JSON::Serializable < Reference < Object
The serializable chat history keeps all wrapped messages to save the additional information when saving the session.
Constructors
Instance methods
Append last whole conversation, starting with most recent user
message,
- either all messages, or
- user and assistant only
Append conversation from the branch-point of this session, starting with most recent user
message,
- either all messages, or
- user and assistant only
Extract last response from assistant and yield it to caller to
transform into a named tuple with a prompt and response, which in turn
is converted into two messages that are appended to the given history.
Returns true on success, false if unable to extract.
Copy the messages from another session's history, optionally excluding the last "turn".
Extract last whole conversation, starting with most recent user
message,
- either all messages, or
- user and assistant only
Extract conversation from the branch-point of this session, starting with most recent user
message,
- either all messages, or
- user and assistant only
Emit the last N request responses. Always tries to emit the query before the response. May include tool calls as a result. Use N=-1 to list all
Extract last response from assistant and yield it to caller to
transform into a named tuple with a prompt and response, which in turn
is used to create a message array that caller can inject into a session.
Returns nil if
no response in the current history.