2023-08-03 21:57:30 +08:00
# Advanced - Callbacks
2023-07-30 03:40:53 +08:00
2023-08-03 21:57:30 +08:00
## 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:
- [Helicone ](https://docs.helicone.ai/introduction )
- [Sentry ](https://docs.sentry.io/platforms/python/ )
- [PostHog ](https://posthog.com/docs/libraries/python )
- [Slack ](https://slack.dev/bolt-python/concepts )
2023-07-30 03:40:53 +08:00
### Quick Start
```python
2023-08-03 21:57:30 +08:00
from litellm import completion
# set callbacks
litellm.success_callback=["posthog", "helicone"]
litellm.failure_callback=["sentry"]
2023-07-30 03:40:53 +08:00
## set env variables
2023-08-03 21:57:30 +08:00
os.environ['SENTRY_API_URL'], os.environ['SENTRY_API_TRACE_RATE']= ""
2023-07-30 03:40:53 +08:00
os.environ['POSTHOG_API_KEY'], os.environ['POSTHOG_API_URL'] = "api-key", "api-url"
2023-08-03 21:57:30 +08:00
os.environ["HELICONE_API_KEY"] = ""
2023-07-30 03:40:53 +08:00
response = completion(model="gpt-3.5-turbo", messages=messages)
```