@google/genai 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/genai.d.ts +54 -30
- package/dist/index.cjs +260 -193
- package/dist/index.mjs +260 -193
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +260 -193
- package/dist/node/index.mjs +260 -193
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +54 -30
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +1 -1
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +14 -0
- package/dist/vertex_internal/index.js +1 -1
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +260 -193
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +54 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -369,7 +369,10 @@ async function main() {
|
|
|
369
369
|
main();
|
|
370
370
|
```
|
|
371
371
|
|
|
372
|
-
## Interactions
|
|
372
|
+
## Interactions (Experimental)
|
|
373
|
+
|
|
374
|
+
> **Warning:** The Interactions API is in **Beta**. This is a preview of an
|
|
375
|
+
experimental feature. Features and schemas are subject to **breaking changes**.
|
|
373
376
|
|
|
374
377
|
The Interactions API is a unified interface for interacting with Gemini models
|
|
375
378
|
and agents. It simplifies state management, tool orchestration, and long-running
|
package/dist/genai.d.ts
CHANGED
|
@@ -700,7 +700,7 @@ declare interface BaseCreateAgentInteractionParams {
|
|
|
700
700
|
* Body param: Enforces that the generated response is a JSON object that complies
|
|
701
701
|
* with the JSON schema specified in this field.
|
|
702
702
|
*/
|
|
703
|
-
response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat |
|
|
703
|
+
response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown> | AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown;
|
|
704
704
|
/**
|
|
705
705
|
* Body param: The mime type of the response. This is required if response_format
|
|
706
706
|
* is set.
|
|
@@ -767,7 +767,7 @@ declare interface BaseCreateModelInteractionParams {
|
|
|
767
767
|
* Body param: Enforces that the generated response is a JSON object that complies
|
|
768
768
|
* with the JSON schema specified in this field.
|
|
769
769
|
*/
|
|
770
|
-
response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat |
|
|
770
|
+
response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown> | AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown;
|
|
771
771
|
/**
|
|
772
772
|
* Body param: The mime type of the response. This is required if response_format
|
|
773
773
|
* is set.
|
|
@@ -6280,7 +6280,7 @@ declare interface Interaction {
|
|
|
6280
6280
|
* Enforces that the generated response is a JSON object that complies with the
|
|
6281
6281
|
* JSON schema specified in this field.
|
|
6282
6282
|
*/
|
|
6283
|
-
response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat |
|
|
6283
|
+
response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown> | AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown;
|
|
6284
6284
|
/**
|
|
6285
6285
|
* The mime type of the response. This is required if response_format is set.
|
|
6286
6286
|
*/
|
|
@@ -6314,6 +6314,30 @@ declare interface Interaction {
|
|
|
6314
6314
|
* completes.
|
|
6315
6315
|
*/
|
|
6316
6316
|
webhook_config?: WebhookConfig_2;
|
|
6317
|
+
/**
|
|
6318
|
+
* Concatenated text from the last model output in response to the current request.
|
|
6319
|
+
*
|
|
6320
|
+
* Note: this is added by the SDK.
|
|
6321
|
+
*/
|
|
6322
|
+
output_text?: string;
|
|
6323
|
+
/**
|
|
6324
|
+
* The last image generated by the model in response to the current request.
|
|
6325
|
+
*
|
|
6326
|
+
* Note: this is added by the SDK.
|
|
6327
|
+
*/
|
|
6328
|
+
output_image?: ImageContent;
|
|
6329
|
+
/**
|
|
6330
|
+
* The last audio generated by the model in response to the current request.
|
|
6331
|
+
*
|
|
6332
|
+
* Note: this is added by the SDK.
|
|
6333
|
+
*/
|
|
6334
|
+
output_audio?: AudioContent;
|
|
6335
|
+
/**
|
|
6336
|
+
* The last video generated by the model in response to the current request.
|
|
6337
|
+
*
|
|
6338
|
+
* Note: this is added by the SDK.
|
|
6339
|
+
*/
|
|
6340
|
+
output_video?: VideoContent;
|
|
6317
6341
|
}
|
|
6318
6342
|
|
|
6319
6343
|
declare interface InteractionCancelParams {
|
|
@@ -6408,7 +6432,7 @@ export declare class Interactions extends BaseInteractions {
|
|
|
6408
6432
|
}
|
|
6409
6433
|
|
|
6410
6434
|
export declare namespace Interactions {
|
|
6411
|
-
export { type AllowedTools as AllowedTools, type Annotation as Annotation, type AudioContent as AudioContent, type AudioResponseFormat as AudioResponseFormat, type CodeExecutionCallArguments as CodeExecutionCallArguments, type CodeExecutionCallStep as CodeExecutionCallStep, type CodeExecutionResultStep as CodeExecutionResultStep, type Content_2 as Content, type DeepResearchAgentConfig as DeepResearchAgentConfig, type DocumentContent as DocumentContent, type DynamicAgentConfig as DynamicAgentConfig, type ErrorEvent_2 as ErrorEvent, type FileCitation as FileCitation, type FileSearchCallStep as FileSearchCallStep, type FileSearchResultStep as FileSearchResultStep, type Function_2 as Function, type FunctionCallStep as FunctionCallStep, type FunctionResultStep as FunctionResultStep, type GenerationConfig_2 as GenerationConfig, type GoogleMapsCallArguments as GoogleMapsCallArguments, type GoogleMapsCallStep as GoogleMapsCallStep, type GoogleMapsResult as GoogleMapsResult, type GoogleMapsResultStep as GoogleMapsResultStep, type GoogleSearchCallArguments as GoogleSearchCallArguments, type GoogleSearchCallStep as GoogleSearchCallStep, type GoogleSearchResult as GoogleSearchResult, type GoogleSearchResultStep as GoogleSearchResultStep, type ImageConfig_2 as ImageConfig, type ImageContent as ImageContent, type ImageResponseFormat as ImageResponseFormat, type Interaction as Interaction, type InteractionCompletedEvent as InteractionCompletedEvent, type InteractionCreatedEvent as InteractionCreatedEvent, type InteractionSSEEvent as InteractionSSEEvent, type InteractionStatusUpdate as InteractionStatusUpdate, type MCPServerToolCallStep as MCPServerToolCallStep, type MCPServerToolResultStep as MCPServerToolResultStep, type Model_2 as Model, type ModelOutputStep as ModelOutputStep, type PlaceCitation as PlaceCitation, type SpeechConfig_2 as SpeechConfig, type Step as Step, type StepDelta as StepDelta, type StepStart as StepStart, type StepStop as StepStop, type TextContent as TextContent, type TextResponseFormat as TextResponseFormat, type ThinkingLevel_2 as ThinkingLevel, type ThoughtStep as ThoughtStep, type Tool_2 as Tool, type ToolChoiceConfig as ToolChoiceConfig, type ToolChoiceType as ToolChoiceType, type URLCitation as URLCitation, type URLContextCallArguments as URLContextCallArguments, type URLContextCallStep as URLContextCallStep, type URLContextResult as URLContextResult, type URLContextResultStep as URLContextResultStep, type Usage as Usage, type UserInputStep as UserInputStep, type VideoContent as VideoContent, type
|
|
6435
|
+
export { type AllowedTools as AllowedTools, type Annotation as Annotation, type AudioContent as AudioContent, type AudioResponseFormat as AudioResponseFormat, type CodeExecutionCallArguments as CodeExecutionCallArguments, type CodeExecutionCallStep as CodeExecutionCallStep, type CodeExecutionResultStep as CodeExecutionResultStep, type Content_2 as Content, type DeepResearchAgentConfig as DeepResearchAgentConfig, type DocumentContent as DocumentContent, type DynamicAgentConfig as DynamicAgentConfig, type ErrorEvent_2 as ErrorEvent, type FileCitation as FileCitation, type FileSearchCallStep as FileSearchCallStep, type FileSearchResultStep as FileSearchResultStep, type Function_2 as Function, type FunctionCallStep as FunctionCallStep, type FunctionResultStep as FunctionResultStep, type GenerationConfig_2 as GenerationConfig, type GoogleMapsCallArguments as GoogleMapsCallArguments, type GoogleMapsCallStep as GoogleMapsCallStep, type GoogleMapsResult as GoogleMapsResult, type GoogleMapsResultStep as GoogleMapsResultStep, type GoogleSearchCallArguments as GoogleSearchCallArguments, type GoogleSearchCallStep as GoogleSearchCallStep, type GoogleSearchResult as GoogleSearchResult, type GoogleSearchResultStep as GoogleSearchResultStep, type ImageConfig_2 as ImageConfig, type ImageContent as ImageContent, type ImageResponseFormat as ImageResponseFormat, type Interaction as Interaction, type InteractionCompletedEvent as InteractionCompletedEvent, type InteractionCreatedEvent as InteractionCreatedEvent, type InteractionSSEEvent as InteractionSSEEvent, type InteractionStatusUpdate as InteractionStatusUpdate, type MCPServerToolCallStep as MCPServerToolCallStep, type MCPServerToolResultStep as MCPServerToolResultStep, type Model_2 as Model, type ModelOutputStep as ModelOutputStep, type PlaceCitation as PlaceCitation, type SpeechConfig_2 as SpeechConfig, type Step as Step, type StepDelta as StepDelta, type StepStart as StepStart, type StepStop as StepStop, type TextContent as TextContent, type TextResponseFormat as TextResponseFormat, type ThinkingLevel_2 as ThinkingLevel, type ThoughtStep as ThoughtStep, type Tool_2 as Tool, type ToolChoiceConfig as ToolChoiceConfig, type ToolChoiceType as ToolChoiceType, type URLCitation as URLCitation, type URLContextCallArguments as URLContextCallArguments, type URLContextCallStep as URLContextCallStep, type URLContextResult as URLContextResult, type URLContextResultStep as URLContextResultStep, type Usage as Usage, type UserInputStep as UserInputStep, type VideoContent as VideoContent, type WebhookConfig_2 as WebhookConfig, type InteractionDeleteResponse as InteractionDeleteResponse, type InteractionCreateParams as InteractionCreateParams, type CreateModelInteractionParamsNonStreaming as CreateModelInteractionParamsNonStreaming, type CreateModelInteractionParamsStreaming as CreateModelInteractionParamsStreaming, type CreateAgentInteractionParamsNonStreaming as CreateAgentInteractionParamsNonStreaming, type CreateAgentInteractionParamsStreaming as CreateAgentInteractionParamsStreaming, type InteractionDeleteParams as InteractionDeleteParams, type InteractionCancelParams as InteractionCancelParams, type InteractionGetParams as InteractionGetParams, type InteractionGetParamsNonStreaming as InteractionGetParamsNonStreaming, type InteractionGetParamsStreaming as InteractionGetParamsStreaming, };
|
|
6412
6436
|
}
|
|
6413
6437
|
|
|
6414
6438
|
declare namespace InteractionsAPI {
|
|
@@ -6475,7 +6499,6 @@ declare namespace InteractionsAPI {
|
|
|
6475
6499
|
Usage,
|
|
6476
6500
|
UserInputStep,
|
|
6477
6501
|
VideoContent,
|
|
6478
|
-
VideoResponseFormat,
|
|
6479
6502
|
WebhookConfig_2 as WebhookConfig,
|
|
6480
6503
|
InteractionDeleteResponse,
|
|
6481
6504
|
InteractionCreateParams,
|
|
@@ -7136,6 +7159,8 @@ export declare interface LiveConnectConfig {
|
|
|
7136
7159
|
response.
|
|
7137
7160
|
*/
|
|
7138
7161
|
safetySettings?: SafetySetting[];
|
|
7162
|
+
/** Config for stream translation. */
|
|
7163
|
+
streamTranslationConfig?: StreamTranslationConfig;
|
|
7139
7164
|
}
|
|
7140
7165
|
|
|
7141
7166
|
/** Config for LiveConnectConstraints for Auth Token creation. */
|
|
@@ -9962,7 +9987,7 @@ export declare enum StartSensitivity {
|
|
|
9962
9987
|
declare type Step = UserInputStep | ModelOutputStep | ThoughtStep | FunctionCallStep | CodeExecutionCallStep | URLContextCallStep | MCPServerToolCallStep | GoogleSearchCallStep | FileSearchCallStep | GoogleMapsCallStep | FunctionResultStep | CodeExecutionResultStep | URLContextResultStep | GoogleSearchResultStep | MCPServerToolResultStep | FileSearchResultStep | GoogleMapsResultStep;
|
|
9963
9988
|
|
|
9964
9989
|
declare interface StepDelta {
|
|
9965
|
-
delta: StepDelta.Text | StepDelta.Image | StepDelta.Audio | StepDelta.Document | StepDelta.Video | StepDelta.ThoughtSummary | StepDelta.ThoughtSignature | StepDelta.TextAnnotationDelta | StepDelta.ArgumentsDelta | StepDelta.CodeExecutionCall | StepDelta.URLContextCall | StepDelta.GoogleSearchCall | StepDelta.MCPServerToolCall | StepDelta.FileSearchCall | StepDelta.GoogleMapsCall | StepDelta.CodeExecutionResult | StepDelta.URLContextResult | StepDelta.GoogleSearchResult | StepDelta.MCPServerToolResult | StepDelta.FileSearchResult | StepDelta.GoogleMapsResult;
|
|
9990
|
+
delta: StepDelta.Text | StepDelta.Image | StepDelta.Audio | StepDelta.Document | StepDelta.Video | StepDelta.ThoughtSummary | StepDelta.ThoughtSignature | StepDelta.TextAnnotationDelta | StepDelta.ArgumentsDelta | StepDelta.CodeExecutionCall | StepDelta.URLContextCall | StepDelta.GoogleSearchCall | StepDelta.MCPServerToolCall | StepDelta.FileSearchCall | StepDelta.GoogleMapsCall | StepDelta.CodeExecutionResult | StepDelta.URLContextResult | StepDelta.GoogleSearchResult | StepDelta.MCPServerToolResult | StepDelta.FileSearchResult | StepDelta.GoogleMapsResult | StepDelta.FunctionResult;
|
|
9966
9991
|
event_type: 'step.delta';
|
|
9967
9992
|
index: number;
|
|
9968
9993
|
/**
|
|
@@ -10043,6 +10068,7 @@ declare namespace StepDelta {
|
|
|
10043
10068
|
}
|
|
10044
10069
|
interface ArgumentsDelta {
|
|
10045
10070
|
type: 'arguments_delta';
|
|
10071
|
+
arguments?: string;
|
|
10046
10072
|
}
|
|
10047
10073
|
interface CodeExecutionCall {
|
|
10048
10074
|
/**
|
|
@@ -10163,6 +10189,16 @@ declare namespace StepDelta {
|
|
|
10163
10189
|
*/
|
|
10164
10190
|
signature?: string;
|
|
10165
10191
|
}
|
|
10192
|
+
interface FunctionResult {
|
|
10193
|
+
/**
|
|
10194
|
+
* Required. ID to match the ID from the function call block.
|
|
10195
|
+
*/
|
|
10196
|
+
call_id: string;
|
|
10197
|
+
result: unknown | Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent> | string;
|
|
10198
|
+
type: 'function_result';
|
|
10199
|
+
is_error?: boolean;
|
|
10200
|
+
name?: string;
|
|
10201
|
+
}
|
|
10166
10202
|
}
|
|
10167
10203
|
|
|
10168
10204
|
declare interface StepStart {
|
|
@@ -10226,6 +10262,17 @@ export declare interface StreamableHttpTransport {
|
|
|
10226
10262
|
url?: string;
|
|
10227
10263
|
}
|
|
10228
10264
|
|
|
10265
|
+
/** Config for stream translation. */
|
|
10266
|
+
export declare interface StreamTranslationConfig {
|
|
10267
|
+
/** If true, the model will generate audio when the target language is
|
|
10268
|
+
spoken, essentially it will parrot the input. If false, we will not produce
|
|
10269
|
+
audio for the target language. */
|
|
10270
|
+
echoTargetLanguage?: boolean;
|
|
10271
|
+
/** The target language for translation. Supported values are BCP-47
|
|
10272
|
+
language codes (e.g. "en", "es", "fr"). */
|
|
10273
|
+
targetLanguageCode?: string;
|
|
10274
|
+
}
|
|
10275
|
+
|
|
10229
10276
|
/** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
|
|
10230
10277
|
export declare interface StringList {
|
|
10231
10278
|
/** The string values of the metadata to store. */
|
|
@@ -11823,6 +11870,7 @@ declare namespace types {
|
|
|
11823
11870
|
LiveClientRealtimeInput,
|
|
11824
11871
|
LiveClientToolResponse,
|
|
11825
11872
|
LiveClientMessage,
|
|
11873
|
+
StreamTranslationConfig,
|
|
11826
11874
|
LiveConnectConfig,
|
|
11827
11875
|
LiveConnectParameters,
|
|
11828
11876
|
CreateChatParameters,
|
|
@@ -12680,30 +12728,6 @@ export declare interface VideoMetadata {
|
|
|
12680
12728
|
startOffset?: string;
|
|
12681
12729
|
}
|
|
12682
12730
|
|
|
12683
|
-
/**
|
|
12684
|
-
* Configuration for video output format.
|
|
12685
|
-
*/
|
|
12686
|
-
declare interface VideoResponseFormat {
|
|
12687
|
-
type: 'video';
|
|
12688
|
-
/**
|
|
12689
|
-
* The aspect ratio for the video output.
|
|
12690
|
-
*/
|
|
12691
|
-
aspectRatio?: '16:9' | '9:16';
|
|
12692
|
-
/**
|
|
12693
|
-
* The delivery mode for the video output.
|
|
12694
|
-
*/
|
|
12695
|
-
delivery?: 'inline' | 'uri';
|
|
12696
|
-
/**
|
|
12697
|
-
* The duration for the video output.
|
|
12698
|
-
*/
|
|
12699
|
-
duration?: string;
|
|
12700
|
-
/**
|
|
12701
|
-
* The GCS URI to store the video output. Required for Vertex if delivery mode is
|
|
12702
|
-
* URI.
|
|
12703
|
-
*/
|
|
12704
|
-
gcsUri?: string;
|
|
12705
|
-
}
|
|
12706
|
-
|
|
12707
12731
|
/** Voice activity signal. */
|
|
12708
12732
|
export declare interface VoiceActivity {
|
|
12709
12733
|
/** The type of the voice activity signal. */
|