Integrate records into flows to provide context, personalize responses, and implement RAG (Retrieval Augmented Generation) patterns.
Common patterns
RAG: Question answering with context
Retrieve relevant documents and include them in AI prompts:
- Vector Search: Find docs matching user question (semantic search)
- Transform Data: Extract and format retrieved content
- Prompt: Generate answer using retrieved context
Example prompt:
Personalization with customer data
Retrieve customer profile and use it for personalized responses:
- Retrieve Record: Get customer by ID, name, or type
- Prompt: Generate response referencing customer data
Example:
Caching API results
Save expensive API calls in records:
- Retrieve Record: Check if cached result exists
- Conditional: If cache miss, call external API
- Upsert Record: Save API response for future use
- Return: Cached or fresh result
Conversation history
Store chat logs for context in future interactions:
- Retrieve Record: Get conversation history by user ID
- Prompt: Generate response with conversation context
- Upsert Record: Update conversation history with new exchange
Record lookups
Retrieve specific records by ID or by type and name:
Or query by type with a record filter:
Use in conditionals to check if a record exists:
Multi-record retrieval
Use a Retrieve Record step in query mode or a Vector Search step to get multiple results:
- Vector Search: Find matching products by semantic similarity
- Transform Data: Extract and format results
- Prompt: Process or summarize the matches
Updating records from flows
Flows can create or update records using the Upsert Record step. The step identifies records by type and name, and stores the contents of a source variable as metadata:
There is also an Update Record step for modifying specific metadata fields on an existing record without replacing the entire metadata object.
Use Vector Search for unstructured queries (“How do I…?”) and Retrieve Record for structured lookups (“Get customer with ID 12345”).
Optimizing record usage
- Limit search results: Only retrieve what you need
- Cache retrieved data: Store in variables, don’t retrieve multiple times
- Use specific types: Searching within a type is faster than all records
- Filter before semantic search: Narrow scope for better performance
Error handling
Handle missing records gracefully:
Best practices
- Keep record metadata concise: Only store fields you’ll query or use in prompts
- Use meaningful record types: Organize records logically
- Test search relevance: Verify semantic search returns appropriate results
- Monitor record count: Large record sets need indexed fields
- Version control: Don’t delete old records; mark them inactive instead
Example: Full RAG flow
Next steps
- Using record steps for detailed step configuration
- Filtering and searching records for advanced queries
- Creating and managing records to populate your record store
- Using prompt steps to generate responses with record context