litellm/old-docs/advanced.md
Krrish Dholakia dc6e93f0d0 updating docs
2023-08-12 11:30:32 -07:00

928 B

Advanced - Callbacks

Use Callbacks to send Output Data to Posthog, Sentry etc

liteLLM provides success_callbacks and failure_callbacks, making it easy for you to send data to a particular provider depending on the status of your responses.

liteLLM supports:

Quick Start

from litellm import completion

# set callbacks
litellm.success_callback=["posthog", "helicone"]
litellm.failure_callback=["sentry"]

## set env variables
os.environ['SENTRY_API_URL'], 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"] = "" 

response = completion(model="gpt-3.5-turbo", messages=messages)