@langchain/google-genai 0.0.25 → 0.0.26

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.
@@ -191,6 +191,7 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
191
191
  temperature: this.temperature,
192
192
  topP: this.topP,
193
193
  topK: this.topK,
194
+ ...(fields?.json ? { responseMimeType: "application/json" } : {}),
194
195
  },
195
196
  }, {
196
197
  apiVersion: fields?.apiVersion,
@@ -328,7 +329,7 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
328
329
  async completionWithRetry(request, options) {
329
330
  return this.caller.callWithOptions({ signal: options?.signal }, async () => {
330
331
  try {
331
- return this.client.generateContent(request);
332
+ return await this.client.generateContent(request);
332
333
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
333
334
  }
334
335
  catch (e) {
@@ -25,6 +25,8 @@ export interface GoogleGenerativeAIChatCallOptions extends BaseChatModelCallOpti
25
25
  */
26
26
  export interface GoogleGenerativeAIChatInput extends BaseChatModelParams, Pick<GoogleGenerativeAIChatCallOptions, "streamUsage"> {
27
27
  /**
28
+ * @deprecated Use "model" instead.
29
+ *
28
30
  * Model Name to use
29
31
  *
30
32
  * Alias for `model`
@@ -107,6 +109,12 @@ export interface GoogleGenerativeAIChatInput extends BaseChatModelParams, Pick<G
107
109
  baseUrl?: string;
108
110
  /** Whether to stream the results or not */
109
111
  streaming?: boolean;
112
+ /**
113
+ * Whether or not to force the model to respond with JSON.
114
+ * Available for `gemini-1.5` models and later.
115
+ * @default false
116
+ */
117
+ json?: boolean;
110
118
  }
111
119
  /**
112
120
  * A class that wraps the Google Palm chat model.
@@ -188,6 +188,7 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
188
188
  temperature: this.temperature,
189
189
  topP: this.topP,
190
190
  topK: this.topK,
191
+ ...(fields?.json ? { responseMimeType: "application/json" } : {}),
191
192
  },
192
193
  }, {
193
194
  apiVersion: fields?.apiVersion,
@@ -325,7 +326,7 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
325
326
  async completionWithRetry(request, options) {
326
327
  return this.caller.callWithOptions({ signal: options?.signal }, async () => {
327
328
  try {
328
- return this.client.generateContent(request);
329
+ return await this.client.generateContent(request);
329
330
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
330
331
  }
331
332
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/google-genai",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "Google Generative AI integration for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {