Langflow Integration
Langflow is a low-code tool for building LLM pipelines. If you are using Langflow, you can easily enable LangWatch from their UI for analytics, evaluations and much more.
Setup
Obtain your API Key
Create your LangWatch account and project to obtain your API Key from the dashboard
Environment Variables
Add the following key to Langflow .env file:
Or export in in your terminal:
Restart Langflow
Restart Langflow using langflow run --env-file .env
Test the integration
Run a message through your Langflow project and check the LangWatch dashboard for monitoring and observability.
That’s it! You should now see your Langflow component traces on the LangWatch dashboard.
Defining custom input and output
You can customize what LangWatch captures as the final input and output of your Langflow component for better observability.
To do this, you can add this two lines of code in the execution function of any Langflow component:
You can do this by first clicking on the <> Code
button in any appropriate component:
Then scroll down to find the def
responsible for execution of that component and paste the code above, mapping the variables as needed for your case:
The message on LangWatch will render as you defined:
Capturing additional metadata
You can also capture additional metadata from your Langflow component. This can be useful for capturing information about the user, the conversation, or any specific information from your system.
Just like for the input and output, you can capture metadata by updating the trace, two very useful cases to capture for example are the user_id and trace_id that groups messages from the same conversation, but you can also capture any other information that you want to track.
For more information, check out Langflow docs.