Note*: This instrumentation also works with Azure OpenAI
Install
Setup
Add your OpenAI API key as an environment variable:register function:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Phoenix provides auto-instrumentation for the OpenAI Python Library.
pip install openinference-instrumentation-openai openai
export OPENAI_API_KEY=[your_key_here]
register function:
import openai
client = openai.OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Write a haiku."}],
)
print(response.choices[0].message.content)
Was this page helpful?
