Skip to content

Commit

Permalink
Gemini: call out RECITATIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Apr 3, 2024
1 parent 21ed38a commit 79d0c96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/llms/server/llm.server.streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ function createStreamParserGemini(modelName: string): AIStreamParser {
if (!singleCandidate.content) {
if (singleCandidate.finishReason === 'MAX_TOKENS')
return { text: ` ${USER_SYMBOL_MAX_TOKENS}`, close: true };
throw new Error('server response missing content');
if (singleCandidate.finishReason === 'RECITATION')
throw new Error('generation stopped due to RECITATION');
throw new Error(`server response missing content (finishReason: ${singleCandidate?.finishReason})`);
}

// expect a single part
Expand Down

0 comments on commit 79d0c96

Please sign in to comment.