Skip to content

Commit

Permalink
Litellm dev 02 12 2025 p1 (#8494)
Browse files Browse the repository at this point in the history
* Resolves #6625 (#8459)

- enables no auth for SMTP

Signed-off-by: Regli Daniel <daniel.regli1@sanitas.com>

* add sonar pricings (#8476)

* add sonar pricings

* Update model_prices_and_context_window.json

* Update model_prices_and_context_window.json

* Update model_prices_and_context_window_backup.json

* test: fix test

---------

Signed-off-by: Regli Daniel <daniel.regli1@sanitas.com>
Co-authored-by: Dani Regli <1daniregli@gmail.com>
Co-authored-by: Lucca Zenóbio <luccazen@gmail.com>
  • Loading branch information
3 people committed Feb 13, 2025
1 parent 4f9df56 commit d0e209e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/my-website/docs/proxy/config_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,12 @@ router_settings:
| SLACK_DAILY_REPORT_FREQUENCY | Frequency of daily Slack reports (e.g., daily, weekly)
| SLACK_WEBHOOK_URL | Webhook URL for Slack integration
| SMTP_HOST | Hostname for the SMTP server
| SMTP_PASSWORD | Password for SMTP authentication
| SMTP_PASSWORD | Password for SMTP authentication (do not set if SMTP does not require auth)
| SMTP_PORT | Port number for SMTP server
| SMTP_SENDER_EMAIL | Email address used as the sender in SMTP transactions
| SMTP_SENDER_LOGO | Logo used in emails sent via SMTP
| SMTP_TLS | Flag to enable or disable TLS for SMTP connections
| SMTP_USERNAME | Username for SMTP authentication
| SMTP_USERNAME | Username for SMTP authentication (do not set if SMTP does not require auth)
| SPEND_LOGS_URL | URL for retrieving spend logs
| SSL_CERTIFICATE | Path to the SSL certificate file
| SSL_VERIFY | Flag to enable or disable SSL certificate verification
Expand Down
18 changes: 18 additions & 0 deletions litellm/model_prices_and_context_window_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -8205,6 +8205,24 @@
"litellm_provider": "perplexity",
"mode": "chat"
},
"perplexity/sonar": {
"max_tokens": 127072,
"max_input_tokens": 127072,
"max_output_tokens": 127072,
"input_cost_per_token": 0.000001,
"output_cost_per_token": 0.000001,
"litellm_provider": "perplexity",
"mode": "chat"
},
"perplexity/sonar-pro": {
"max_tokens": 200000,
"max_input_tokens": 200000,
"max_output_tokens": 8096,
"input_cost_per_token": 0.000003,
"output_cost_per_token": 0.000015,
"litellm_provider": "perplexity",
"mode": "chat"
},
"perplexity/pplx-7b-chat": {
"max_tokens": 8192,
"max_input_tokens": 8192,
Expand Down
11 changes: 3 additions & 8 deletions litellm/proxy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2322,12 +2322,6 @@ async def send_email(receiver_email, subject, html):
if smtp_host is None:
raise ValueError("Trying to use SMTP, but SMTP_HOST is not set")

if smtp_username is None:
raise ValueError("Trying to use SMTP, but SMTP_USERNAME is not set")

if smtp_password is None:
raise ValueError("Trying to use SMTP, but SMTP_PASSWORD is not set")

# Attach the body to the email
email_message.attach(MIMEText(html, "html"))

Expand All @@ -2337,8 +2331,9 @@ async def send_email(receiver_email, subject, html):
if os.getenv("SMTP_TLS", "True") != "False":
server.starttls()

# Login to your email account
server.login(smtp_username, smtp_password) # type: ignore
# Login to your email account only if smtp_username and smtp_password are provided
if smtp_username and smtp_password:
server.login(smtp_username, smtp_password) # type: ignore

# Send the email
server.send_message(email_message)
Expand Down
18 changes: 18 additions & 0 deletions model_prices_and_context_window.json
Original file line number Diff line number Diff line change
Expand Up @@ -8205,6 +8205,24 @@
"litellm_provider": "perplexity",
"mode": "chat"
},
"perplexity/sonar": {
"max_tokens": 127072,
"max_input_tokens": 127072,
"max_output_tokens": 127072,
"input_cost_per_token": 0.000001,
"output_cost_per_token": 0.000001,
"litellm_provider": "perplexity",
"mode": "chat"
},
"perplexity/sonar-pro": {
"max_tokens": 200000,
"max_input_tokens": 200000,
"max_output_tokens": 8096,
"input_cost_per_token": 0.000003,
"output_cost_per_token": 0.000015,
"litellm_provider": "perplexity",
"mode": "chat"
},
"perplexity/pplx-7b-chat": {
"max_tokens": 8192,
"max_input_tokens": 8192,
Expand Down
4 changes: 3 additions & 1 deletion tests/local_testing/test_mock_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,6 @@ def test_router_mock_request_with_mock_timeout_with_fallbacks():
print(response)
end_time = time.time()
assert end_time - start_time >= 3, f"Time taken: {end_time - start_time}"
assert "gpt-35-turbo" in response.model, "Model should be azure gpt-35-turbo"
assert (
"gpt-3.5-turbo-0125" in response.model
), "Model should be azure gpt-3.5-turbo-0125"

0 comments on commit d0e209e

Please sign in to comment.