babylon.rag.pre_embeddings.cache_manager
Embedding cache management for the RAG system.
This module provides functionality for caching embeddings to reduce duplicate operations and API costs.
Classes
|
Configuration for embedding cache management. |
|
Manages caching of embeddings to reduce duplicate operations. |
- class babylon.rag.pre_embeddings.cache_manager.CacheConfig(**data)[source]
Bases:
BaseModelConfiguration for embedding cache management.
- max_cache_size
Maximum number of embeddings to keep in cache
- persist_cache
Whether to persist cache to disk
- cache_file_path
Path to cache file for persistence
- hash_algorithm
Algorithm to use for content hashing
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class babylon.rag.pre_embeddings.cache_manager.EmbeddingCacheManager(config=None)[source]
Bases:
objectManages caching of embeddings to reduce duplicate operations.
This class handles caching of embeddings based on content hashes, with support for LRU eviction, persistence, and metrics collection.
- Parameters:
config (CacheConfig | None)
- __init__(config=None)[source]
Initialize with configuration options.
- Parameters:
config (
CacheConfig|None) – Configuration for cache behavior