Skip to content

LLM Chat history

186

The LLM Chat history node acts as a persistent memory buffer for AI-driven conversations. It maintains a record of messages exchanged between the player and the AI, functioning as a rolling buffer to optimize performance and costs.

Key Connectors & Logic:

  • input user [string]: This input is used to insert the player's query into the history.
    • Note for Developers: The activation of the LLM model should typically happen in parallel with this input. This trigger is not automatic and must be explicitly handled by the programmer.
  • input AI [string]: This input allows for the insertion of a "fictitious AI response".
    • While real responses from the AI are usually added automatically, this manual input is vital for the Room Master to intervene if the model fails to respond or if they need to "nudge" the players by sending a message that appears to come from the AI.
  • Automatic Synchronization: The real-time response from an AI model is handled automatically through the connection between the History node and the LLM Model node. This link uses a "pointer" type, meaning the object binding is bidirectional—any response generated by the model is instantly written back into the history buffer.

Features:

  • Rolling Buffer: By limiting the number of stored messages via the messages property, the node prevents the context window from becoming too large. This is crucial for saving API credits and maintaining high response speeds.
  • Output Versatility: Provides the entire history as a pointer for the model nodes, and also exposes the most recent message as raw text or JSON.

Room Master Intervention: The input AI pin is a powerful tool for game operators. It allows them to bypass the AI and send direct instructions or hints to the players while maintaining the immersion of talking to a consistent AI character.

Connectors in

  • input user [type: string]
  • input AI [type: integer]

Connectors out

  • self [type: variant]
  • last msg [type: string]
  • last json [type: string]

Node properties

  • messages [type: integer]