Quick Start
Cache Methods
Vector Search (Default)
Uses semantic similarity to find cached responses for similar inputs.LLM Call
Uses an LLM to determine if cached responses are applicable.Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
enable_cache | bool | False | Enable/disable caching |
cache_method | str | "vector_search" | "vector_search" or "llm_call" |
cache_threshold | float | 0.7 | Similarity threshold (0.0-1.0) |
cache_duration_minutes | int | 60 | Cache expiration time |
cache_embedding_provider | Any | Auto-detected | Custom embedding provider |
Full Example
Task Cache Methods
set_cache_manager(cache_manager)
Set a custom cache manager for the task.get_cached_response(input_text, llm_provider=None)
Retrieve cached response for given input (async).store_cache_entry(input_text, output)
Store a new cache entry (async).get_cache_stats()
Get cache statistics including hit rate and configuration.total_entries: Number of cached entriescache_hits: Number of cache hitscache_misses: Number of cache misseshit_rate: Cache hit rate (0.0-1.0)cache_method: Current cache methodcache_threshold: Current thresholdcache_hit: Whether last request was a cache hitsession_id: Current session ID
clear_cache()
Clear all cache entries.Best Practices
- Threshold Tuning: Start with
0.7, increase for stricter matching - Duration: Set based on how often your data changes
- Method Choice: Use
vector_searchfor speed,llm_callfor accuracy - Embedding Provider: Auto-detected if not specified

