Langchain
In this guide, we will show how to use Nebuly’s Javascript and Typescript SDK to collect interactions from langchain’s chains and agents.
The Nebuly SDK enables you to monitor all the requests made to:
Currently langchain-js integration is in beta. It currently supports only the agents and chains based on ChatModel
s, like "gpt-4"
and "gpt-3.5-turbo"
.
The process is straightforward, you just need to:
- import the
NebulyCallbackHandler
from the Nebuly SDK - pass the
NebulyCallbackHandler
to the original langchain method calls
Below you can find a simplified snippet showing how to use it
In order to send the data to Nebuly’s platform the handler sendData
method needs to be called AFTER the chain has been run.
The needed parameters are
An id or username uniquely identifying the end-user. We recommend hashing their username or email address, in order to avoid sending us any identifying information.
The Nebuly API key. If no API key is explicitly provided, the handler will search for it in the NEBULY_API_KEY environment variable.
You can then use the platform to analyze the results and get insights about your LLM users.