[Bug Fix] No module named 'diskcache' (#11600)

* (build) show clear error when disk cache does not exist

* docs disk cache

* add caching to pyproject
This commit is contained in:
Ishaan Jaff
2025-06-10 14:54:11 -07:00
committed by GitHub
parent 55cd5f096c
commit 2d0ea74cf4
5 changed files with 372 additions and 48 deletions
+2 -2
View File
@@ -236,10 +236,10 @@ response2 = completion(
### Quick Start
Install diskcache:
Install the disk caching extra:
```shell
pip install diskcache
pip install "litellm[caching]"
```
Then you can use the disk cache as follows.
+6 -1
View File
@@ -13,7 +13,12 @@ else:
class DiskCache(BaseCache):
def __init__(self, disk_cache_dir: Optional[str] = None):
import diskcache as dc
try:
import diskcache as dc
except ModuleNotFoundError as e:
raise ModuleNotFoundError(
"Please install litellm with `litellm[caching]` to use disk caching."
) from e
# if users don't provider one, use the default litellm cache
if disk_cache_dir is None:
@@ -4153,6 +4153,32 @@
"supports_assistant_prefill": true,
"supports_tool_choice": true
},
"mistral/magistral-medium-2506": {
"max_tokens": 40000,
"max_input_tokens": 40000,
"max_output_tokens": 40000,
"input_cost_per_token": 2e-06,
"output_cost_per_token": 5e-06,
"litellm_provider": "mistral",
"mode": "chat",
"source": "https://mistral.ai/news/magistral",
"supports_function_calling": true,
"supports_assistant_prefill": true,
"supports_tool_choice": true
},
"mistral/magistral-small-2506": {
"max_tokens": 40000,
"max_input_tokens": 40000,
"max_output_tokens": 40000,
"input_cost_per_token": 0.0,
"output_cost_per_token": 0.0,
"litellm_provider": "mistral",
"mode": "chat",
"source": "https://mistral.ai/news/magistral",
"supports_function_calling": true,
"supports_assistant_prefill": true,
"supports_tool_choice": true
},
"mistral/mistral-embed": {
"max_tokens": 8192,
"max_input_tokens": 8192,
Generated
+335 -45
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -59,6 +59,7 @@ mcp = {version = "1.5.0", optional = true, python = ">=3.10"}
litellm-proxy-extras = {version = "0.2.3", optional = true}
rich = {version = "13.7.1", optional = true}
litellm-enterprise = {version = "0.1.7", optional = true}
diskcache = {version = "^5.6.1", optional = true}
[tool.poetry.extras]
proxy = [
@@ -97,6 +98,8 @@ utils = [
"numpydoc",
]
caching = ["diskcache"]
[tool.isort]
profile = "black"