Overview
This package provides a TypeSript client for the Arize Phoenix API.
Installation
Configuration
The client will automatically read environment variables from your environment, if available.
The following environment variables are used:
PHOENIX_HOST
- The base URL of the Phoenix API.PHOENIX_API_KEY
- The API key to use for authentication.PHOENIX_CLIENT_HEADERS
- Custom headers to add to all requests. A JSON stringified object.
Alternatively, you can pass configuration options to the client directly, and they will be prioritized over environment variables and default values.
Prompts
@arizeai/phoenix-client
provides a prompts
export that exposes utilities for working with prompts for LLMs.
Creating a Prompt and push it to Phoenix
The createPrompt
function can be used to create a prompt in Phoenix for version control and reuse.
Prompts that are pushed to Phoenix are versioned and can be tagged.
Pulling a Prompt from Phoenix
The getPrompt
function can be used to pull a prompt from Phoenix based on some Prompt Identifier and returns it in the Phoenix SDK Prompt type.
Using a Phoenix Prompt with an LLM Provider SDK
The toSDK
helper function can be used to convert a Phoenix Prompt to the format expected by an LLM provider SDK. You can then use the LLM provider SDK as normal, with your prompt.
If your Prompt is saved in Phoenix as openai
, you can use the toSDK
function to convert the prompt to the format expected by OpenAI, or even Anthropic and Vercel AI SDK. We will do a best
effort conversion to your LLM provider SDK of choice.
The following LLM provider SDKs are supported:
Vercel AI SDK:
ai
aiOpenAI:
openai
openaiAnthropic:
anthropic
@anthropic-ai/sdk
REST Endpoints
The client provides a REST API for all endpoints defined in the Phoenix OpenAPI spec.
Endpoints are accessible via strongly-typed string literals and TypeScript auto-completion inside of the client object.
A comprehensive overview of the available endpoints and their parameters is available in the OpenAPI viewer within Phoenix, or in the Phoenix OpenAPI spec.
Examples
To run examples, install dependencies using pnpm
and run:
Compatibility
This package utilizes openapi-ts to generate the types from the Phoenix OpenAPI spec.
Because of this, this package only works with the arize-phonix
server 8.0.0 and above.
Compatibility Table:
^1.0.0
^8.0.0
Last updated
Was this helpful?