dspy.configure_cache¶
dspy.configure_cache(enable_disk_cache: bool | None = True, enable_memory_cache: bool | None = True, disk_cache_dir: str | None = DISK_CACHE_DIR, disk_size_limit_bytes: int | None = DISK_CACHE_LIMIT, memory_max_entries: int = 1000000, restrict_pickle: bool = False, safe_types: list[type[Any]] | None = None) ¶
Configure the cache for DSPy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable_disk_cache | bool | None | Whether to enable on-disk cache. | True |
enable_memory_cache | bool | None | Whether to enable in-memory cache. | True |
disk_cache_dir | str | None | The directory to store the on-disk cache. | DISK_CACHE_DIR |
disk_size_limit_bytes | int | None | The size limit of the on-disk cache. | DISK_CACHE_LIMIT |
memory_max_entries | int | The maximum number of entries in the in-memory cache. To allow the cache to grow without bounds, set this parameter to | 1000000 |
restrict_pickle | bool | When True, restrict pickle deserialization to a known-safe set of types. When False (default), use unrestricted pickle. | False |
safe_types | list[type[Any]] | None | Additional types to allow when restrict_pickle is True. | None |