Documentation Index
Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
Use this file to discover all available pages before exploring further.
Model Memory Modes
The UEL Model supports four memory modes that control how conversation history is loaded and saved during chain execution.Quick Reference
| Mode | Loading | Saving | Use Case |
|---|---|---|---|
auto | Skip if placeholder, load otherwise | Last exchange only | Recommended - Multi-chain RAG, complex workflows |
always | Always load | Last exchange only | Simple chatbots without placeholders |
never | Never load | Last exchange only | Logging/analytics |
record_all | Skip if placeholder, load otherwise | ALL messages | Complete audit trails |
Usage
Mode Details
auto (Default)
Smart detection mode - automatically detects if the input contains placeholder history and adjusts behavior accordingly.
Loading:
- If placeholder history detected → Skip loading from memory
- If no placeholder history → Load from memory
- Saves only the last request + response (prevents duplicates)
- Multi-chain RAG patterns
- Complex workflows where same model is used multiple times
- When you want automatic conflict resolution
always
Always load mode - ignores placeholder detection and always loads from memory.
Loading:
- Always loads from memory (ignores placeholder detection)
- Saves only the last request + response
- Simple single-chain chatbots
- Scenarios where you never use placeholder history
never
Never load mode - never loads from memory but still saves for logging purposes.
Loading:
- Never loads from memory
- Saves only the last request + response
- Analytics and logging
- When history is always provided via external sources
- Recording conversations without affecting model context
record_all
Full audit mode - like auto for loading, but saves ALL messages including placeholder history.
Loading:
- Same as
auto(skip if placeholder, load otherwise)
- Saves ALL messages including placeholder history
- Complete audit trails
- Single-chain scenarios where you need full history recorded
- Debugging (handle duplicates yourself)
Scenario Behavior Matrix
The table below shows what the model receives during inference for each mode and scenario:| Scenario | Input Type | Memory State | auto | always | never | record_all |
|---|---|---|---|---|---|---|
| S1 | No placeholder | Empty | Current | Current | Current | Current |
| S2 | No placeholder | Has history | Memory+Current ✅ | Memory+Current ✅ | Current ⚠️ | Memory+Current ✅ |
| S3 | Placeholder | Empty | Placeholder | Placeholder | Placeholder | Placeholder |
| S4 | Placeholder | Has history | Placeholder ✅ | Memory+Placeholder ⚠️ | Placeholder ✅ | Placeholder ✅ |
- ✅ Optimal behavior
- ⚠️ Potential issue (duplicates or missing context)
Multi-Chain RAG Pattern
When using the same model in multiple chains (e.g., contextualize + answer), usemode="auto":
Debug Mode
Enable debug logging to see exactly what’s happening:- Current mode
- Whether placeholder history is detected
- Whether memory is loaded or skipped
- What messages are saved to memory
Key Concepts
Placeholder History vs Model Memory
- Placeholder History: External history passed via
chat_historyinput parameter - Model Memory: Internal storage that accumulates across invocations
record_all). This prevents duplication.
Why auto is Recommended
- Handles both cases: Works with and without placeholder history
- Prevents pollution: Same model can be used in multiple chains safely
- Minimal memory growth: Only saves new exchanges
- Smart detection: Automatically knows when to skip memory loading

