Configure the global prompt cache.
This should be called before any cache instances are created or used.
configure_global_async_prompt_cache(
*,
max_size: int = DEFAULT_PROMPT_CACHE_MAX_SIZE,
ttl_seconds: Optional[float] = DEFAULT_PROMPT_CACHE_TTL_SECONDS,
refresh_interval_seconds: float = DEFAULT_PROMPT_CACHE_REFRESH_INTERVAL_SECONDS
) -> NoneExample:
from langsmith import configure_global_prompt_cache configure_global_prompt_cache(max_size=200, ttl_seconds=7200)
| Name | Type | Description |
|---|---|---|
max_size | int | Default: DEFAULT_PROMPT_CACHE_MAX_SIZEMaximum entries in cache (LRU eviction when exceeded). |
ttl_seconds | Optional[float] | Default: DEFAULT_PROMPT_CACHE_TTL_SECONDSTime before entry is considered stale. |
refresh_interval_seconds | float | Default: DEFAULT_PROMPT_CACHE_REFRESH_INTERVAL_SECONDSHow often to check for stale entries. |