Connect to your Phoenix instance using the register function.
Copy
Ask AI
from phoenix.otel import register# configure the Phoenix tracertracer_provider = register( project_name="my-llm-app", # Default is 'default' auto_instrument=True # Auto-instrument your app based on installed OI dependencies)
from guardrails import Guardfrom guardrails.hub import TwoWordsimport openaiguard = Guard().use( TwoWords(),)response = guard( llm_api=openai.chat.completions.create, prompt="What is another name for America?", model="gpt-3.5-turbo", max_tokens=1024,)print(response)
Now that you have tracing setup, all invocations of underlying models used by Guardrails (completions, chat completions, embeddings) will be streamed to your running Phoenix for observability and evaluation. Additionally, Guards will be present as a new span kind in Phoenix.