import { z } from 'genkit'; import { FunctionDeclaration } from './types.mjs'; /** * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A tool that can be used by the model. * See {@link https://ai.google.dev/gemini-api/docs/function-calling} */ declare interface InteractionFunctionTool extends FunctionDeclaration { type: 'function'; } /** * A tool that can be used by the model to search Google. * See {@link https://ai.google.dev/gemini-api/docs/grounding} */ declare interface InteractionGoogleSearchTool { type: 'google_search'; /** Unknown search types are passed through for forward compatibility. */ search_types?: ('web_search' | 'image_search' | 'enterprise_web_search' | (string & {}))[]; } /** * A tool that can be used by the model to execute code. * See {@link https://ai.google.dev/gemini-api/docs/code-execution} */ declare interface InteractionCodeExecutionTool { type: 'code_execution'; } /** * A tool that can be used by the model to read and summarize web page content. */ declare interface InteractionUrlContextTool { type: 'url_context'; } /** * A tool that can be used by the model to search uploaded document corpora. */ declare interface InteractionFileSearchTool { type: 'file_search'; file_search_store_names?: string[]; metadata_filter?: string; top_k?: number; } declare interface InteractionAllowedTools { mode?: string; tools?: string[]; } declare interface InteractionToolChoiceConfig { allowed_tools?: InteractionAllowedTools; } /** * A tool that can be used by the model to connect to remote MCP servers. */ declare interface InteractionMcpServerTool { type: 'mcp_server'; name?: string; url?: string; headers?: Record; allowed_tools?: InteractionAllowedTools[]; } declare interface InteractionGoogleMapsTool { type: 'google_maps'; enable_widget?: boolean; latitude?: number; longitude?: number; } declare interface InteractionComputerUseTool { type: 'computer_use'; disabled_safety_policies?: string[]; enable_prompt_injection_detection?: boolean; environment?: string; excluded_predefined_functions?: string[]; } declare interface InteractionRetrievalTool { type: 'retrieval'; exa_ai_search_config?: Record; parallel_ai_search_config?: Record; rag_store_config?: Record; retrieval_types?: string[]; vertex_ai_search_config?: Record; } declare interface InteractionDynamicTool { type: string; [key: string]: unknown; } /** * A tool that can be used by the model. */ declare type InteractionTool = InteractionFunctionTool | InteractionGoogleSearchTool | InteractionCodeExecutionTool | InteractionUrlContextTool | InteractionFileSearchTool | InteractionMcpServerTool | InteractionGoogleMapsTool | InteractionComputerUseTool | InteractionRetrievalTool | InteractionDynamicTool; /** A URL citation annotation. */ declare const UrlCitationSchema: z.ZodObject<{ /** The URL. */ url: z.ZodOptional; /** The title of the URL. */ title: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"url_citation">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The URL. */ url: z.ZodOptional; /** The title of the URL. */ title: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"url_citation">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The URL. */ url: z.ZodOptional; /** The title of the URL. */ title: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"url_citation">; }, z.ZodTypeAny, "passthrough">>; type UrlCitation = z.infer; /** A file citation annotation. */ declare const FileCitationSchema: z.ZodObject<{ /** The URI of the file. */ document_uri: z.ZodOptional; /** The name of the file. */ file_name: z.ZodOptional; /** Source attributed for a portion of the text. */ source: z.ZodOptional; /** Page number of the cited document, if applicable. */ page_number: z.ZodOptional; /** Media ID in case of image citations, if applicable. */ media_id: z.ZodOptional; /** User-provided metadata about the retrieved context. */ custom_metadata: z.ZodOptional>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"file_citation">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The URI of the file. */ document_uri: z.ZodOptional; /** The name of the file. */ file_name: z.ZodOptional; /** Source attributed for a portion of the text. */ source: z.ZodOptional; /** Page number of the cited document, if applicable. */ page_number: z.ZodOptional; /** Media ID in case of image citations, if applicable. */ media_id: z.ZodOptional; /** User-provided metadata about the retrieved context. */ custom_metadata: z.ZodOptional>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"file_citation">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The URI of the file. */ document_uri: z.ZodOptional; /** The name of the file. */ file_name: z.ZodOptional; /** Source attributed for a portion of the text. */ source: z.ZodOptional; /** Page number of the cited document, if applicable. */ page_number: z.ZodOptional; /** Media ID in case of image citations, if applicable. */ media_id: z.ZodOptional; /** User-provided metadata about the retrieved context. */ custom_metadata: z.ZodOptional>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"file_citation">; }, z.ZodTypeAny, "passthrough">>; type FileCitation = z.infer; /** A place (Google Maps) citation annotation. */ declare const PlaceCitationSchema: z.ZodObject<{ /** Title of the place. */ name: z.ZodOptional; /** The ID of the place, in `places/{place_id}` format. */ place_id: z.ZodOptional; /** URI reference of the place. */ url: z.ZodOptional; /** Review snippets about features of the place. */ review_snippets: z.ZodOptional; title: z.ZodOptional; url: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }>, "many">>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"place_citation">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** Title of the place. */ name: z.ZodOptional; /** The ID of the place, in `places/{place_id}` format. */ place_id: z.ZodOptional; /** URI reference of the place. */ url: z.ZodOptional; /** Review snippets about features of the place. */ review_snippets: z.ZodOptional; title: z.ZodOptional; url: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }>, "many">>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"place_citation">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** Title of the place. */ name: z.ZodOptional; /** The ID of the place, in `places/{place_id}` format. */ place_id: z.ZodOptional; /** URI reference of the place. */ url: z.ZodOptional; /** Review snippets about features of the place. */ review_snippets: z.ZodOptional; title: z.ZodOptional; url: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }>, "many">>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"place_citation">; }, z.ZodTypeAny, "passthrough">>; type PlaceCitation = z.infer; /** * Speech annotation for text content. Used as input to TTS models to assign a * turn to a speaker and set its delivery style. */ declare const SpeechAnnotationSchema: z.ZodObject<{ /** The speaker to associate with this turn. */ speaker: z.ZodOptional; /** Style instruction for the speech synthesis. */ style: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"speech_metadata">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The speaker to associate with this turn. */ speaker: z.ZodOptional; /** Style instruction for the speech synthesis. */ style: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"speech_metadata">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The speaker to associate with this turn. */ speaker: z.ZodOptional; /** Style instruction for the speech synthesis. */ style: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"speech_metadata">; }, z.ZodTypeAny, "passthrough">>; type SpeechAnnotation = z.infer; /** Word-level speech recognition annotation for transcription output. */ declare const WordInfoSchema: z.ZodObject<{ /** The transcribed word. */ text: z.ZodOptional; /** Start offset in time of the word relative to the start of the audio. */ start_offset: z.ZodOptional; /** End offset in time of the word relative to the start of the audio. */ end_offset: z.ZodOptional; /** Speaker label for this word (e.g. "spk_1"). */ speaker: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"word_info">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The transcribed word. */ text: z.ZodOptional; /** Start offset in time of the word relative to the start of the audio. */ start_offset: z.ZodOptional; /** End offset in time of the word relative to the start of the audio. */ end_offset: z.ZodOptional; /** Speaker label for this word (e.g. "spk_1"). */ speaker: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"word_info">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The transcribed word. */ text: z.ZodOptional; /** Start offset in time of the word relative to the start of the audio. */ start_offset: z.ZodOptional; /** End offset in time of the word relative to the start of the audio. */ end_offset: z.ZodOptional; /** Speaker label for this word (e.g. "spk_1"). */ speaker: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"word_info">; }, z.ZodTypeAny, "passthrough">>; type WordInfo = z.infer; /** An annotation on text content, discriminated by `type`. */ declare const TextAnnotationSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{ /** The URL. */ url: z.ZodOptional; /** The title of the URL. */ title: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"url_citation">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The URL. */ url: z.ZodOptional; /** The title of the URL. */ title: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"url_citation">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The URL. */ url: z.ZodOptional; /** The title of the URL. */ title: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"url_citation">; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ /** The URI of the file. */ document_uri: z.ZodOptional; /** The name of the file. */ file_name: z.ZodOptional; /** Source attributed for a portion of the text. */ source: z.ZodOptional; /** Page number of the cited document, if applicable. */ page_number: z.ZodOptional; /** Media ID in case of image citations, if applicable. */ media_id: z.ZodOptional; /** User-provided metadata about the retrieved context. */ custom_metadata: z.ZodOptional>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"file_citation">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The URI of the file. */ document_uri: z.ZodOptional; /** The name of the file. */ file_name: z.ZodOptional; /** Source attributed for a portion of the text. */ source: z.ZodOptional; /** Page number of the cited document, if applicable. */ page_number: z.ZodOptional; /** Media ID in case of image citations, if applicable. */ media_id: z.ZodOptional; /** User-provided metadata about the retrieved context. */ custom_metadata: z.ZodOptional>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"file_citation">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The URI of the file. */ document_uri: z.ZodOptional; /** The name of the file. */ file_name: z.ZodOptional; /** Source attributed for a portion of the text. */ source: z.ZodOptional; /** Page number of the cited document, if applicable. */ page_number: z.ZodOptional; /** Media ID in case of image citations, if applicable. */ media_id: z.ZodOptional; /** User-provided metadata about the retrieved context. */ custom_metadata: z.ZodOptional>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"file_citation">; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ /** Title of the place. */ name: z.ZodOptional; /** The ID of the place, in `places/{place_id}` format. */ place_id: z.ZodOptional; /** URI reference of the place. */ url: z.ZodOptional; /** Review snippets about features of the place. */ review_snippets: z.ZodOptional; title: z.ZodOptional; url: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }>, "many">>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"place_citation">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** Title of the place. */ name: z.ZodOptional; /** The ID of the place, in `places/{place_id}` format. */ place_id: z.ZodOptional; /** URI reference of the place. */ url: z.ZodOptional; /** Review snippets about features of the place. */ review_snippets: z.ZodOptional; title: z.ZodOptional; url: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }>, "many">>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"place_citation">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** Title of the place. */ name: z.ZodOptional; /** The ID of the place, in `places/{place_id}` format. */ place_id: z.ZodOptional; /** URI reference of the place. */ url: z.ZodOptional; /** Review snippets about features of the place. */ review_snippets: z.ZodOptional; title: z.ZodOptional; url: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }, { url?: string | undefined; title?: string | undefined; review_id?: string | undefined; }>, "many">>; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"place_citation">; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ /** The speaker to associate with this turn. */ speaker: z.ZodOptional; /** Style instruction for the speech synthesis. */ style: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"speech_metadata">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The speaker to associate with this turn. */ speaker: z.ZodOptional; /** Style instruction for the speech synthesis. */ style: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"speech_metadata">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The speaker to associate with this turn. */ speaker: z.ZodOptional; /** Style instruction for the speech synthesis. */ style: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"speech_metadata">; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ /** The transcribed word. */ text: z.ZodOptional; /** Start offset in time of the word relative to the start of the audio. */ start_offset: z.ZodOptional; /** End offset in time of the word relative to the start of the audio. */ end_offset: z.ZodOptional; /** Speaker label for this word (e.g. "spk_1"). */ speaker: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"word_info">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ /** The transcribed word. */ text: z.ZodOptional; /** Start offset in time of the word relative to the start of the audio. */ start_offset: z.ZodOptional; /** End offset in time of the word relative to the start of the audio. */ end_offset: z.ZodOptional; /** Speaker label for this word (e.g. "spk_1"). */ speaker: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"word_info">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ /** The transcribed word. */ text: z.ZodOptional; /** Start offset in time of the word relative to the start of the audio. */ start_offset: z.ZodOptional; /** End offset in time of the word relative to the start of the audio. */ end_offset: z.ZodOptional; /** Speaker label for this word (e.g. "spk_1"). */ speaker: z.ZodOptional; /** Start of the annotated segment (in bytes). */ start_index: z.ZodOptional; /** End of the annotated segment, exclusive. */ end_index: z.ZodOptional; type: z.ZodLiteral<"word_info">; }, z.ZodTypeAny, "passthrough">>]>; type TextAnnotation = z.infer; /** * A text content block. */ declare interface TextContent { type: 'text'; /** The text content. */ text?: string; /** * Annotations on the text: citations on model output, or speech metadata on * TTS input. */ annotations?: TextAnnotation[]; } /** * The resolution of the media. */ declare type MediaResolution = 'low' | 'medium' | 'high' | 'ultra_high'; /** * An image content block. */ declare interface ImageContent { type: 'image'; /** The image content. */ data?: string; /** The URI of the image. */ uri?: string; /** The mime type of the image. */ mime_type?: string; /** The resolution of the media. */ resolution?: MediaResolution; } /** * An audio content block. */ declare interface AudioContent { type: 'audio'; /** The audio content. */ data?: string; /** The URI of the audio. */ uri?: string; /** The mime type of the audio. */ mime_type?: string; } /** * A document content block. */ declare interface DocumentContent { type: 'document'; /** The document content. */ data?: string; /** The URI of the document. */ uri?: string; /** The mime type of the document. */ mime_type?: string; } /** * A video content block. */ declare interface VideoContent { type: 'video'; /** The video content. */ data?: string; /** The URI of the video. */ uri?: string; /** The mime type of the video. */ mime_type?: string; /** The resolution of the media. */ resolution?: MediaResolution; /** * How the model reads the video: `static` (frames at 1 FPS, the default) * or `agentic` (the model explores the timeline and loads only what it * needs; supported by newer models). */ processing?: VideoProcessing; } /** How the model reads a video input. */ type VideoProcessing = 'static' | 'agentic' | (string & {}); /** * A thought content block. */ declare interface ThoughtContent { type: 'thought'; /** Signature to match the backend source to be part of the generation. */ signature?: string; /** A summary of the thought. */ summary?: (TextContent | ImageContent)[]; } /** * A function tool call content block. */ declare interface FunctionCallContent { type: 'function_call'; /** The name of the tool to call. */ name: string; /** The arguments to pass to the function. */ arguments?: Record; /** A unique ID for this specific tool call. */ id: string; } /** * A function tool result content block. */ declare interface FunctionResultContent { type: 'function_result'; /** The name of the tool that was called. */ name: string; /** Whether the tool call resulted in an error. */ is_error?: boolean; /** The result of the tool call. */ result?: Record | string; /** ID to match the ID from the function call block. */ call_id: string; } /** * The content of the response. */ type Content = TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent; declare interface ModelOutputStep { type: 'model_output'; content: Content[]; } declare interface UserInputStep { type: 'user_input'; content: Content[]; } declare interface GoogleSearchCallStep { type: 'google_search_call'; id: string; arguments: { queries: string[]; }; signature?: string; } declare interface GoogleSearchResultStep { type: 'google_search_result'; call_id: string; /** The search results, e.g. `[{ search_suggestions }]`. */ result: Record[] | Record; is_error?: boolean; signature?: string; } declare interface CodeExecutionCallStep { type: 'code_execution_call'; id: string; arguments: { code: string; language?: string; [key: string]: unknown; }; signature?: string; } declare interface CodeExecutionResultStep { type: 'code_execution_result'; call_id: string; result: Record | string; signature?: string; } declare interface FunctionCallStep { type: 'function_call'; name: string; arguments?: Record; id: string; signature?: string; } declare interface FunctionResultStep { type: 'function_result'; name?: string; call_id: string; is_error?: boolean; result: Record | string | (ImageContent | TextContent)[]; signature?: string; } declare interface ThoughtStep { type: 'thought'; signature?: string; summary?: (TextContent | ImageContent)[]; } /** * Agentic video understanding: the model asked to load part of a video (a * segment, frames or the transcript). Needs no reply. */ declare interface ProcessingCallStep { type: 'processing_call'; id: string; signature?: string; } /** Agentic video understanding: the result of a `processing_call`. */ declare interface ProcessingResultStep { type: 'processing_result'; call_id: string; signature?: string; } type Step = ModelOutputStep | UserInputStep | Content | GoogleSearchCallStep | GoogleSearchResultStep | CodeExecutionCallStep | CodeExecutionResultStep | FunctionCallStep | FunctionResultStep | ThoughtStep | ProcessingCallStep | ProcessingResultStep; /** * A turn in a conversation. */ declare interface Turn { /** The originator of this turn. Must be user for input or model for model output. */ role: string; /** The content of the turn. */ content: string | Content[]; } /** * The token count for a single response modality. */ declare interface ModalityTokens { /** The modality associated with the token count. */ modality?: ResponseModality; /** Number of tokens for the modality. */ tokens?: number; } /** * Statistics on the interaction request's token usage. */ declare interface Usage { /** Number of tokens in the prompt (context). */ total_input_tokens?: number; /** A breakdown of input token usage by modality. */ input_tokens_by_modality?: ModalityTokens[]; /** Number of tokens in the cached part of the prompt (the cached content). */ total_cached_tokens?: number; /** A breakdown of cached token usage by modality. */ cached_tokens_by_modality?: ModalityTokens[]; /** Total number of tokens across all the generated responses. */ total_output_tokens?: number; /** A breakdown of output token usage by modality. */ output_tokens_by_modality?: ModalityTokens[]; /** Number of tokens present in tool-use prompt(s). */ total_tool_use_tokens?: number; /** A breakdown of tool-use token usage by modality. */ tool_use_by_modality?: ModalityTokens[]; /** Number of tokens of thoughts for thinking models. */ total_thought_tokens?: number; /** Total token count for the interaction request (prompt + responses + other internal tokens). */ total_tokens?: number; } /** * The configuration for speech interaction. */ declare interface SpeechConfig { /** The voice of the speaker. */ voice?: string; /** The language of the speech. */ language?: string; /** The speaker's name, it should match the speaker name given in the prompt. */ speaker?: string; } /** * The configuration for image interaction. */ declare interface ImageConfig { /** The aspect ratio of the image. */ aspect_ratio?: string; /** The size of the image. */ image_size?: string; } /** * The configuration for video generation (e.g. gemini-omni-1.1-flash). */ declare interface VideoConfig { /** The kind of generation. Inferred from the prompt if not set. */ task?: 'text_to_video' | 'image_to_video' | 'reference_to_video' | 'edit' | 'extend' | (string & {}); } /** * Configuration parameters for model interactions. */ declare interface ModelGenerationConfig { /** Controls the randomness of the output. */ temperature?: number; /** The maximum cumulative probability of tokens to consider when sampling. */ top_p?: number; /** Seed used in decoding for reproducibility. */ seed?: number; /** A list of character sequences that will stop output interaction. */ stop_sequences?: string[]; /** The tool choice for the interaction. */ tool_choice?: string | InteractionToolChoiceConfig; /** The level of thought tokens that the model should generate. */ thinking_level?: 'minimal' | 'low' | 'medium' | 'high'; /** Whether to include thought summaries in the response. */ thinking_summaries?: 'auto' | 'none'; /** The maximum number of tokens to include in the response. */ max_output_tokens?: number; /** * Speech configuration: an array for a single speaker, or * `{ speakers: [...] }` for multi-speaker. */ speech_config?: SpeechConfig[] | { speakers: SpeechConfig[]; }; /** Configuration for image interaction. */ image_config?: ImageConfig; /** Configuration for video generation. */ video_config?: VideoConfig; } /** * Configuration for dynamic agents. */ declare interface DynamicAgentConfig { type: 'dynamic'; } /** * Configuration for the Deep Research agent. */ declare interface DeepResearchAgentConfig { type: 'deep-research'; /** Whether to include thought summaries in the response. */ thinking_summaries?: 'auto' | 'none'; /** Visualization allows the agent to generate charts and graphs to support its findings. */ visualization?: 'auto' | 'off'; /** Collaborative planning allows you to review and refine the research plan before execution. */ collaborative_planning?: boolean; } /** * Configuration for the Antigravity agent. */ declare interface AntigravityAgentConfig { type: 'antigravity'; /** The Gemini model the agent runs on (defaults to the agent's default). */ model?: string; } /** * Service Tier */ declare type ServiceTier = 'flex' | 'standard' | 'priority' | (string & {}); /** * Configuration for the agent. */ type InteractionsAgentConfig = DynamicAgentConfig | DeepResearchAgentConfig | AntigravityAgentConfig; /** * Indicates the model should return text, images, or audio. */ declare type ResponseModality = 'text' | 'image' | 'audio' | (string & {}); /** * A safety setting: the threshold for blocking one harm category. * vertexAI only (googleAI rejects `safety_settings` with a 400). */ declare interface InteractionSafetySetting { /** The harm category, e.g. `hate_speech`. */ type: 'hate_speech' | 'dangerous_content' | 'harassment' | 'sexually_explicit' | (string & {}); /** The blocking threshold, e.g. `block_low_and_above`. */ threshold: 'block_low_and_above' | 'block_medium_and_above' | 'block_only_high' | 'block_none' | 'off' | (string & {}); /** Whether to block by probability (default) or by severity. */ method?: 'probability' | 'severity' | (string & {}); } /** * Parameters for creating interactions. */ declare interface CreateInteractionRequest { /** The ID of the previous interaction, if any. */ previous_interaction_id?: string; /** The model to use for this request (mutually exclusive with agent) */ model?: string; /** The agent to use for this request (mutually exclusive with model) */ agent?: string; /** The environment configuration for the sandbox. */ environment?: string | Record; /** The inputs for the interaction. */ input: string | Step[] | Step; /** System instruction for the interaction. */ system_instruction?: string; /** A list of tool declarations the model may call during interaction. */ tools?: InteractionTool[]; /** Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field */ response_format?: Record | Record[]; /** The requested modalities of the response (TEXT, IMAGE, AUDIO). */ response_modalities?: ResponseModality[]; /** Whether the interaction will be streamed. */ stream?: boolean; /** Whether to store the response and request for later retrieval. */ store?: boolean; /** Whether to run the model interaction in the background. */ background?: boolean; /** Configuration parameters for the model interaction. */ generation_config?: ModelGenerationConfig; /** Configuration for the agent. */ agent_config?: InteractionsAgentConfig; /** */ service_tier?: ServiceTier; /** Safety settings. vertexAI only (googleAI rejects it with a 400). */ safety_settings?: InteractionSafetySetting[]; /** * Key-value labels for billing and cost tracking. vertexAI only (accepted * there, though not in its published spec; checked live Oct 2026). */ labels?: Record; } interface TextDelta { type: 'text'; text: string; } interface ImageDelta { type: 'image'; data?: string; uri?: string; mime_type?: string; resolution?: MediaResolution; } interface AudioDelta { type: 'audio'; data?: string; uri?: string; mime_type?: string; sample_rate?: number; channels?: number; } interface DocumentDelta { type: 'document'; data?: string; uri?: string; mime_type?: string; } interface VideoDelta { type: 'video'; data?: string; uri?: string; mime_type?: string; resolution?: MediaResolution; } interface ThoughtSummaryDelta { type: 'thought_summary'; content?: Content; } interface ThoughtSignatureDelta { type: 'thought_signature'; signature?: string; } interface FunctionCallDelta { type: 'function_call'; name: string; arguments: Record; id: string; } interface ArgumentsDelta { type: 'arguments_delta'; arguments?: string; } interface CodeExecutionCallDelta { type: 'code_execution_call'; arguments: { code?: string; language?: string; [key: string]: unknown; }; signature?: string; } interface UrlContextCallDelta { type: 'url_context_call'; arguments: { urls?: string[]; }; signature?: string; } interface GoogleSearchCallDelta { type: 'google_search_call'; arguments: { queries?: string[]; }; signature?: string; } interface McpServerToolCallDelta { type: 'mcp_server_tool_call'; name: string; server_name: string; arguments: Record; } interface FileSearchCallDelta { type: 'file_search_call'; signature?: string; } interface GoogleMapsCallDelta { type: 'google_maps_call'; arguments?: { queries?: string[]; }; signature?: string; } interface FunctionResultDelta { type: 'function_result'; name?: string; call_id: string; is_error?: boolean; result: Record | string | (ImageContent | TextContent)[]; } interface CodeExecutionResultDelta { type: 'code_execution_result'; result: string; is_error?: boolean; signature?: string; } interface UrlContextResultDelta { type: 'url_context_result'; result: Record[]; is_error?: boolean; signature?: string; } interface GoogleSearchResultDelta { type: 'google_search_result'; result: Record[]; is_error?: boolean; signature?: string; } interface McpServerToolResultDelta { type: 'mcp_server_tool_result'; name?: string; server_name?: string; result: Record | string | (ImageContent | TextContent)[]; } interface FileSearchResultDelta { type: 'file_search_result'; result: Record[]; signature?: string; } interface GoogleMapsResultDelta { type: 'google_maps_result'; result?: Record[]; signature?: string; } interface TextAnnotationDelta { type: 'text_annotation_delta'; annotations?: TextAnnotation[]; } type StepDeltaData = TextDelta | ImageDelta | AudioDelta | DocumentDelta | VideoDelta | ThoughtSummaryDelta | ThoughtSignatureDelta | FunctionCallDelta | ArgumentsDelta | CodeExecutionCallDelta | UrlContextCallDelta | GoogleSearchCallDelta | McpServerToolCallDelta | FileSearchCallDelta | GoogleMapsCallDelta | FunctionResultDelta | CodeExecutionResultDelta | UrlContextResultDelta | GoogleSearchResultDelta | McpServerToolResultDelta | FileSearchResultDelta | GoogleMapsResultDelta | TextAnnotationDelta; type InteractionSseEvent = { event_type: 'interaction.created'; interaction: Partial; event_id?: string; } | { event_type: 'interaction.completed'; interaction: Partial; event_id?: string; } | { event_type: 'interaction.status_update'; /** Only present when the interaction is stored (`store: true`). */ interaction_id?: string; status: GeminiInteraction['status']; event_id?: string; } | { event_type: 'error'; error: { code: string; message: string; }; event_id?: string; } | { event_type: 'step.start'; index: number; step: Step; event_id?: string; } | { event_type: 'step.delta'; index: number; delta: StepDeltaData; event_id?: string; } | { event_type: 'step.stop'; index: number; event_id?: string; }; interface InteractionStreamResult { stream: AsyncGenerator; response: Promise; } declare interface GeminiInteraction { /** The name of the Model used for generating the interaction. */ model?: string; /** The name of the Agent used for generating the interaction. */ agent?: string; /** The environment ID for the sandbox, if used. */ environment_id?: string; /** The unique identifier for the interaction completion. */ id?: string; /** The ID of the previous interaction, if any. */ previous_interaction_id?: string; /** The status of the interaction. */ status?: 'in_progress' | 'queued' | 'requires_action' | 'completed' | 'incomplete' | 'failed' | 'cancelled'; /** The time at which the response was created in ISO 8601 format. */ created?: string; /** The time at which the response was last updated in ISO 8601 format. */ updated?: string; /** The role of the interaction. */ role?: string; /** Steps comprising the interaction timeline. */ steps?: Step[]; /** Statistics on the interaction request's token usage. */ usage?: Usage; /** * Output only. Errors recorded on the interaction. Populated when `status` * is `failed` (e.g. a safety block or an unrecoverable tool-call error). */ errors?: InteractionError[]; } /** An error recorded on an interaction or sent in an SSE `error` event. */ declare interface InteractionError { /** Error code, e.g. `safety` or `malformed_function_call`. */ code?: string; /** Human-readable error message. */ message?: string; } export { type AntigravityAgentConfig, type ArgumentsDelta, type AudioContent, type AudioDelta, type CodeExecutionCallDelta, type CodeExecutionCallStep, type CodeExecutionResultDelta, type CodeExecutionResultStep, type Content, type CreateInteractionRequest, type DeepResearchAgentConfig, type DocumentContent, type DocumentDelta, type DynamicAgentConfig, type FileCitation, FileCitationSchema, type FileSearchCallDelta, type FileSearchResultDelta, type FunctionCallContent, type FunctionCallDelta, type FunctionCallStep, type FunctionResultContent, type FunctionResultDelta, type FunctionResultStep, type GeminiInteraction, type GoogleMapsCallDelta, type GoogleMapsResultDelta, type GoogleSearchCallDelta, type GoogleSearchCallStep, type GoogleSearchResultDelta, type GoogleSearchResultStep, type ImageConfig, type ImageContent, type ImageDelta, type InteractionAllowedTools, type InteractionCodeExecutionTool, type InteractionComputerUseTool, type InteractionDynamicTool, type InteractionError, type InteractionFileSearchTool, type InteractionFunctionTool, type InteractionGoogleMapsTool, type InteractionGoogleSearchTool, type InteractionMcpServerTool, type InteractionRetrievalTool, type InteractionSafetySetting, type InteractionSseEvent, type InteractionStreamResult, type InteractionTool, type InteractionToolChoiceConfig, type InteractionUrlContextTool, type InteractionsAgentConfig, type McpServerToolCallDelta, type McpServerToolResultDelta, type MediaResolution, type ModalityTokens, type ModelGenerationConfig, type ModelOutputStep, type PlaceCitation, PlaceCitationSchema, type ProcessingCallStep, type ProcessingResultStep, type ResponseModality, type ServiceTier, type SpeechAnnotation, SpeechAnnotationSchema, type SpeechConfig, type Step, type StepDeltaData, type TextAnnotation, type TextAnnotationDelta, TextAnnotationSchema, type TextContent, type TextDelta, type ThoughtContent, type ThoughtSignatureDelta, type ThoughtStep, type ThoughtSummaryDelta, type Turn, type UrlCitation, UrlCitationSchema, type UrlContextCallDelta, type UrlContextResultDelta, type Usage, type UserInputStep, type VideoConfig, type VideoContent, type VideoDelta, type VideoProcessing, type WordInfo, WordInfoSchema };