Skip to main content

PyPI Version

Info

For the complete API reference and detailed guides, see the full documentation.

Phoenix Client provides a interface for interacting with the Phoenix platform via its REST API, enabling you to manage datasets, run experiments, analyze traces, and collect feedback programmatically

Features#

  • REST API Interface - Interact with Phoenix’s OpenAPI REST interface
  • Prompts - Create, version, and invoke prompt templates
  • Datasets - Create and append to datasets from DataFrames, CSV files, or dictionaries
  • Experiments - Run evaluations and track experiment results
  • Spans - Query and analyze traces with powerful filtering
  • Annotations - Add human feedback and automated evaluations
  • Sessions - Retrieve and list multi-turn conversation sessions

Installation#

Install the Phoenix Client using pip:

Getting Started#

Environment Variables#

Configure the Phoenix Client using environment variables for seamless use across different environments:

PHOENIX_ENDPOINT is a base URL and is the canonical setting for the client. If your app also exports traces, set PHOENIX_COLLECTOR_ENDPOINT for the OTel SDK — usually to the same value. When only PHOENIX_COLLECTOR_ENDPOINT is set, the client infers its base URL from it. See Environments.

Client Initialization#

The client automatically reads environment variables, or you can override them:

Resources#

The Phoenix Client organizes functionality into resources that correspond to key Phoenix platform features. Each resource provides specialized methods for managing different types of data:

Prompts#

Manage prompt templates and versions:

Datasets#

Manage evaluation datasets and examples for experiments and evaluation:

Spans#

Query for spans and annotations from your projects for custom evaluation and annotation workflows:

Annotations#

Add annotations to spans for evaluation, user feedback, and custom annotation workflows:

Projects#

Manage Phoenix projects that organize your AI application data:

Sessions#

Retrieve session data for multi-turn conversations. Sessions group related traces from a conversation into a single timeline.

Async Usage#


Reference Documentation#

Full API Reference

Complete API documentation for datasets, experiments, prompts, spans, sessions, and annotations