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 ChatModels, 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
Copy
Ask AI
import { NebulyCallbackHandler } from '@nebuly-ai/nebuly-js-sdk';let handler = new NebulyCallbackHandler('<YOUR_USER_ID>', '<NEBULY_API_KEY>');// Here add the handler to the call of your langchain chains or agentsawait handler.sendData();
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.