Phoenix
Install
In a separate non-project folder, install and run phoenix as a local instance:
Run: Phoenix would now be available at http://127.0.0.1:6006Quick Start
Tracing
Install and register tracer in the project.
Example code with phoenix tracing:import os
from phoenix.otel import register
import openai
from getpass import getpass
# Register Tracer
tracer_provider = register(
project_name="my-llm-app",
auto_instrument=True,
)
tracer = tracer_provider.get_tracer(__name__)
# OpenAI Example
if not (openai_api_key := os.getenv("OPENAI_API_KEY")):
openai_api_key = getpass("🔑 Enter your OpenAI API key: ")
os.environ["OPENAI_API_KEY"] = openai_api_key
client = openai.OpenAI()
response = client.responses.create(
model="gpt-4o",
input=[
{"role": "user", "content": "Why is the sky blue?"}
]
)
print(response.output_text)
Prompt Playground
- Run Phoenix local and go to http://127.0.0.1:6006/playground
- Add OpenAI key.
- Choose model, system prompt and user prompt.
- Run.
- Save prompts with versioning.