Merge branch 'BerriAI:main' into update_helm_chart_deployment_2024-02-22

This commit is contained in:
Shaun Maher
2024-02-23 12:44:25 +11:00
committed by GitHub
4 changed files with 36 additions and 4 deletions
+15 -3
View File
@@ -187,7 +187,21 @@ We allow you to
- Customize the UI color scheme
<Image img={require('../../img/litellm_custom_ai.png')} />
#### Usage
#### Set Custom Logo
We allow you to pass a local image or a an http/https url of your image
Set `UI_LOGO_PATH` on your env. We recommend using a hosted image, it's a lot easier to set up and configure / debug
Exaple setting Hosted image
```shell
UI_LOGO_PATH="https://litellm-logo-aws-marketplace.s3.us-west-2.amazonaws.com/berriai-logo-github.png"
```
Exaple setting a local image (on your container)
```shell
UI_LOGO_PATH="ui_images/logo.jpg"
```
#### Set Custom Color Theme
- Navigate to [/enterprise/enterprise_ui](https://github.com/BerriAI/litellm/blob/main/enterprise/enterprise_ui/_enterprise_colors.json)
- Inside the `enterprise_ui` directory, rename `_enterprise_colors.json` to `enterprise_colors.json`
- Set your companies custom color scheme in `enterprise_colors.json`
@@ -206,8 +220,6 @@ Set your colors to any of the following colors: https://www.tremor.so/docs/layou
}
```
- Set the path to your custom png/jpg logo as `UI_LOGO_PATH` in your .env
- Deploy LiteLLM Proxy Server
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+19 -1
View File
@@ -5211,7 +5211,25 @@ def get_image():
logo_path = os.getenv("UI_LOGO_PATH", default_logo)
verbose_proxy_logger.debug(f"Reading logo from {logo_path}")
return FileResponse(path=logo_path)
# Check if the logo path is an HTTP/HTTPS URL
if logo_path.startswith(("http://", "https://")):
# Download the image and cache it
response = requests.get(logo_path)
if response.status_code == 200:
# Save the image to a local file
cache_path = os.path.join(current_dir, "cached_logo.jpg")
with open(cache_path, "wb") as f:
f.write(response.content)
# Return the cached image as a FileResponse
return FileResponse(cache_path, media_type="image/jpeg")
else:
# Handle the case when the image cannot be downloaded
return FileResponse(default_logo, media_type="image/jpeg")
else:
# Return the local image file if the logo path is not an HTTP/HTTPS URL
return FileResponse(logo_path, media_type="image/jpeg")
@app.get("/sso/callback", tags=["experimental"])
+2
View File
@@ -1320,6 +1320,7 @@ def test_completion_together_ai():
max_tokens=256,
n=1,
logger_fn=logger_fn,
timeout=1,
)
# Add any assertions here to check the response
print(response)
@@ -1330,6 +1331,7 @@ def test_completion_together_ai():
f"${float(cost):.10f}",
)
except litellm.Timeout as e:
print("got a timeout error")
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")