Session and a Message, then replies back to the same session.
1. Create the app
App(...) is the object capsule serve and capsule deploy read.
2. Add a message handler
3. Add conversation history
Most model APIs want alternating user and assistant messages. Capsule keeps the session history and can merge the current message for you:4. Stream a reply
Use streaming when work takes longer than a single response.Full example
Next steps
- Add persistent records with Add Data And State.
- See the feature page for Chat And Sessions.