Fetch History
Retrieves conversation history for LLM based on conversation ID, enabling multi-turn conversations with context.
Quick Start
To get started:
- Add the Fetch History block to your flow
- Provide a
history_nameto identify the conversation - Set
history_depthto control how many exchanges to retrieve - Provide the
conversation_idviamsg.payload.conversation_id - Receive the conversation history in
msg.payload
Configuration
History Name (required)
A title or name for the conversation history to fetch.
History Depth (required)
The number of previous exchanges to retrieve. Set to 0 for all history.
Default: 0
Common Input Format
msg.payload.conversation_id (string)
The unique conversation identifier from the Create Conversation block.
Example: "conv_abc123xyz"
Common Output Format
msg.payload (object)
msg.payload contains the retrieved conversation history.
Example:
{
"history": [
{"user_query": "What is the warranty period?", "llm_response": "The warranty period is 12 months."},
{"user_query": "Can I extend it?", "llm_response": "Yes, you can purchase an extended warranty."}
]
}Example
Input (msg.payload)
{
"conversation_id": "conv_abc123xyz"
}Output (msg.payload)
{
"history": [
{"user_query": "What is the warranty period?", "llm_response": "The warranty period is 12 months."},
{"user_query": "Can I extend it?", "llm_response": "Yes, you can purchase an extended warranty."}
]
}Usage in Flows
- Use after Create Conversation to retrieve existing history
- Pass the retrieved
historyto LLM Query v2 viamsg.payload.history - Enable multi-turn conversations by maintaining context across queries
Errors
When the block fails, it raises an error. Use a Catch block in your flow to handle failures and inspect the error payload.
Common mistakes
- Invalid conversation_id: Ensure the conversation ID exists and was created previously.
- History depth too large: Setting very large depth values may impact performance.
- Missing history_name: The history name is required to identify which conversation to fetch.
Best Practices
- Set appropriate
history_depthbased on your use case to balance context and performance - Use consistent
history_namevalues across your flow - Handle cases where conversation history may be empty (new conversations)
- Consider clearing or archiving old conversations to manage storage
Create Conversation
Generates a unique identifier for a conversation under which LLM history, target documents, user queries, and other data can be tracked.
LLM Context Indexer
Adds, updates, or deletes documents from vector or document stores, supporting multiple formats including PDF, WORD, MD, TXT, Excel, JSON, and images for RAG applications.