Skip to content
3 min read · 627 words

@nhtio/adk/batteries/llm/gemini_generate_content

Native Gemini generateContent adapter battery with swappable translation helpers and wire types.

Remarks

Targets Google's NATIVE POST {baseURL}/models/{model}:generateContent surface — not an OpenAI-compatible façade in front of it. For that, point openai_chat_completions at the gateway's /v1.

The native surface differs from Chat Completions structurally, not cosmetically: turns are contents[] with role model (never assistant), there is no system role (system text goes to a top-level systemInstruction), a turn's payload is a heterogeneous parts[], a tool call is a functionCall part on a model turn whose result comes back as a functionResponse part on a user turn, correlation is by DECLARED TOOL NAME rather than a call id, and Gemini 3+ hard-rejects a historical functionCall that carries no thoughtSignature.

Speaking it natively matters whenever you need to reason about what the VENDOR received rather than what a translator sent on your behalf — an ordering guard, a wire-shape audit, a bug report against Google. See the validation battery's "Which API surface a rule applies to" guide.

Re-exports the adapter, every translation helper (with default* aliases), the option and wire types, the validation schema plus validateOptions, and the battery-scoped exceptions.

References

buildGeminiRequest

Re-exports buildGeminiRequest


ChatCompletionsBucketLabel

Re-exports ChatCompletionsBucketLabel


ChatCompletionsBucketOrder

Re-exports ChatCompletionsBucketOrder


ChatCompletionsRetryConfig

Re-exports ChatCompletionsRetryConfig


ChatHelpersCommon

Re-exports ChatHelpersCommon


DEFAULT_GEMINI_BUCKET_ORDER

Re-exports DEFAULT_GEMINI_BUCKET_ORDER


defaultBuildGeminiRequest

Re-exports defaultBuildGeminiRequest


defaultDescriptionToChatCompletionsJsonSchema

Re-exports defaultDescriptionToChatCompletionsJsonSchema


defaultExtractGeminiGeneration

Re-exports defaultExtractGeminiGeneration


defaultFilterThoughts

Re-exports defaultFilterThoughts


defaultMediaToGeminiInlineData

Re-exports defaultMediaToGeminiInlineData


defaultRenderArtifactHandleBody

Re-exports defaultRenderArtifactHandleBody


defaultRenderChatCompletionsSystemPrompt

Re-exports defaultRenderChatCompletionsSystemPrompt


defaultRenderFirstPartyRetrievables

Re-exports defaultRenderFirstPartyRetrievables


defaultRenderGeminiToolResult

Re-exports defaultRenderGeminiToolResult


defaultRenderMemories

Re-exports defaultRenderMemories


defaultRenderRetrievableHandleBody

Re-exports defaultRenderRetrievableHandleBody


defaultRenderRetrievables

Re-exports defaultRenderRetrievables


defaultRenderRetrievableSafetyDirective

Re-exports defaultRenderRetrievableSafetyDirective


defaultRenderStandingInstructions

Re-exports defaultRenderStandingInstructions


defaultRenderThirdPartyPrivateRetrievables

Re-exports defaultRenderThirdPartyPrivateRetrievables


defaultRenderThirdPartyPublicRetrievables

Re-exports defaultRenderThirdPartyPublicRetrievables


defaultRenderThought

Re-exports defaultRenderThought


defaultRenderTrustedContent

Re-exports defaultRenderTrustedContent


defaultRenderUntrustedContent

Re-exports defaultRenderUntrustedContent


defaultSanitizeGeminiSchema

Re-exports defaultSanitizeGeminiSchema


defaultToolsToGeminiTools

Re-exports defaultToolsToGeminiTools


DescriptionLike

Re-exports DescriptionLike


descriptionToChatCompletionsJsonSchema

Re-exports descriptionToChatCompletionsJsonSchema


E_GEMINI_INVALID_TOOL_CALL_ARGS

Re-exports E_GEMINI_INVALID_TOOL_CALL_ARGS


E_GEMINI_MISSING_THOUGHT_SIGNATURE

Re-exports E_GEMINI_MISSING_THOUGHT_SIGNATURE


E_GEMINI_REQUEST_FAILED

Re-exports E_GEMINI_REQUEST_FAILED


E_GEMINI_STREAM_ERROR

Re-exports E_GEMINI_STREAM_ERROR


E_INVALID_GEMINI_GENERATE_CONTENT_OPTIONS

Re-exports E_INVALID_GEMINI_GENERATE_CONTENT_OPTIONS


extractGeminiGeneration

Re-exports extractGeminiGeneration


filterThoughts

Re-exports filterThoughts


GeminiCandidate

Re-exports GeminiCandidate


GeminiContent

Re-exports GeminiContent


GeminiFunctionCall

Re-exports GeminiFunctionCall


GeminiFunctionDeclaration

Re-exports GeminiFunctionDeclaration


GeminiFunctionResponse

Re-exports GeminiFunctionResponse


GeminiGenerateContentAdapter

Re-exports GeminiGenerateContentAdapter


GeminiGenerateContentAdapterOptions

Re-exports GeminiGenerateContentAdapterOptions


GeminiGenerateContentHelpers

Re-exports GeminiGenerateContentHelpers


geminiGenerateContentOptionsSchema

Re-exports geminiGenerateContentOptionsSchema


GeminiGenerateContentRequest

Re-exports GeminiGenerateContentRequest


GeminiGenerateContentResponse

Re-exports GeminiGenerateContentResponse


GeminiGenerationConfig

Re-exports GeminiGenerationConfig


GeminiInlineData

Re-exports GeminiInlineData


GeminiPart

Re-exports GeminiPart


GeminiRequestBuildInput

Re-exports GeminiRequestBuildInput


GeminiRole

Re-exports GeminiRole


GeminiSafetySetting

Re-exports GeminiSafetySetting


GeminiThinkingConfig

Re-exports GeminiThinkingConfig


GeminiTool

Re-exports GeminiTool


GeminiToolConfig

Re-exports GeminiToolConfig


GeminiUsageMetadata

Re-exports GeminiUsageMetadata


JsonSchema

Re-exports JsonSchema


mediaToGeminiInlineData

Re-exports mediaToGeminiInlineData


MemoryAttrs

Re-exports MemoryAttrs


PromptAssembledObserverFn

Re-exports PromptAssembledObserverFn


RawGenerationObserverFn

Re-exports RawGenerationObserverFn


renderArtifactHandleBody

Re-exports renderArtifactHandleBody


renderChatCompletionsSystemPrompt

Re-exports renderChatCompletionsSystemPrompt


renderFirstPartyRetrievables

Re-exports renderFirstPartyRetrievables


renderGeminiToolResult

Re-exports renderGeminiToolResult


renderMemories

Re-exports renderMemories


renderRetrievableHandleBody

Re-exports renderRetrievableHandleBody


renderRetrievables

Re-exports renderRetrievables


renderRetrievableSafetyDirective

Re-exports renderRetrievableSafetyDirective


renderStandingInstructions

Re-exports renderStandingInstructions


renderThirdPartyPrivateRetrievables

Re-exports renderThirdPartyPrivateRetrievables


renderThirdPartyPublicRetrievables

Re-exports renderThirdPartyPublicRetrievables


renderThought

Re-exports renderThought


renderTrustedContent

Re-exports renderTrustedContent


renderUntrustedContent

Re-exports renderUntrustedContent


RetrievableAttrs

Re-exports RetrievableAttrs


sanitizeGeminiSchema

Re-exports sanitizeGeminiSchema


StandingInstructionAttrs

Re-exports StandingInstructionAttrs


ThoughtAttrs

Re-exports ThoughtAttrs


ToolCallParserFn

Re-exports ToolCallParserFn


ToolCallParserName

Re-exports ToolCallParserName


toolsToGeminiTools

Re-exports toolsToGeminiTools


TrustedContentAttrs

Re-exports TrustedContentAttrs


UnsupportedMediaPolicy

Re-exports UnsupportedMediaPolicy


UntrustedContentAttrs

Re-exports UntrustedContentAttrs


validateOptions

Re-exports validateOptions