Auto Instrument: TS
Last updated
Last updated
Phoenix natively supports collecting traces generated via OpenInference automatic instrumentation. The supported instrumentations are
Library | Instrumentation | Version |
---|---|---|
OpenInference JS is fully open-source and maintained on GitHub
OpenInference uses OpenTelemetry Protocol (OTLP) to send traces Phoenix. To use OpenInference, you will need to install the OpenTelemetry SDK and the OpenInference instrumentation for the LLM framework you are using.
Install the OpenTelemetry SDK:
Install the OpenInference instrumentation you would like to use:
If you plan on manually instrumenting your application, you will also need to install the OpenInference Semantic Conventions:
This example instruments OpenAI but you can replace @arizeai/openinference-instrumentation-openai
with the instrumentation(s) of your choosing.
To load the OpenAI instrumentation, specify it in the registerInstrumentations call along with any additional instrumentation you wish to enable.
For more information on OpenTelemetry Node.js SDK, see the OpenTelemetry Node.js SDK documentation.
Note the above instrumentation must run before any other code in your application. This is because the instrumentation will only capture spans for the code that runs after the instrumentation is loaded. Typically this is done by requiring the instrumentation when running your application. node -r ./path/to/instrumentation.js ./path/to/your/app.js
\
OpenAI
@arizeai/openinference-instrumentation-openai
LangChainJS
@arizeai/openinference-instrumentation-langchain