Enable caching to store and reuse task responses for similar inputs, reducing API costs and improving performance.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.
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
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

