Skip to content

Commit 5b29174

Browse files
committed
Add back logic to store parsed Gemini output in model response
This was accidentally removed in commit aa48ca4 and was preventing agent responses from being properly parsed (in particular, agent participant responses from being correctly parsed into stage answers).
1 parent 7d89fe9 commit 5b29174

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

functions/src/api/gemini.api.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
StructuredOutputSchema,
1616
ModelResponseStatus,
1717
ModelResponse,
18+
addParsedModelResponse,
1819
} from '@deliberation-lab/utils';
1920

2021
const GEMINI_DEFAULT_MODEL = 'gemini-2.5-flash';
@@ -164,6 +165,7 @@ export async function callGemini(
164165
prompt: string | Array<{role: string; content: string; name?: string}>,
165166
generationConfig: GenerationConfig,
166167
modelName = GEMINI_DEFAULT_MODEL,
168+
parseResponse = false, // parse if structured output
167169
safetySettings?: SafetySetting[],
168170
): Promise<ModelResponse> {
169171
const genAI = new GoogleGenAI({apiKey});
@@ -253,6 +255,10 @@ export async function callGemini(
253255
imageDataList: imageDataList.length > 0 ? imageDataList : undefined,
254256
};
255257

258+
if (parseResponse) {
259+
return addParsedModelResponse(modelResponse);
260+
}
261+
256262
return modelResponse;
257263
}
258264

@@ -318,6 +324,7 @@ export async function getGeminiAPIResponse(
318324
promptText,
319325
geminiConfig,
320326
modelName,
327+
structuredOutputConfig?.enabled,
321328
safetySettings,
322329
);
323330
// eslint-disable-next-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)