Principle:Predibase Lorax Stateless Conversation Management
| Knowledge Sources | |
|---|---|
| Domains | API_Design, Conversation_Management |
| Last Updated | 2026-02-08 02:00 GMT |
Overview
A stateless conversation pattern where the server processes each request independently, requiring the client to maintain and resend the full conversation history with every request.
Description
Stateless Conversation Management follows the REST principle of server statelessness. The LoRAX server does not store conversation history between requests. To maintain a multi-turn conversation, the client must:
- Store the conversation history locally (array of message objects)
- Append the user's new message to the history
- Send the entire history with each request
- Append the assistant's response to the history for future turns
This design simplifies the server (no session management, no memory leaks from abandoned conversations) but requires clients to manage state.
Usage
Use this pattern for all multi-turn chat applications. Manage conversation state in your application code and include the full message history in each API call.
Theoretical Basis
Pseudo-code:
# Client-side conversation loop
messages = [{"role": "system", "content": "You are helpful."}]
while True:
user_input = get_user_input()
messages.append({"role": "user", "content": user_input})
response = client.chat.completions.create(
model="my-adapter",
messages=messages, # Full history every time
)
assistant_msg = response.choices[0].message.content
messages.append({"role": "assistant", "content": assistant_msg})