Function: buildGeminiRequest()
ts
function buildGeminiRequest(
input: GeminiRequestBuildInput,
): Promise<GeminiGenerateContentRequest>;Defined in: src/batteries/llm/gemini_generate_content/helpers.ts:257
Assemble the native request from ADK turn state. THE ordering seam.
Parameters
| Parameter | Type |
|---|---|
input | GeminiRequestBuildInput |
Returns
Promise<GeminiGenerateContentRequest>
Remarks
The translation that makes this battery different from pointing openai_chat_completions at a Gemini gateway:
- System text goes to
systemInstruction, not acontents[]turn. Message.role: 'assistant'becomesrole: 'model'.- A
ToolCallbecomes TWO turns: amodelturn with afunctionCallpart, then auserturn with afunctionResponsepart.functionResponse.namecarries the DECLARED tool name, because Gemini has no call-id correlation. - Timeline order is
createdAt, matching the ordering guard's own view, so what the guard validates is what gets dispatched. - The thought-signature sentinel is stamped on the FIRST
functionCallonly when no part already carries a real signature and the caller has not opted out. Preserving a genuine signature matters: it is prefix-bound, and replacing one invalidates it.