OpenAI
OpenAI SDK
Learn how to integrate Maxim observability with the OpenAI SDK in just one line of code.
Requirements
Env variables
Initialize logger
Initialize MaximOpenAIClient
Make LLM calls using MaximOpenAIClient
Advanced use-cases
Capture multiple LLM calls in one trace
1
Initialize Maxim SDK and OpenAI Client
2
Create a new trace externally
3
Make LLM calls and use this trace id
4
Keep adding LLM calls
All LLM calls with extra header maxim_trace_id: trace_id
will add it the declared trace.
Capture multi-turn conversations
1
Initialize Maxim SDK and OpenAI Client
2
Create a new trace externally and add it to a session
3
Make LLM calls and use this trace id