Salta ai contenuti

Arize Phoenix - Foglio di aiuto per l'osservabilità e la valutazione dei modelli linguistici

Arize Phoenix - Foglio di aiuto per l”osservabilità e la valutazione dei modelli linguistici

Arize Phoenix è una piattaforma open-source di osservabilità e valutazione per applicazioni e agenti di LLM. È nativa di OpenTelemetry: l”instrumentazione emette tracce OTLP standard che Phoenix raccoglie, quindi puoi vedere ogni prompt, chiamata di modello, invocazione di strumento e passaggio di recupero, quindi eseguire valutazioni su di essi. Viene eseguito localmente (notebook, contenitore o server self-hosted) e si integra con framework comuni tramite strumenti di instrumentazione OpenInference.

Installation

MethodCommand
pippip install arize-phoenix
Run a local serverphoenix serve (UI at http://localhost:6006)
Dockerdocker run -p 6006:6006 arizephoenix/phoenix:latest
In a notebookimport phoenix as px; px.launch_app()
Instrumentation extraspip install openinference-instrumentation-openai (and others)

Quickstart della traccia

from phoenix.otel import register

# Configure the tracer provider and point it at a Phoenix collector
tracer_provider = register(
    project_name="my-llm-app",
    endpoint="http://localhost:6006/v1/traces",
)

# Auto-instrument a library (example: OpenAI)
from openinference.instrumentation.openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument(tracer_provider=tracer_provider)

# ...now your LLM calls show up as traces in Phoenix
ConceptSignificato
SpanUn”operazione (chiamata LLM, chiamata di strumento, passaggio di recupero)
TraceUn albero di span per una richiesta
ProjectUna raccolta denominata di tracce
OpenInferenceLe convenzioni semantiche che Phoenix usa su OTLP

Instrumentazione del framework

LibraryPacchetto instrumentor
OpenAIopeninference-instrumentation-openai
LangChainopeninference-instrumentation-langchain
LlamaIndexopeninference-instrumentation-llama-index
Anthropicopeninference-instrumentation-anthropic
DSPyopeninference-instrumentation-dspy
Auto (many)enable via register(auto_instrument=True)

Span manuali

from opentelemetry import trace
tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span("retrieve") as span:
    span.set_attribute("input.value", query)
    docs = retriever(query)
    span.set_attribute("retrieval.documents", len(docs))

Valutazione

Phoenix può assegnare punteggi alle tracce (specialmente valutazioni LLM-as-judge) e allegare risultati.

from phoenix.evals import llm_classify, OpenAIModel, HALLUCINATION_PROMPT_TEMPLATE

results = llm_classify(
    dataframe=spans_df,
    model=OpenAIModel(model="gpt-4o"),
    template=HALLUCINATION_PROMPT_TEMPLATE,
    rails=["factual", "hallucinated"],
)
EvalMisura
HallucinationLa risposta è fondata nel contesto?
QA correctnessLa risposta è corretta rispetto al riferimento?
RelevanceI documenti recuperati sono rilevanti per la query?
ToxicityContenuto non sicuro/tossico
CustomIl tuo modello LLM-as-judge o modello di codice personalizzato

Dataset e esperimenti

CapabilityUsa
DatasetsCura esempi di input/output dalle tracce
ExperimentsEsegui un”attività su un dataset e assegnagli un punteggio
px.Client().upload_dataset(...)Crea un dataset a livello di programmazione
Compare runsTraccia la qualità tra prompt/modello cambia

Debug della ricerca

FeatureAiuta con
Span attributes for retrieved docsVedi esattamente cosa ha recuperato RAG
Embedding/UMAP viewsIndividua cluster e drift negli embedding
Eval on retrieval relevanceQuantifica la qualità della ricerca per query

Arize Phoenix vs Altra osservabilità LLM

AspectArize PhoenixLangfuseMLflow
StandardOpenTelemetry/OTLPOTel + SDKMLflow tracing
FocusTracing + eval + retrieval debugTracing + prompts + evalFull ML platform + LLM
Self-hostYesYesYes
Best forOTel-native eval & RAG debuggingProduct analytics + promptsTeams already on MLflow

Resources