@nhtio/adk/batteries/llm/gemini_generate_content/types
Wire shapes, helper contracts, and option types for the native Gemini generateContent battery.
Remarks
Gemini's native surface differs from OpenAI Chat Completions in every structural respect, which is why pointing the openai_chat_completions battery at a Gemini-compatible gateway is not equivalent to speaking generateContent:
- Turns are
contents[], notmessages[], and the assistant role ismodel, notassistant. There is nosystemrole: system text goes in a separate top-levelsystemInstruction. - A turn's payload is
parts[]— a heterogeneous array. A tool call is afunctionCallpart on amodelturn; its result is afunctionResponsepart on auserturn. So the OpenAI-shaped "assistant with tool_calls, then a tool-role message" becomes "model turn with a functionCall part, then a user turn with a functionResponse part". functionResponse.namemust match the DECLARED tool name, not a call id. Gemini has notool_call_idconcept, so correlation is positional/by-name.- Gemini 3+ rejects a historical
functionCallpart that carries nothoughtSignature. Google documents two portable sentinels for replaying traces that did not originate from Gemini; see GeminiGenerateContentAdapterOptions.thoughtSignatureSentinel. - Generation settings live under
generationConfig(maxOutputTokens,temperature,topP,topK,stopSequences,thinkingConfig), and tools undertools[].functionDeclarations[].
Wire-shape-agnostic types (JsonSchema, the attribute envelopes, UnsupportedMediaPolicy, the bucket order, the retry config, the observability taps) come from the shared internal ../chat_common/types submodule and are re-exported so consumers of this battery get a self-contained type surface.
Interfaces
| Interface | Description |
|---|---|
| GeminiCandidate | One generation candidate. |
| GeminiContent | One conversation turn. |
| GeminiFunctionCall | A model-emitted request to invoke a declared function. |
| GeminiFunctionDeclaration | A tool Gemini may call, in its native declaration shape. |
| GeminiFunctionResponse | The result of a function invocation, sent back on a user turn. |
| GeminiGenerateContentAdapterOptions | Constructor and per-dispatch options. |
| GeminiGenerateContentHelpers | The injectable translation seam. |
| GeminiGenerateContentRequest | The complete :generateContent request body. |
| GeminiGenerateContentResponse | The :generateContent response body (also each SSE frame of :streamGenerateContent). |
| GeminiGenerationConfig | Sampling and output controls. |
| GeminiInlineData | Inline binary data (image/audio/etc.) as Gemini carries it. |
| GeminiPart | One element of a turn's parts[]. |
| GeminiRequestBuildInput | Everything buildGeminiRequest needs to assemble a request. |
| GeminiSafetySetting | One safety-filter setting. |
| GeminiThinkingConfig | Reasoning-budget controls. |
| GeminiTool | The tools[] entry wrapping function declarations. |
| GeminiToolConfig | Forces, permits, or forbids function calling. |
| GeminiUsageMetadata | Per-candidate token accounting. |
Type Aliases
| Type Alias | Description |
|---|---|
| GeminiRole | A conversation role on the generateContent wire. |
References
ChatCompletionsBucketLabel
Re-exports ChatCompletionsBucketLabel
ChatCompletionsBucketOrder
Re-exports ChatCompletionsBucketOrder
ChatCompletionsRetryConfig
Re-exports ChatCompletionsRetryConfig
ChatHelpersCommon
Re-exports ChatHelpersCommon
DescriptionLike
Re-exports DescriptionLike
JsonSchema
Re-exports JsonSchema
MemoryAttrs
Re-exports MemoryAttrs
PromptAssembledObserverFn
Re-exports PromptAssembledObserverFn
RawGenerationObserverFn
Re-exports RawGenerationObserverFn
RetrievableAttrs
Re-exports RetrievableAttrs
StandingInstructionAttrs
Re-exports StandingInstructionAttrs
ThoughtAttrs
Re-exports ThoughtAttrs
ToolCallParserFn
Re-exports ToolCallParserFn
ToolCallParserName
Re-exports ToolCallParserName
TrustedContentAttrs
Re-exports TrustedContentAttrs
UnsupportedMediaPolicy
Re-exports UnsupportedMediaPolicy
UntrustedContentAttrs
Re-exports UntrustedContentAttrs