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 | None = 1000000, enable_litellm_cache: bool = False)
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 | None
|
The maximum number of entries in the in-memory cache. |
1000000
|
enable_litellm_cache
|
bool
|
Whether to enable LiteLLM cache. |
False
|
Source code in dspy/clients/__init__.py
:::