diff --git a/docs/my-website/docs/proxy/caching.md b/docs/my-website/docs/proxy/caching.md
index 216510de6..fc19ee3ae 100644
--- a/docs/my-website/docs/proxy/caching.md
+++ b/docs/my-website/docs/proxy/caching.md
@@ -9,8 +9,13 @@ LiteLLM supports:
- Redis Cache
- s3 Bucket Cache
-## Quick Start
+## Quick Start - Redis, s3 Cache
+
+
+
+
Caching can be enabled by adding the `cache` key in the `config.yaml`
+
### Step 1: Add `cache` to the config.yaml
```yaml
model_list:
@@ -48,7 +53,37 @@ REDIS_ = ""
```shell
$ litellm --config /path/to/config.yaml
```
+
+
+
+### Step 1: Add `cache` to the config.yaml
+```yaml
+model_list:
+ - model_name: gpt-3.5-turbo
+ litellm_params:
+ model: gpt-3.5-turbo
+ - model_name: text-embedding-ada-002
+ litellm_params:
+ model: text-embedding-ada-002
+
+litellm_settings:
+ set_verbose: True
+ cache: True # set cache responses to True
+ cache_params: # set cache params for s3
+ type: s3
+ s3_bucket_name: cache-bucket-litellm # AWS Bucket Name for S3
+ s3_region_name: us-west-2 # AWS Region Name for S3
+ s3_aws_access_key_id: your_access_key # AWS Access Key ID for S3
+ s3_aws_secret_access_key: your_secret_key # AWS Secret Access Key for S3
+```
+
+### Step 2: Run proxy with config
+```shell
+$ litellm --config /path/to/config.yaml
+```
+
+
## Using Caching - /chat/completions
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index 132559c3d..fc0d0b608 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -544,46 +544,46 @@ def load_router_config(router: Optional[litellm.Router], config_file_path: str):
print(f"{blue_color_code}\nSetting Cache on Proxy") # noqa
from litellm.caching import Cache
- if isinstance(value, dict):
- cache_type = value.get("type", "redis")
- else:
- cache_type = "redis" # default to using redis on cache
- cache_responses = True
- cache_host = litellm.get_secret("REDIS_HOST", None)
- cache_port = litellm.get_secret("REDIS_PORT", None)
- cache_password = litellm.get_secret("REDIS_PASSWORD", None)
-
- cache_params = {
- "type": cache_type,
- "host": cache_host,
- "port": cache_port,
- "password": cache_password,
- }
-
+ cache_params = {}
if "cache_params" in litellm_settings:
cache_params_in_config = litellm_settings["cache_params"]
# overwrie cache_params with cache_params_in_config
cache_params.update(cache_params_in_config)
- # Assuming cache_type, cache_host, cache_port, and cache_password are strings
- print( # noqa
- f"{blue_color_code}Cache Type:{reset_color_code} {cache_type}"
- ) # noqa
- print( # noqa
- f"{blue_color_code}Cache Host:{reset_color_code} {cache_host}"
- ) # noqa
- print( # noqa
- f"{blue_color_code}Cache Port:{reset_color_code} {cache_port}"
- ) # noqa
- print( # noqa
- f"{blue_color_code}Cache Password:{reset_color_code} {cache_password}"
- )
- print() # noqa
+ cache_type = cache_params.get("type", "redis")
+
+ print_verbose(f"passed cache type={cache_type}")
+
+ if cache_type == "redis":
+ cache_host = litellm.get_secret("REDIS_HOST", None)
+ cache_port = litellm.get_secret("REDIS_PORT", None)
+ cache_password = litellm.get_secret("REDIS_PASSWORD", None)
+
+ cache_params = {
+ "type": cache_type,
+ "host": cache_host,
+ "port": cache_port,
+ "password": cache_password,
+ }
+ # Assuming cache_type, cache_host, cache_port, and cache_password are strings
+ print( # noqa
+ f"{blue_color_code}Cache Type:{reset_color_code} {cache_type}"
+ ) # noqa
+ print( # noqa
+ f"{blue_color_code}Cache Host:{reset_color_code} {cache_host}"
+ ) # noqa
+ print( # noqa
+ f"{blue_color_code}Cache Port:{reset_color_code} {cache_port}"
+ ) # noqa
+ print( # noqa
+ f"{blue_color_code}Cache Password:{reset_color_code} {cache_password}"
+ )
+ print() # noqa
## to pass a complete url, or set ssl=True, etc. just set it as `os.environ[REDIS_URL] = `, _redis.py checks for REDIS specific environment variables
litellm.cache = Cache(**cache_params)
print( # noqa
- f"{blue_color_code}Set Cache on LiteLLM Proxy: {litellm.cache.cache}{reset_color_code} {cache_password}"
+ f"{blue_color_code}Set Cache on LiteLLM Proxy: {vars(litellm.cache.cache)}{reset_color_code}"
)
elif key == "callbacks":
litellm.callbacks = [