(feat) cache+proxy - set os.environ/ on proxy config

This commit is contained in:
ishaan-jaff 2024-01-06 15:54:16 +05:30
parent 7611081d55
commit c2b061acb2
2 changed files with 8 additions and 1 deletions

View file

@ -673,6 +673,11 @@ class ProxyConfig:
)
print() # noqa
# users can pass os.environ/ variables on the proxy - we should read them from the env
for key, value in cache_params.items():
if value.startswith("os.environ/"):
cache_params[key] = litellm.get_secret(value)
## to pass a complete url, or set ssl=True, etc. just set it as `os.environ[REDIS_URL] = <your-redis-url>`, _redis.py checks for REDIS specific environment variables
litellm.cache = Cache(**cache_params)
print( # noqa

View file

@ -12,4 +12,6 @@ litellm_settings:
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_region_name: us-west-2 # AWS Region Name for S3
s3_aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID # AWS Access Key ID for S3
s3_aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY # AWS Secret Access Key for S3