- 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.GOOGLE_CLOUD_PROJECT is used later by the Gemini judge, which reaches the model through Vertex AI rather than the Gemini API.
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, API key and Developer 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
GeminiModel reaches Gemini through Vertex AI, so it needs Google Cloud credentials and a project. Run these once, using a project that has the Vertex AI API enabled.
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