fix(openai-proxy): add set_verbose flag for proxy to see logs

This commit is contained in:
Krrish Dholakia 2023-10-23 17:59:36 -07:00
parent 5cf1f346e5
commit 91f691cd8b
2 changed files with 9 additions and 2 deletions

View file

@ -4,16 +4,20 @@ dotenv.load_dotenv() # load env variables
def set_callbacks():
## LOGGING
if len(os.getenv("SET_VERBOSE")) > 0:
if os.getenv("SET_VERBOSE") == "True":
litellm.set_verbose = True
else:
litellm.set_verbose = False
### LANGFUSE
if (len(os.getenv("LANGFUSE_PUBLIC_KEY", "")) > 0 and len(os.getenv("LANGFUSE_SECRET_KEY", ""))) > 0 or len(os.getenv("LANGFUSE_HOST", "")) > 0:
print(f"sets langfuse integration")
litellm.success_callback = ["langfuse"]
## CACHING
### REDIS
print(f"redis host: {len(os.getenv('REDIS_HOST', ''))}; redis port: {len(os.getenv('REDIS_PORT', ''))}; redis password: {len(os.getenv('REDIS_PASSWORD'))}")
if len(os.getenv("REDIS_HOST", "")) > 0 and len(os.getenv("REDIS_PORT", "")) > 0 and len(os.getenv("REDIS_PASSWORD", "")) > 0:
print(f"sets caching integration")
from litellm.caching import Cache
litellm.cache = Cache(type="redis", host=os.getenv("REDIS_HOST"), port=os.getenv("REDIS_PORT"), password=os.getenv("REDIS_PASSWORD"))