mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(feat) proxy: caching - show redis settings when initializing
This commit is contained in:
parent
71042ee345
commit
1dcab433b4
1 changed files with 12 additions and 1 deletions
|
@ -267,12 +267,23 @@ def load_router_config(router: Optional[litellm.Router], config_file_path: str):
|
||||||
if litellm_settings:
|
if litellm_settings:
|
||||||
for key, value in litellm_settings.items():
|
for key, value in litellm_settings.items():
|
||||||
if key == "cache":
|
if key == "cache":
|
||||||
print("\nSetting Cache on Config\n")
|
# ANSI escape code for blue text
|
||||||
|
blue_color_code = "\033[94m"
|
||||||
|
reset_color_code = "\033[0m"
|
||||||
|
print(f"{blue_color_code}\nSetting Cache on Proxy")
|
||||||
from litellm.caching import Cache
|
from litellm.caching import Cache
|
||||||
cache_type = value["type"]
|
cache_type = value["type"]
|
||||||
cache_host = os.environ.get("REDIS_HOST")
|
cache_host = os.environ.get("REDIS_HOST")
|
||||||
cache_port = os.environ.get("REDIS_PORT")
|
cache_port = os.environ.get("REDIS_PORT")
|
||||||
cache_password = os.environ.get("REDIS_PASSWORD")
|
cache_password = os.environ.get("REDIS_PASSWORD")
|
||||||
|
|
||||||
|
# Assuming cache_type, cache_host, cache_port, and cache_password are strings
|
||||||
|
print(f"{blue_color_code}Cache Type:{reset_color_code} {cache_type}")
|
||||||
|
print(f"{blue_color_code}Cache Host:{reset_color_code} {cache_host}")
|
||||||
|
print(f"{blue_color_code}Cache Port:{reset_color_code} {cache_port}")
|
||||||
|
print(f"{blue_color_code}Cache Password:{reset_color_code} {cache_password}")
|
||||||
|
print()
|
||||||
|
|
||||||
litellm.cache = Cache(
|
litellm.cache = Cache(
|
||||||
type=cache_type,
|
type=cache_type,
|
||||||
host=cache_host,
|
host=cache_host,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue