Endpoint
Request body
The conversation transcript text to analyze and respond to
Object containing emotion names as keys and confidence scores (0-1) as values. The top 3 emotions by score are used in the prompt.Example:
Response
The AI-generated response text from Gemini
The emotion data that was provided in the request, echoed back in the response
Example request
Example response
Error responses
Description of the error that occurred
Missing transcript (400)
Server configuration error (500)
Model configuration
The endpoint uses the following Gemini API parameters:Controls randomness in the response (0.0-1.0). Lower values make output more deterministic.
Limits the number of tokens considered at each step
Nucleus sampling parameter for controlling diversity
Maximum length of the generated response
Emotion processing
WhenemoData is provided:
- Emotions are sorted by score (highest to lowest)
- The top 3 emotions are selected
- Scores are converted to percentages with one decimal place
- Formatted as
emotion: score%and included in the prompt
Implementation details
The endpoint:- Validates that
transcriptis provided - Processes emotion data (if provided) to extract top 3 emotions
- Formats a prompt using the
GEMINI_PROMPTenvironment variable template - Sends the request to Gemini 2.0 Flash model
- Extracts and returns the generated text response
The endpoint requires
GEMINI_API_KEY and GEMINI_PROMPT environment variables to be configured.If
emoData is not provided, the endpoint will still process the transcript with an empty emotion context.