Merge pull request #36 from Michelklingler/main

Added Langfuse integration tutorial
This commit is contained in:
Timothy Jaeryang Baek 2024-04-05 17:29:50 -07:00 committed by GitHub
commit eaef7af778
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 0 deletions

52
docs/tutorial/langfuse.md Normal file
View File

@ -0,0 +1,52 @@
---
sidebar_position: 7
title: "Monitoring with Langfuse"
---
# Monitoring with Langfuse
Integrating [Langfuse](https://cloud.langfuse.com) with LiteLLM allows for detailed observation and recording of API calls.
This guide walks you through setting up Langfuse callbacks with LiteLLM.
The local deployment of Langfuse is an option available through their open-source alternative. However, for the convenience of this tutorial, we will utilize the free limited version of their Cloud service. If data privacy is a concern for you, it is recommended to install the local version instead.
## Getting Started with Langfuse
Begin by setting up your Langfuse account and acquiring necessary keys:
1. Create an account at [Langfuse](https://cloud.langfuse.com/auth/sign-up).
2. Generate and copy your public and private keys.
## Configuring OpenWebUI LiteLLM Proxy for Langfuse
To integrate Langfuse with LiteLLM, you'll need to modify the LiteLLM `config.yaml` file and set environment variables for your Docker container.
### Editing the LiteLLM Configuration File
Edit the LiteLLM `config.yaml` file, located in your host Docker mount point at `/data/litellm/config.yaml`.
Add the following under the general settings as shown in the [LiteLLM official documentation](https://litellm.vercel.app/docs/observability/langfuse_integration):
```yaml
general_settings: {}
litellm_settings:
success_callback: ["langfuse"]
failure_callback: ["langfuse"]
```
### Setting Environment Variables in Docker
When launching the Docker container, pass the Langfuse API keys as environment variables:
```bash
LANGFUSE_PUBLIC_KEY: Replace "xxxxx" with your actual public key.
LANGFUSE_SECRET_KEY: Replace "xxxxx" with your actual secret key.
These variables can be set directly in the docker run command or through a Docker Compose YAML file.
```
## Testing the Integration
Once setup is complete, your Langfuse dashboard should start recording every API call made through the LiteLLM integration. This allows for efficient monitoring and troubleshooting of API interactions.
![Langfuse Dashboard](/img/langfuse.png)
## Note
Ensure that all configurations are correctly set, and environment variables are properly passed to avoid integration issues.

BIN
static/img/Langfuse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB