mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(docs) improve sentry callback
This commit is contained in:
parent
7508ef958c
commit
bdc96d6390
2 changed files with 20 additions and 4 deletions
|
@ -1,14 +1,30 @@
|
||||||
# Sentry Tutorial
|
import Image from '@theme/IdealImage';
|
||||||
|
|
||||||
|
# Sentry - Log LLM Exceptions
|
||||||
[Sentry](https://sentry.io/) provides error monitoring for production. LiteLLM can add breadcrumbs and send exceptions to Sentry with this integration
|
[Sentry](https://sentry.io/) provides error monitoring for production. LiteLLM can add breadcrumbs and send exceptions to Sentry with this integration
|
||||||
|
|
||||||
This works on normal, async and streaming completion calls
|
Track exceptions for:
|
||||||
|
- litellm.completion() - completion()for 100+ LLMs
|
||||||
|
- litellm.acompletion() - async completion()
|
||||||
|
- Streaming completion() & acompletion() calls
|
||||||
|
|
||||||
### usage
|
<Image img={require('../../img/sentry.png')} />
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Set SENTRY_DSN & callback
|
||||||
|
|
||||||
|
```python
|
||||||
|
import litellm, os
|
||||||
|
os.environ["SENTRY_DSN"] = "your-sentry-url"
|
||||||
|
litellm.failure_callback=["sentry"]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sentry callback with completion
|
||||||
```python
|
```python
|
||||||
import litellm
|
import litellm
|
||||||
from litellm import completion
|
from litellm import completion
|
||||||
litellm.set_verbose = True
|
|
||||||
|
|
||||||
litellm.input_callback=["sentry"] # adds sentry breadcrumbing
|
litellm.input_callback=["sentry"] # adds sentry breadcrumbing
|
||||||
litellm.failure_callback=["sentry"] # [OPTIONAL] if you want litellm to capture -> send exception to sentry
|
litellm.failure_callback=["sentry"] # [OPTIONAL] if you want litellm to capture -> send exception to sentry
|
||||||
|
|
BIN
docs/my-website/img/sentry.png
Normal file
BIN
docs/my-website/img/sentry.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 471 KiB |
Loading…
Add table
Add a link
Reference in a new issue