This is a very simple example of how to setup LangChain.js auto instrumentation in a node application.
Checkout the instrumentation.ts file to see how to auto-instrument LangChain.js and export spans to a locally running (Phoenix)[https://github.com/Arize-ai/phoenix] server.
Checkout the chat.ts file to see how to send a simple message to OpenAI with langchain.
Please use node version >= 18 to run this example.
docker run -p 6006:6006 -i -t arizephoenix/phoenix
OPENAI_API_KEY
.pnpm -r install
pnpm -r prebuild
pnpm -r build
openinference-instrumentation-langchain
package directorynode dist/examples/chat.js
You should see your spans exported in your console. If you’ve set up a locally running Phoenix server, head over to localhost:6006
to see your spans.