Integrating Langfuse with Langflow
Introduction
Langfuse is an open-source tracing and analytics tool designed for LLM applications. Integrating Langfuse with Langflow provides detailed production traces and granular insights into quality, cost, and latency. This integration allows you to monitor and debug your Langflow's chat or APIs easily.
Step-by-Step Instructions
Step 1: Create a Langfuse account
- Go to Langfuse and click on the "Sign In" button in the top right corner.
- Click on the "Sign Up" button and create an account.
- Once logged in, click on "Settings" and then on "Create new API keys."
- Copy the Public key and the Secret Key and save them somewhere safe.
Step 2: Set up Langfuse in Langflow
-
Export the Environment Variables: You'll need to export the environment variables
LANGFLOW_LANGFUSE_SECRET_KEY
andLANGFLOW_LANGFUSE_PUBLIC_KEY
with the values obtained in Step 1.You can do this by executing the following commands in your terminal:
_10export LANGFLOW_LANGFUSE_SECRET_KEY=<your secret key>_10export LANGFLOW_LANGFUSE_PUBLIC_KEY=<your public key>Alternatively, you can run the Langflow CLI command:
_10LANGFLOW_LANGFUSE_SECRET_KEY=<your secret key> LANGFLOW_LANGFUSE_PUBLIC_KEY=<your public key> langflowIf you are self-hosting Langfuse, you can also set the environment variable
LANGFLOW_LANGFUSE_HOST
to point to your Langfuse instance. By default, Langfuse points to the cloud instance athttps://cloud.langfuse.com
. -
Verify Integration: Ensure that the environment variables are set correctly by checking their existence in your environment, for example by running:
_10echo $LANGFLOW_LANGFUSE_SECRET_KEY_10echo $LANGFLOW_LANGFUSE_PUBLIC_KEY -
Monitor Langflow: Now, whenever you use Langflow's chat or API, you will be able to see the tracing of your conversations in Langfuse.
That's it! You have successfully integrated Langfuse with Langflow, enhancing observability and debugging capabilities for your LLM application.
Note: For more details or customized configurations, please refer to the official Langfuse documentation.