TheDocumentation Index
Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
arize-phoenix-evals library uses an LLM-as-judge to grade model output — hallucinations, factuality, helpfulness, toxicity, custom rubrics. Plug Google Gemini in as the judge by passing provider="google" to the LLM(...) wrapper, then build a create_classifier(...) evaluator and run it over a DataFrame with evaluate_dataframe(...).
Prerequisites
- Python 3.11+
- A
GEMINI_API_KEYfrom Google AI Studio
Install
Configure credentials
Setup the eval LLM
gemini-2.5-flash is a strong default judge — fast and cheap relative to gemini-2.5-pro. The judge’s job is classification, not generation, so a smaller model is often sufficient.
Run an evaluation
This example builds a hallucination classifier and grades two sample question/answer pairs against a reference. The pattern generalizes: replace the prompt template, choices, and DataFrame columns with whatever metric you want to evaluate.Expected output
hallucination_execution_details (status + exceptions + timing) and the original hallucination_score column with each evaluator result’s full dict (name, score, label, explanation, metadata, kind, direction) — useful for surfacing the LLM’s reasoning, persisting eval rows back to Arize AX, or filtering retries.
Troubleshooting
401/403from Gemini. VerifyGEMINI_API_KEYis set and has access to the model. The Google adapter also acceptsGOOGLE_API_KEYas a fallback.404 NOT_FOUNDfor the model. Google occasionally retires older Gemini aliases for new users. Swapgemini-2.5-flashfor a current model from the Gemini models page.- All rows return the same label. Your prompt template isn’t differentiating cases. Make sure each row’s
{input}/{output}/{reference}columns expose enough context for the judge to discriminate, and thatchoiceslists every label your prompt asks the LLM to emit. - Some rows fail with timeout / rate-limit. Pass
max_retries=toevaluate_dataframe(...)(defaults to 3). For large batches, also passinitial_per_second_request_rate=...toLLM(...)to throttle. - Logging results back to Arize AX. This guide stops at producing the eval DataFrame. To attach those evals to existing spans in an Arize AX project, use
log_evaluations_synconarize.Client. - Using Vertex AI instead of the Gemini API. Switch to
provider="vertex"and setVERTEXAI_PROJECT/VERTEXAI_LOCATIONinstead ofGEMINI_API_KEY. See the Vertex AI evals doc for the full pattern.