When working with Hashbrown chat resources, it is important to distinguish between what seeds the history, what mutates it, and what only affects future requests.
Message History Lifecycle
- Initial Seeding: The
messages option seeds the initial chat history only. It does not continuously sync with the history after initialization. - Intentional Mutations: To change the chat history, you must use the explicit APIs:
sendMessage, setMessages, or reload. - Conversational State: Conversational state (the flow of the chat) belongs in the message history.
Runtime Options
Options such as model, system, apiUrl, threadId, tools, and transport are applied to future requests only. Updating these options will not clear the existing history or trigger a new message by themselves.
Completion vs. Chat Resources
- Chat Resources: Manage a history of multiple messages.
- Completion Resources: These are different because their
input option is synchronized with the single user message backing the completion.
Best Practices
- Use the
system option for durable, unchanging behavior. - Use message history APIs for managing conversational state.