interface InteractionsApiHandlerParamsThe name of the agent to use for the interaction (mutually exclusive with model in the raw API,
or used when invoking an agent endpoint).
Configuration parameters for the specified agent.
Whether to execute the interaction in the background (primarily for agents).
Custom / additional headers to include with every request to the API. When set on both constructor params and per-invocation call options, per-invocation headers take precidence for matching keys.
OpenAI-compatible alias for media input detail level.
This is mapped to generationConfig.mediaResolution:
"auto" => default Gemini behavior (mediaResolution omitted)"low" => "MEDIA_RESOLUTION_LOW""high" => "MEDIA_RESOLUTION_HIGH"If both mediaResolution and detail are provided, mediaResolution wins.
Whether to disable streaming.
If streaming is bypassed, then stream() will defer to
invoke().
Positive values penalize tokens that repeatedly appear in the generated text, decreasing the probability of repeating content.
Configuration for image generation.
The maximum number of concurrent calls that can be made.
Defaults to Infinity, which means no limit.
Maximum number of tokens that can be generated in the response. A token is approximately four characters. 100 tokens correspond to roughly 60-80 words. Specify a lower value for shorter responses and a higher value for potentially longer responses.
The number of reasoning tokens that the model should generate. If explicitly set, then the reasoning blocks will be returned.
The maximum number of retries that can be made for a single call, with an exponential backoff between each attempt. Defaults to 6.
Media resolution for input media processing.
This maps to generationConfig.mediaResolution, which is a scalar enum-like
string value in the Gemini API.
Custom handler to handle failed attempts. Takes the originally thrown error object as input, and should itself throw an error if the input error is not retryable.
Version of AIMessage output format to store in message content.
AIMessage.contentBlocks will lazily parse the contents of content into a
standard format. This flag can be used to additionally store the standard format
as the message content, e.g., for serialization purposes.
.contentBlocks).contentBlocks)You can also set LC_OUTPUT_VERSION as an environment variable to "v1" to
enable this by default.
Positive values penalize tokens that already appear in the generated text, increasing the probability of generating more diverse content.
The ID of a previous interaction to continue a stateful server-side conversation.
An alias for maxReasoningTokens under Gemini 2.5 or
the primary thinking/reasoning setting for Gemini 3.
If explicitly set, then the reasoning blocks will be returned.
Native Interactions API response_format configuration (JSON Schema or media response format).
Note: responseSchema, responseModalities, responseMimeType, and imageConfig are also
automatically translated into response_format when using the Interactions API.
Desired MIME type of the generated candidate content.
The requested modalities of the response. Represents the set of modalities that the model can return. An empty list is equivalent to requesting only text.
The schema that the generated response should match.
Can be a Zod schema or a JSON Schema object.
When set, the response will be structured according to this schema
and responseMimeType will automatically be set to "application/json".
Per request settings for blocking unsafe content
When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used.
Inference service tiers. "priority" offers highest reliability for higher rates. "flex" offers a discount for preemptable processing. Other values are treated as the standard service tier.
Speech generation configuration. You can use either Google's definition of the speech configuration, or a simplified version we've defined (which can be as simple as the name of a pre-defined voice).
Specifies a list of strings that tells the model to stop generating text if one of the strings is encountered in the response. If a string appears multiple times in the response, then the response truncates where it's first encountered. The strings are case-sensitive.
Whether to store the interaction on the server.
The temperature is used for sampling during response generation, which occurs when topP and topK are applied. Temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a less open-ended or creative response, while higher temperatures can lead to more diverse or creative results.
Specify a lower value for less random responses and a higher value for more random responses.
An alias for maxReasoningTokens for compatibility.
Configuration for the model's thinking process
An alias for reasoningEffort for compatibility.
A list of tools the model may use to generate the next response. Can be LangChain tools, OpenAI tools, or Gemini function declarations.
Top-K changes how the model selects tokens for output. A top-K of 1 means the selected token is the most probable among all tokens in the model's vocabulary (also called greedy decoding), while a top-K of 3 means that the next token is selected from among the 3 most probable tokens (using temperature).
Top-P changes how the model selects tokens for output. Tokens are selected from the most probable to least probable until the sum of their probabilities equals the top-P value.
Specify a lower value for less random responses and a higher value for more random responses.
Optional webhook configuration for receiving asynchronous interaction events.
Custom / additional headers to include with every request to the API.
OpenAI-compatible alias for media input detail level.
Whether to disable streaming.
Positive values penalize tokens that repeatedly appear in the generated
Configuration for image generation.
The maximum number of concurrent calls that can be made.
Maximum number of tokens that can be generated in the response. A token is
The number of reasoning tokens that the model should generate.
The maximum number of retries that can be made for a single call,
Media resolution for input media processing.
Custom handler to handle failed attempts. Takes the originally thrown
Version of AIMessage output format to store in message content.
Positive values penalize tokens that already appear in the generated text,
An alias for maxReasoningTokens under Gemini 2.5 or
Desired MIME type of the generated candidate content.
The requested modalities of the response.
The schema that the generated response should match.
Per request settings for blocking unsafe content
When seed is fixed to a specific value, the model makes a best effort to
Inference service tiers.
Speech generation configuration.
Specifies a list of strings that tells the model to stop generating text if
The temperature is used for sampling during response generation, which
An alias for maxReasoningTokens for compatibility.
Configuration for the model's thinking process
An alias for reasoningEffort for compatibility.
A list of tools the model may use to generate the next response.
Top-K changes how the model selects tokens for output. A top-K of 1 means
Top-P changes how the model selects tokens for output. Tokens are selected
The name of the agent to use for the interaction (mutually exclusive with model in the raw API,
Configuration parameters for the specified agent.
Whether to execute the interaction in the background (primarily for agents).
The ID of a previous interaction to continue a stateful server-side conversation.
Native Interactions API response_format configuration (JSON Schema or media response format).
Whether to store the interaction on the server.
Optional webhook configuration for receiving asynchronous interaction events.
Custom / additional headers to include with every request to the API.
OpenAI-compatible alias for media input detail level.
Positive values penalize tokens that repeatedly appear in the generated
Configuration for image generation.
Maximum number of tokens that can be generated in the response. A token is
The number of reasoning tokens that the model should generate.
Media resolution for input media processing.
Positive values penalize tokens that already appear in the generated text,
An alias for maxReasoningTokens under Gemini 2.5 or
Desired MIME type of the generated candidate content.
The requested modalities of the response.
The schema that the generated response should match.
Per request settings for blocking unsafe content
When seed is fixed to a specific value, the model makes a best effort to
Inference service tiers.
Speech generation configuration.
Specifies a list of strings that tells the model to stop generating text if
The temperature is used for sampling during response generation, which
An alias for maxReasoningTokens for compatibility.
Configuration for the model's thinking process
An alias for reasoningEffort for compatibility.
A list of tools the model may use to generate the next response.
Top-K changes how the model selects tokens for output. A top-K of 1 means
Top-P changes how the model selects tokens for output. Tokens are selected