Callbacks
Verwenden Sie Callbacks, um Ausgabedaten an Posthog, Sentry usw. zu senden​
liteLLM stellt input_callbacks, success_callbacks und failure_callbacks zur Verfügung, sodass Sie je nach Status Ihrer Antworten einfach Daten an einen bestimmten Anbieter senden können.
liteLLM unterstützt
- Benutzerdefinierte Callback-Funktionen
- Lunary
- Langfuse
- LangSmith
- Helicone
- Traceloop
- Athina
- Sentry
- PostHog
- Slack
Dies ist keine umfassende Liste. Bitte prüfen Sie das Dropdown-Menü für alle Protokollierungs-Integrationen.
Schnellstart​
from litellm import completion
# set callbacks
litellm.input_callback=["sentry"] # for sentry breadcrumbing - logs the input being sent to the api
litellm.success_callback=["posthog", "helicone", "langfuse", "lunary", "athina"]
litellm.failure_callback=["sentry", "lunary", "langfuse"]
## set env variables
os.environ['LUNARY_PUBLIC_KEY'] = ""
os.environ['SENTRY_DSN'], os.environ['SENTRY_API_TRACE_RATE']= ""
os.environ['POSTHOG_API_KEY'], os.environ['POSTHOG_API_URL'] = "api-key", "api-url"
os.environ["HELICONE_API_KEY"] = ""
os.environ["TRACELOOP_API_KEY"] = ""
os.environ["LUNARY_PUBLIC_KEY"] = ""
os.environ["ATHINA_API_KEY"] = ""
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
os.environ["LANGFUSE_SECRET_KEY"] = ""
os.environ["LANGFUSE_HOST"] = ""
response = completion(model="gpt-3.5-turbo", messages=messages)