diff --git a/common/api-review/generative-ai.api.md b/common/api-review/generative-ai.api.md index 5880a650d..1131deb83 100644 --- a/common/api-review/generative-ai.api.md +++ b/common/api-review/generative-ai.api.md @@ -496,6 +496,7 @@ export interface GenerationConfig { presencePenalty?: number; responseLogprobs?: boolean; responseMimeType?: string; + responseModalities?: string[]; responseSchema?: ResponseSchema; // (undocumented) stopSequences?: string[]; diff --git a/package.json b/package.json index 54266a7ca..7b8f029fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@google/generative-ai", - "version": "0.24.0", + "version": "0.24.1", "description": "Google AI JavaScript SDK", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/src/methods/chat-session-helpers.ts b/src/methods/chat-session-helpers.ts index 2865a30bf..cf3c42d14 100644 --- a/src/methods/chat-session-helpers.ts +++ b/src/methods/chat-session-helpers.ts @@ -39,7 +39,13 @@ const VALID_PART_FIELDS: Array = [ const VALID_PARTS_PER_ROLE: { [key in Role]: Array } = { user: ["text", "inlineData"], function: ["functionResponse"], - model: ["text", "functionCall", "executableCode", "codeExecutionResult"], + model: [ + "text", + "inlineData", + "functionCall", + "executableCode", + "codeExecutionResult", + ], // System instructions shouldn't be in history anyway. system: ["text"], }; diff --git a/types/requests.ts b/types/requests.ts index 81285bc20..0100b9d5c 100644 --- a/types/requests.ts +++ b/types/requests.ts @@ -122,6 +122,10 @@ export interface GenerationConfig { * logprobs to return at each decoding step in the logprobsResult. */ logprobs?: number; + /** + * Compatible with new response formats, supporting "Text", "Audio", "Image" arrays. + */ + responseModalities?: string[]; } /**