- Prompt Gemini to generate a transcript of the audio recording.
- Trace Gemini API calls and send the traces to the Arize AX platform with links to audio file for playback.
- Evaluate the transcription output from Gemini for sentiment analysis using Phoenix Evals and Gemini LLM (LLM as a Judge).
Install dependencies
Set your credentials
Copy your Space ID and API key from your Arize AX Space Settings page, and set them alongside your Gemini API key. If you don’t have a Gemini key yet, create one in Google AI Studio.Load an audio file sample and set the URL
Download the recording locally. The URL is also passed to Arize AX later so you can play the audio back next to the trace.Tracing setup
You’ll need to set Arize AX variables (Space ID and API key) below to send traces to the Arize AX Platform. Sign up for free here.Configure prompt
Call Gemini
Evaluate Gemini’s output transcript for sentiment analysis
First, export spans from Arize AX that contain transcript output from Arize AXEvaluation Template
Evaluate transcriptions using Gemini as a LLM as a Judge
The judge calls Gemini through the Gemini API using theGEMINI_API_KEY you set earlier. create_classifier constrains the judge to the three sentiment labels and returns an explanation with each label.
Send evaluations to Arize AX
Next Steps
Useful API references:
More details about Gemini API’s vision capabilities in the documentation. If you want to know about the File API, check its API reference or the File API quickstart.Related examples
Check this example using the audio files to give you more ideas on what the gemini API can do with them:- Share Voice memos with Gemini API and brainstorm ideas