litellm-enterprise 0.1.22__tar.gz → 0.1.24__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/PKG-INFO +1 -1
- litellm_enterprise-0.1.24/litellm_enterprise/enterprise_callbacks/send_emails/sendgrid_email.py +79 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/enterprise_routes.py +0 -4
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/vector_stores/endpoints.py +25 -17
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/pyproject.toml +2 -2
- litellm_enterprise-0.1.22/litellm_enterprise/enterprise_callbacks/generic_api_callback.py +0 -266
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/LICENSE.md +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/README.md +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/__init__.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/callback_controls.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/example_logging_api.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/llama_guard.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/llm_guard.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secret_detection.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/__init__.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/adafruit.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/adobe.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/age_secret_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/airtable_api_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/algolia_api_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/alibaba.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/asana.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/atlassian_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/authress_access_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/beamer_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/bitbucket.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/bittrex.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/clojars_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/codecov_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/coinbase_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/confluent.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/contentful_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/databricks_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/datadog_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/defined_networking_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/digitalocean.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/discord.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/doppler_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/droneci_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/dropbox.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/duffel_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/dynatrace_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/easypost.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/etsy_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/facebook_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/fastly_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/finicity.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/finnhub_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/flickr_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/flutterwave.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/frameio_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/freshbooks_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/gcp_api_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/github_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/gitlab.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/gitter_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/gocardless_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/grafana.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/hashicorp_tf_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/heroku_api_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/hubspot_api_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/huggingface.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/intercom_api_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/jfrog.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/jwt.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/kraken_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/kucoin.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/launchdarkly_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/linear.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/linkedin.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/lob.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/mailgun.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/mapbox_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/mattermost_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/messagebird.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/microsoft_teams_webhook.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/netlify_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/new_relic.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/nytimes_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/okta_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/openai_api_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/planetscale.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/postman_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/prefect_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/pulumi_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/pypi_upload_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/rapidapi_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/readme_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/rubygems_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/scalingo_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/sendbird.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/sendgrid_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/sendinblue_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/sentry_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/shippo_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/shopify.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/slack.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/snyk_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/squarespace_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/sumologic.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/telegram_bot_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/travisci_access_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/twitch_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/twitter.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/typeform_api_token.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/vault.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/yandex.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/secrets_plugins/zendesk_secret_key.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/send_emails/base_email.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/send_emails/endpoints.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/send_emails/resend_email.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/enterprise_callbacks/send_emails/smtp_email.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/integrations/custom_guardrail.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/litellm_core_utils/litellm_logging.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/audit_logging_endpoints.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/auth/__init__.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/auth/custom_sso_handler.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/auth/route_checks.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/auth/user_api_key_auth.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/common_utils/check_batch_cost.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/hooks/managed_files.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/management_endpoints/__init__.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/management_endpoints/internal_user_endpoints.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/management_endpoints/key_management_endpoints.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/proxy_server.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/readme.md +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/utils.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/types/enterprise_callbacks/send_emails.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/types/proxy/audit_logging_endpoints.py +0 -0
- {litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/types/proxy/proxy_server.py +0 -0
litellm_enterprise-0.1.24/litellm_enterprise/enterprise_callbacks/send_emails/sendgrid_email.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""
|
|
2
|
+
LiteLLM x SendGrid email integration.
|
|
3
|
+
|
|
4
|
+
Docs: https://docs.sendgrid.com/api-reference/mail-send/mail-send
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
from typing import List
|
|
9
|
+
|
|
10
|
+
from litellm._logging import verbose_logger
|
|
11
|
+
from litellm.llms.custom_httpx.http_handler import (
|
|
12
|
+
get_async_httpx_client,
|
|
13
|
+
httpxSpecialProvider,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
from .base_email import BaseEmailLogger
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
SENDGRID_API_ENDPOINT = "https://api.sendgrid.com/v3/mail/send"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class SendGridEmailLogger(BaseEmailLogger):
|
|
23
|
+
"""
|
|
24
|
+
Send emails using SendGrid's Mail Send API.
|
|
25
|
+
|
|
26
|
+
Required env vars:
|
|
27
|
+
- SENDGRID_API_KEY
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self):
|
|
31
|
+
self.async_httpx_client = get_async_httpx_client(
|
|
32
|
+
llm_provider=httpxSpecialProvider.LoggingCallback
|
|
33
|
+
)
|
|
34
|
+
self.sendgrid_api_key = os.getenv("SENDGRID_API_KEY")
|
|
35
|
+
verbose_logger.debug("SendGrid Email Logger initialized.")
|
|
36
|
+
|
|
37
|
+
async def send_email(
|
|
38
|
+
self,
|
|
39
|
+
from_email: str,
|
|
40
|
+
to_email: List[str],
|
|
41
|
+
subject: str,
|
|
42
|
+
html_body: str,
|
|
43
|
+
):
|
|
44
|
+
"""
|
|
45
|
+
Send an email via SendGrid.
|
|
46
|
+
"""
|
|
47
|
+
if not self.sendgrid_api_key:
|
|
48
|
+
raise ValueError("SENDGRID_API_KEY is not set")
|
|
49
|
+
|
|
50
|
+
verbose_logger.debug(
|
|
51
|
+
f"Sending email via SendGrid from {from_email} to {to_email} with subject {subject}"
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
payload = {
|
|
55
|
+
"from": {"email": from_email},
|
|
56
|
+
"personalizations": [
|
|
57
|
+
{
|
|
58
|
+
"to": [{"email": email} for email in to_email],
|
|
59
|
+
"subject": subject,
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"content": [
|
|
63
|
+
{
|
|
64
|
+
"type": "text/html",
|
|
65
|
+
"value": html_body,
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
response = await self.async_httpx_client.post(
|
|
71
|
+
url=SENDGRID_API_ENDPOINT,
|
|
72
|
+
json=payload,
|
|
73
|
+
headers={"Authorization": f"Bearer {self.sendgrid_api_key}"},
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
verbose_logger.debug(
|
|
77
|
+
f"SendGrid response status={response.status_code}, body={response.text}"
|
|
78
|
+
)
|
|
79
|
+
return
|
|
@@ -5,14 +5,10 @@ from litellm_enterprise.enterprise_callbacks.send_emails.endpoints import (
|
|
|
5
5
|
)
|
|
6
6
|
|
|
7
7
|
from .audit_logging_endpoints import router as audit_logging_router
|
|
8
|
-
from .guardrails.endpoints import router as guardrails_router
|
|
9
8
|
from .management_endpoints import management_endpoints_router
|
|
10
9
|
from .utils import _should_block_robots
|
|
11
|
-
from .vector_stores.endpoints import router as vector_stores_router
|
|
12
10
|
|
|
13
11
|
router = APIRouter()
|
|
14
|
-
router.include_router(vector_stores_router)
|
|
15
|
-
router.include_router(guardrails_router)
|
|
16
12
|
router.include_router(email_events_router)
|
|
17
13
|
router.include_router(audit_logging_router)
|
|
18
14
|
router.include_router(management_endpoints_router)
|
|
@@ -141,28 +141,36 @@ async def list_vector_stores(
|
|
|
141
141
|
"""
|
|
142
142
|
from litellm.proxy.proxy_server import prisma_client
|
|
143
143
|
|
|
144
|
-
seen_vector_store_ids = set()
|
|
145
|
-
|
|
146
144
|
try:
|
|
147
|
-
# Get
|
|
148
|
-
|
|
149
|
-
if litellm.vector_store_registry is not None:
|
|
150
|
-
in_memory_vector_stores = copy.deepcopy(
|
|
151
|
-
litellm.vector_store_registry.vector_stores
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
# Get vector stores from database
|
|
145
|
+
# Get vector stores from database (source of truth)
|
|
146
|
+
# Only return what's in the database to ensure consistency across instances
|
|
155
147
|
vector_stores_from_db = await VectorStoreRegistry._get_vector_stores_from_db(
|
|
156
148
|
prisma_client=prisma_client
|
|
157
149
|
)
|
|
150
|
+
|
|
151
|
+
# Also clean up in-memory registry to remove any deleted vector stores
|
|
152
|
+
if litellm.vector_store_registry is not None:
|
|
153
|
+
db_vector_store_ids = {
|
|
154
|
+
vs.get("vector_store_id")
|
|
155
|
+
for vs in vector_stores_from_db
|
|
156
|
+
if vs.get("vector_store_id")
|
|
157
|
+
}
|
|
158
|
+
# Remove any in-memory vector stores that no longer exist in database
|
|
159
|
+
vector_stores_to_remove = []
|
|
160
|
+
for vs in litellm.vector_store_registry.vector_stores:
|
|
161
|
+
vs_id = vs.get("vector_store_id")
|
|
162
|
+
if vs_id and vs_id not in db_vector_store_ids:
|
|
163
|
+
vector_stores_to_remove.append(vs_id)
|
|
164
|
+
for vs_id in vector_stores_to_remove:
|
|
165
|
+
litellm.vector_store_registry.delete_vector_store_from_registry(
|
|
166
|
+
vector_store_id=vs_id
|
|
167
|
+
)
|
|
168
|
+
verbose_proxy_logger.debug(
|
|
169
|
+
f"Removed deleted vector store {vs_id} from in-memory registry"
|
|
170
|
+
)
|
|
158
171
|
|
|
159
|
-
#
|
|
160
|
-
combined_vector_stores: List[LiteLLM_ManagedVectorStore] =
|
|
161
|
-
for vector_store in in_memory_vector_stores + vector_stores_from_db:
|
|
162
|
-
vector_store_id = vector_store.get("vector_store_id", None)
|
|
163
|
-
if vector_store_id not in seen_vector_store_ids:
|
|
164
|
-
combined_vector_stores.append(vector_store)
|
|
165
|
-
seen_vector_store_ids.add(vector_store_id)
|
|
172
|
+
# Use database as single source of truth for listing
|
|
173
|
+
combined_vector_stores: List[LiteLLM_ManagedVectorStore] = vector_stores_from_db
|
|
166
174
|
|
|
167
175
|
total_count = len(combined_vector_stores)
|
|
168
176
|
total_pages = (total_count + page_size - 1) // page_size
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "litellm-enterprise"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.24"
|
|
4
4
|
description = "Package for LiteLLM Enterprise features"
|
|
5
5
|
authors = ["BerriAI"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -22,7 +22,7 @@ requires = ["poetry-core"]
|
|
|
22
22
|
build-backend = "poetry.core.masonry.api"
|
|
23
23
|
|
|
24
24
|
[tool.commitizen]
|
|
25
|
-
version = "0.1.
|
|
25
|
+
version = "0.1.24"
|
|
26
26
|
version_files = [
|
|
27
27
|
"pyproject.toml:version",
|
|
28
28
|
"../requirements.txt:litellm-enterprise==",
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Callback to log events to a Generic API Endpoint
|
|
3
|
-
|
|
4
|
-
- Creates a StandardLoggingPayload
|
|
5
|
-
- Adds to batch queue
|
|
6
|
-
- Flushes based on CustomBatchLogger settings
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
import asyncio
|
|
10
|
-
import os
|
|
11
|
-
import traceback
|
|
12
|
-
from litellm._uuid import uuid
|
|
13
|
-
from typing import Dict, List, Optional, Union
|
|
14
|
-
|
|
15
|
-
import litellm
|
|
16
|
-
from litellm._logging import verbose_logger
|
|
17
|
-
from litellm.integrations.custom_batch_logger import CustomBatchLogger
|
|
18
|
-
from litellm.litellm_core_utils.safe_json_dumps import safe_dumps
|
|
19
|
-
from litellm.llms.custom_httpx.http_handler import (
|
|
20
|
-
get_async_httpx_client,
|
|
21
|
-
httpxSpecialProvider,
|
|
22
|
-
)
|
|
23
|
-
from litellm.types.utils import StandardLoggingPayload
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class GenericAPILogger(CustomBatchLogger):
|
|
27
|
-
def __init__(
|
|
28
|
-
self,
|
|
29
|
-
endpoint: Optional[str] = None,
|
|
30
|
-
headers: Optional[dict] = None,
|
|
31
|
-
**kwargs,
|
|
32
|
-
):
|
|
33
|
-
"""
|
|
34
|
-
Initialize the GenericAPILogger
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
endpoint: Optional[str] = None,
|
|
38
|
-
headers: Optional[dict] = None,
|
|
39
|
-
"""
|
|
40
|
-
#########################################################
|
|
41
|
-
# Init httpx client
|
|
42
|
-
#########################################################
|
|
43
|
-
self.async_httpx_client = get_async_httpx_client(
|
|
44
|
-
llm_provider=httpxSpecialProvider.LoggingCallback
|
|
45
|
-
)
|
|
46
|
-
endpoint = endpoint or os.getenv("GENERIC_LOGGER_ENDPOINT")
|
|
47
|
-
if endpoint is None:
|
|
48
|
-
raise ValueError(
|
|
49
|
-
"endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables"
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
self.headers: Dict = self._get_headers(headers)
|
|
53
|
-
self.endpoint: str = endpoint
|
|
54
|
-
verbose_logger.debug(
|
|
55
|
-
f"in init GenericAPILogger, endpoint {self.endpoint}, headers {self.headers}"
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
#########################################################
|
|
59
|
-
# Init variables for batch flushing logs
|
|
60
|
-
#########################################################
|
|
61
|
-
self.flush_lock = asyncio.Lock()
|
|
62
|
-
super().__init__(**kwargs, flush_lock=self.flush_lock)
|
|
63
|
-
asyncio.create_task(self.periodic_flush())
|
|
64
|
-
self.log_queue: List[Union[Dict, StandardLoggingPayload]] = []
|
|
65
|
-
|
|
66
|
-
def _get_headers(self, headers: Optional[dict] = None):
|
|
67
|
-
"""
|
|
68
|
-
Get headers for the Generic API Logger
|
|
69
|
-
|
|
70
|
-
Returns:
|
|
71
|
-
Dict: Headers for the Generic API Logger
|
|
72
|
-
|
|
73
|
-
Args:
|
|
74
|
-
headers: Optional[dict] = None
|
|
75
|
-
"""
|
|
76
|
-
# Process headers from different sources
|
|
77
|
-
headers_dict = {
|
|
78
|
-
"Content-Type": "application/json",
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# 1. First check for headers from env var
|
|
82
|
-
env_headers = os.getenv("GENERIC_LOGGER_HEADERS")
|
|
83
|
-
if env_headers:
|
|
84
|
-
try:
|
|
85
|
-
# Parse headers in format "key1=value1,key2=value2" or "key1=value1"
|
|
86
|
-
header_items = env_headers.split(",")
|
|
87
|
-
for item in header_items:
|
|
88
|
-
if "=" in item:
|
|
89
|
-
key, value = item.split("=", 1)
|
|
90
|
-
headers_dict[key.strip()] = value.strip()
|
|
91
|
-
except Exception as e:
|
|
92
|
-
verbose_logger.warning(
|
|
93
|
-
f"Error parsing headers from environment variables: {str(e)}"
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
# 2. Update with litellm generic headers if available
|
|
97
|
-
if litellm.generic_logger_headers:
|
|
98
|
-
headers_dict.update(litellm.generic_logger_headers)
|
|
99
|
-
|
|
100
|
-
# 3. Override with directly provided headers if any
|
|
101
|
-
if headers:
|
|
102
|
-
headers_dict.update(headers)
|
|
103
|
-
|
|
104
|
-
return headers_dict
|
|
105
|
-
|
|
106
|
-
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
|
|
107
|
-
"""
|
|
108
|
-
Async Log success events to Generic API Endpoint
|
|
109
|
-
|
|
110
|
-
- Creates a StandardLoggingPayload
|
|
111
|
-
- Adds to batch queue
|
|
112
|
-
- Flushes based on CustomBatchLogger settings
|
|
113
|
-
|
|
114
|
-
Raises:
|
|
115
|
-
Raises a NON Blocking verbose_logger.exception if an error occurs
|
|
116
|
-
"""
|
|
117
|
-
from litellm.proxy.utils import _premium_user_check
|
|
118
|
-
|
|
119
|
-
_premium_user_check()
|
|
120
|
-
|
|
121
|
-
try:
|
|
122
|
-
verbose_logger.debug(
|
|
123
|
-
"Generic API Logger - Enters logging function for model %s", kwargs
|
|
124
|
-
)
|
|
125
|
-
standard_logging_payload = kwargs.get("standard_logging_object", None)
|
|
126
|
-
|
|
127
|
-
# Backwards compatibility with old logging payload
|
|
128
|
-
if litellm.generic_api_use_v1 is True:
|
|
129
|
-
payload = self._get_v1_logging_payload(
|
|
130
|
-
kwargs=kwargs,
|
|
131
|
-
response_obj=response_obj,
|
|
132
|
-
start_time=start_time,
|
|
133
|
-
end_time=end_time,
|
|
134
|
-
)
|
|
135
|
-
self.log_queue.append(payload)
|
|
136
|
-
else:
|
|
137
|
-
# New logging payload, StandardLoggingPayload
|
|
138
|
-
self.log_queue.append(standard_logging_payload)
|
|
139
|
-
|
|
140
|
-
if len(self.log_queue) >= self.batch_size:
|
|
141
|
-
await self.async_send_batch()
|
|
142
|
-
|
|
143
|
-
except Exception as e:
|
|
144
|
-
verbose_logger.exception(
|
|
145
|
-
f"Generic API Logger Error - {str(e)}\n{traceback.format_exc()}"
|
|
146
|
-
)
|
|
147
|
-
pass
|
|
148
|
-
|
|
149
|
-
async def async_log_failure_event(self, kwargs, response_obj, start_time, end_time):
|
|
150
|
-
"""
|
|
151
|
-
Async Log failure events to Generic API Endpoint
|
|
152
|
-
|
|
153
|
-
- Creates a StandardLoggingPayload
|
|
154
|
-
- Adds to batch queue
|
|
155
|
-
"""
|
|
156
|
-
from litellm.proxy.utils import _premium_user_check
|
|
157
|
-
|
|
158
|
-
_premium_user_check()
|
|
159
|
-
|
|
160
|
-
try:
|
|
161
|
-
verbose_logger.debug(
|
|
162
|
-
"Generic API Logger - Enters logging function for model %s", kwargs
|
|
163
|
-
)
|
|
164
|
-
standard_logging_payload = kwargs.get("standard_logging_object", None)
|
|
165
|
-
|
|
166
|
-
if litellm.generic_api_use_v1 is True:
|
|
167
|
-
payload = self._get_v1_logging_payload(
|
|
168
|
-
kwargs=kwargs,
|
|
169
|
-
response_obj=response_obj,
|
|
170
|
-
start_time=start_time,
|
|
171
|
-
end_time=end_time,
|
|
172
|
-
)
|
|
173
|
-
self.log_queue.append(payload)
|
|
174
|
-
else:
|
|
175
|
-
self.log_queue.append(standard_logging_payload)
|
|
176
|
-
|
|
177
|
-
if len(self.log_queue) >= self.batch_size:
|
|
178
|
-
await self.async_send_batch()
|
|
179
|
-
|
|
180
|
-
except Exception as e:
|
|
181
|
-
verbose_logger.exception(
|
|
182
|
-
f"Generic API Logger Error - {str(e)}\n{traceback.format_exc()}"
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
async def async_send_batch(self):
|
|
186
|
-
"""
|
|
187
|
-
Sends the batch of messages to Generic API Endpoint
|
|
188
|
-
"""
|
|
189
|
-
try:
|
|
190
|
-
if not self.log_queue:
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
verbose_logger.debug(
|
|
194
|
-
f"Generic API Logger - about to flush {len(self.log_queue)} events"
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
# make POST request to Generic API Endpoint
|
|
198
|
-
response = await self.async_httpx_client.post(
|
|
199
|
-
url=self.endpoint,
|
|
200
|
-
headers=self.headers,
|
|
201
|
-
data=safe_dumps(self.log_queue),
|
|
202
|
-
)
|
|
203
|
-
|
|
204
|
-
verbose_logger.debug(
|
|
205
|
-
f"Generic API Logger - sent batch to {self.endpoint}, status code {response.status_code}"
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
except Exception as e:
|
|
209
|
-
verbose_logger.exception(
|
|
210
|
-
f"Generic API Logger Error sending batch - {str(e)}\n{traceback.format_exc()}"
|
|
211
|
-
)
|
|
212
|
-
finally:
|
|
213
|
-
self.log_queue.clear()
|
|
214
|
-
|
|
215
|
-
def _get_v1_logging_payload(
|
|
216
|
-
self, kwargs, response_obj, start_time, end_time
|
|
217
|
-
) -> dict:
|
|
218
|
-
"""
|
|
219
|
-
Maintained for backwards compatibility with old logging payload
|
|
220
|
-
|
|
221
|
-
Returns a dict of the payload to send to the Generic API Endpoint
|
|
222
|
-
"""
|
|
223
|
-
verbose_logger.debug(
|
|
224
|
-
f"GenericAPILogger Logging - Enters logging function for model {kwargs}"
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
# construct payload to send custom logger
|
|
228
|
-
# follows the same params as langfuse.py
|
|
229
|
-
litellm_params = kwargs.get("litellm_params", {})
|
|
230
|
-
metadata = (
|
|
231
|
-
litellm_params.get("metadata", {}) or {}
|
|
232
|
-
) # if litellm_params['metadata'] == None
|
|
233
|
-
messages = kwargs.get("messages")
|
|
234
|
-
cost = kwargs.get("response_cost", 0.0)
|
|
235
|
-
optional_params = kwargs.get("optional_params", {})
|
|
236
|
-
call_type = kwargs.get("call_type", "litellm.completion")
|
|
237
|
-
cache_hit = kwargs.get("cache_hit", False)
|
|
238
|
-
usage = response_obj["usage"]
|
|
239
|
-
id = response_obj.get("id", str(uuid.uuid4()))
|
|
240
|
-
|
|
241
|
-
# Build the initial payload
|
|
242
|
-
payload = {
|
|
243
|
-
"id": id,
|
|
244
|
-
"call_type": call_type,
|
|
245
|
-
"cache_hit": cache_hit,
|
|
246
|
-
"startTime": start_time,
|
|
247
|
-
"endTime": end_time,
|
|
248
|
-
"model": kwargs.get("model", ""),
|
|
249
|
-
"user": kwargs.get("user", ""),
|
|
250
|
-
"modelParameters": optional_params,
|
|
251
|
-
"messages": messages,
|
|
252
|
-
"response": response_obj,
|
|
253
|
-
"usage": usage,
|
|
254
|
-
"metadata": metadata,
|
|
255
|
-
"cost": cost,
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
# Ensure everything in the payload is converted to str
|
|
259
|
-
for key, value in payload.items():
|
|
260
|
-
try:
|
|
261
|
-
payload[key] = str(value)
|
|
262
|
-
except Exception:
|
|
263
|
-
# non blocking if it can't cast to a str
|
|
264
|
-
pass
|
|
265
|
-
|
|
266
|
-
return payload
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/auth/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{litellm_enterprise-0.1.22 → litellm_enterprise-0.1.24}/litellm_enterprise/proxy/proxy_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|