LiteLLM
Configure LiteLLM to send traces to Laminar
Default configuration
LiteLLM is well integrated with OpenTelemetry, so you only need to specify the configuration through the environment variables.
Set the environment variables
authorization
must start with a lowercase a
. This is different from
common HTTP headers convention.
Enable otel callback in the code
Run your code and see traces in Laminar
Using Laminar’s features
If you want to use Laminar’s features, such as sessions, manual spans, observe
decorator,
you will need to initialize Laminar.
Laminar should be initialized once in your application. This could be at the server startup, or in the entry point of your application.
This will automatically instrument all major LLM provider SDKs, LLM frameworks including LangChain and LlamaIndex, and calls to vector databases.
In some Node JS setups, you may need to manually pass the modules you want to instrument, such as OpenAI. See the section on manual instrumentation.
For more information, refer to the instrumentation docs.
This, however, will most likely result in your LLM calls being double-traced – once by LiteLLM and once by Laminar. To avoid this, you can disable automatic Laminar instruments at initialization.