GoogleOptions class final
Options for streamGoogle.
Ported subset of pi's GoogleOptions (which extends StreamOptions):
temperature, maxTokens, apiKey, headers, signal, thinking, toolChoice,
onPayload, onResponse. pi's signal: AbortSignal is cancelToken here.
Constructors
-
GoogleOptions({double? temperature, int? maxTokens, String? apiKey, Map<
String, String?> ? headers, CancelToken? cancelToken, GoogleThinking? thinking, String? toolChoice, bool useParameters = false, FutureOr<Map< onPayload(Map<String, dynamic> ?>String, dynamic> payload, Model model)?, FutureOr<void> onResponse(int statusCode, Map<String, String> headers, Model model)?}) -
Creates Google options.
const
Properties
- apiKey → String?
-
API key sent as
x-goog-api-key: ...(what pi's@google/genaiSDK does). Falls back to anx-goog-api-keyorauthorizationentry in headers (key then unused), else the stream fails with an error event.final - cancelToken → CancelToken?
-
Cancels the in-flight request when triggered. The stream then ends with
an ErrorEvent whose reason is StopReason.aborted.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String?> ? -
Extra request headers, merged over Model.headers; a
nullvalue suppresses the header with the same name (pi'sProviderHeaders).final - maxTokens → int?
-
Output-token cap, sent as
generationConfig.maxOutputTokens.final -
onPayload
→ FutureOr<
Map< Function(Map<String, dynamic> ?>String, dynamic> payload, Model model)? -
Hook invoked with the fully built request payload right before sending;
return a replacement map to override it, or
nullto send it as-is.final -
onResponse
→ FutureOr<
void> Function(int statusCode, Map<String, String> headers, Model model)? -
Hook invoked once the response headers are in, before the SSE body is
consumed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- temperature → double?
-
Sampling temperature, sent as
generationConfig.temperature.final - thinking → GoogleThinking?
-
Thinking configuration; only sent when Model.reasoning is true.
final
- toolChoice → String?
-
Tool choice:
'auto','none', or'any', mapped to Gemini'sFunctionCallingConfigMode(AUTO/NONE/ANY). Only sent when the context has tools, per pi.final - useParameters → bool
-
Use the legacy
parametersfield (OpenAPI 3.03 Schema, sanitized via pi'ssanitizeForOpenApi) instead ofparametersJsonSchemain function declarations. Needed for Cloud Code Assist with Claude models, where the API translatesparametersinto Anthropic'sinput_schema(pi'sconvertTools(tools, useParameters)).final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited