Client-side Chat History Maintenance #893
Replies: 3 comments 1 reply
-
I like the proposal. |
Beta Was this translation helpful? Give feedback.
-
I have some follow-up questions about the proposal:
The concept of tenant is a bit confusing for me here, are you referring to the tenants within SAP AI Core or BTP Tenants? If it's the former, isn't it already handled by the
Is this a soft requirement ? Or will we enforce this somehow in code? |
Beta Was this translation helpful? Give feedback.
-
After our discussions I consider this closed and accepted. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Chat History Maintenance
Status
Accepted
Context
With the introduction of chat history maintenance, we must distinguish between client-side and server-side approaches.
This ADR primarily focuses on client-side history maintenance, but also outlines the alternative server-side approach for context.
Server-Side History Maintenance
In server-side maintenance, the server is responsible for storing the chat history.
A prominent example is OpenAI’s conversation state, where conversations can branch off from any given
response_id
, continuing from that point in history.Ideally, this would be implemented by the orchestration service, which could:
Benefits:
Client-Side History Maintenance
In this model, the client becomes stateful, tracking the ongoing conversation locally.
This approach introduces several responsibilities:
History Initialization
Client-side history can be initialized in two ways:
The client must support both scenarios.
Tenant Isolation
To ensure multi-tenant safety (similar to Cloud SDK destination isolation), chat histories must be isolated per tenant.
Options include:
History Retrieval
Since production environments often favor stateless services, history may be offloaded to external databases (e.g., Redis, NoSQL) for durability and scalability.
To support this, the client should expose APIs that allow:
Streaming Considerations
When handling multiple concurrent streams, conversation isolation becomes critical.
Two design choices emerge:
Stream Lock
Prevent multiple simultaneous streams per client.
Conversation IDs
Create isolated “conversations” client-side, allowing concurrent streams.
Proposal:
We instantiate a new client for every conversation; this way, we can simplify multiple concerns:
Decision
Proposal accepted as-is
Beta Was this translation helpful? Give feedback.
All reactions