Phonic Python SDK

raw JSON →
0.31.15 verified Fri May 01 auth: no python

Phonic is an AI evaluation and monitoring platform. The Python SDK (v0.31.15) provides tools to log evaluations, manage datasets, and analyze AI model performance. Release cadence is irregular; breaking changes may occur.

pip install phonic
error ImportError: cannot import name 'Phonic' from 'phonic'
cause Old installation or wrong import path; class name changed from 'Client' to 'Phonic'.
fix
Run 'pip install --upgrade phonic' and use 'from phonic import Phonic'.
error AttributeError: module 'phonic' has no attribute 'Client'
cause Using deprecated class name 'Client' which was removed in v0.30.0.
fix
Use 'from phonic import Phonic' and instantiate 'Phonic(api_key=...)'.
error TypeError: log_evaluation() got an unexpected keyword argument 'correct'
cause Parameter 'correct' was renamed to 'expected' in recent versions.
fix
Replace keyword argument 'correct' with 'expected'.
breaking The 'Phonic' class replaced 'Client' in v0.30.0; 'Client' is removed.
fix Replace 'from phonic import Client' with 'from phonic import Phonic'.
deprecated Argument 'correct' in log_evaluation is deprecated; use 'expected' instead.
fix Replace 'correct=...' with 'expected=...'.
gotcha API key must be passed as string; environment variable 'PHONIC_API_KEY' is not automatically read by client init. Use os.environ.get() explicitly.
fix client = Phonic(api_key=os.environ.get('PHONIC_API_KEY', ''))

Initialize client with API key from env var and log an evaluation.

from phonic import Phonic

client = Phonic(api_key=os.environ.get('PHONIC_API_KEY', ''))
# Log an evaluation
client.log_evaluation(
    project_name='my-project',
    input='What is the capital of France?',
    output='Paris',
    expected='Paris',
    scores={'accuracy': 1.0}
)