I’m using the Gemini File Search API, but very often the model responds with an error or warning related to “recitation”, and the answer gets cut off or completely withheld.
I’m not entirely sure what recitation means in this context, but I assume the model is restricting the response due to copyright or content-reuse safeguards. This is confusing, because all the files in the file store are my own documents, and I explicitly want to query and summarize them.
What’s especially puzzling is that I’ve tried the exact same prompt multiple times, and it consistently results in a recitation issue, rather than being an occasional or random failure.
Additionally, the response metadata shows a significant token spend, seemingly enough for a full answer, yet the output is still stopped prematurely.
{
"candidates": [
{
"content": {},
"finishReason": "RECITATION"
}
],
"usageMetadata": {
"promptTokenCount": 24,
"totalTokenCount": 770,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 24
}
],
"toolUsePromptTokenCount": 162,
"toolUsePromptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 162
}
],
"thoughtsTokenCount": 584
},
"turnToken": "xyz"
}