On this page

Do I have to send the whole chat history with every message?

Updated

No. Turn on session memory for the workflow and send only the newest message with a session_id. ModelRiver keeps the conversation and gives the model the recent turns plus a summary of older ones, so long chats stay within the model's limits.

How do I start a conversation?#

  1. Turn on Sessions in the workflow's advanced settings. It's off by default.
  2. Send the first message without a session_id. The response includes a new one.
  3. Send every later message with that session_id.

With the OpenAI SDK, put session_id in the request body; it comes back in the x-modelriver-session-id response header.

Can I add messages without calling the AI?#

Yes. The Sessions API can append user or human-agent messages to a conversation without calling a model, and those aren't billed. That's how a support team can reply in the same thread, and the AI sees those replies when it answers next.

How do I clear or reset a conversation?#

Delete the session in the console (Logs → Sessions) or with the Sessions API, then start a new one without a session_id. You can also just start a new conversation and leave the old one.

Why did I get session_not_found?#

The session_id belongs to another project or workflow, or the session was deleted. Start a new conversation without a session_id.

Anything to watch out for?#

  • Session memory needs Save full request and response text turned on for the project, because the conversation is built from saved messages.
  • Requests in a session skip the response cache.

Learn more#

Was this article helpful?