@langchain/google-genai 0.0.23 → 0.0.24

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.
@@ -47,6 +47,11 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
47
47
  apiKey: "GOOGLE_API_KEY",
48
48
  };
49
49
  }
50
+ get lc_aliases() {
51
+ return {
52
+ apiKey: "google_api_key",
53
+ };
54
+ }
50
55
  get _isMultimodalModel() {
51
56
  return this.model.includes("vision") || this.model.startsWith("gemini-1.5");
52
57
  }
@@ -58,6 +63,12 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
58
63
  writable: true,
59
64
  value: true
60
65
  });
66
+ Object.defineProperty(this, "lc_namespace", {
67
+ enumerable: true,
68
+ configurable: true,
69
+ writable: true,
70
+ value: ["langchain", "chat_models", "google_genai"]
71
+ });
61
72
  Object.defineProperty(this, "modelName", {
62
73
  enumerable: true,
63
74
  configurable: true,
@@ -207,6 +218,9 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
207
218
  return this.bind({ tools: (0, common_js_1.convertToGenerativeAITools)(tools), ...kwargs });
208
219
  }
209
220
  invocationParams(options) {
221
+ if (options?.tool_choice) {
222
+ throw new Error("'tool_choice' call option is not supported by ChatGoogleGenerativeAI.");
223
+ }
210
224
  const tools = options?.tools;
211
225
  if (Array.isArray(tools) &&
212
226
  !tools.some(
@@ -2,8 +2,8 @@ import { FunctionDeclarationsTool as GoogleGenerativeAIFunctionDeclarationsTool,
2
2
  import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
3
3
  import { AIMessageChunk, BaseMessage } from "@langchain/core/messages";
4
4
  import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
5
- import { BaseChatModel, LangSmithParams, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
6
- import { BaseLanguageModelCallOptions, BaseLanguageModelInput, StructuredOutputMethodOptions, ToolDefinition } from "@langchain/core/language_models/base";
5
+ import { BaseChatModel, type BaseChatModelCallOptions, type LangSmithParams, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
6
+ import { BaseLanguageModelInput, StructuredOutputMethodOptions, ToolDefinition } from "@langchain/core/language_models/base";
7
7
  import { StructuredToolInterface } from "@langchain/core/tools";
8
8
  import { Runnable, RunnableToolLike } from "@langchain/core/runnables";
9
9
  import type { z } from "zod";
@@ -11,7 +11,7 @@ export type BaseMessageExamplePair = {
11
11
  input: BaseMessage;
12
12
  output: BaseMessage;
13
13
  };
14
- export interface GoogleGenerativeAIChatCallOptions extends BaseLanguageModelCallOptions {
14
+ export interface GoogleGenerativeAIChatCallOptions extends BaseChatModelCallOptions {
15
15
  tools?: StructuredToolInterface[] | GoogleGenerativeAIFunctionDeclarationsTool[];
16
16
  /**
17
17
  * Whether or not to include usage data, like token counts
@@ -143,6 +143,10 @@ export declare class ChatGoogleGenerativeAI extends BaseChatModel<GoogleGenerati
143
143
  get lc_secrets(): {
144
144
  [key: string]: string;
145
145
  } | undefined;
146
+ lc_namespace: string[];
147
+ get lc_aliases(): {
148
+ apiKey: string;
149
+ };
146
150
  modelName: string;
147
151
  model: string;
148
152
  temperature?: number;
@@ -44,6 +44,11 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
44
44
  apiKey: "GOOGLE_API_KEY",
45
45
  };
46
46
  }
47
+ get lc_aliases() {
48
+ return {
49
+ apiKey: "google_api_key",
50
+ };
51
+ }
47
52
  get _isMultimodalModel() {
48
53
  return this.model.includes("vision") || this.model.startsWith("gemini-1.5");
49
54
  }
@@ -55,6 +60,12 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
55
60
  writable: true,
56
61
  value: true
57
62
  });
63
+ Object.defineProperty(this, "lc_namespace", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: ["langchain", "chat_models", "google_genai"]
68
+ });
58
69
  Object.defineProperty(this, "modelName", {
59
70
  enumerable: true,
60
71
  configurable: true,
@@ -204,6 +215,9 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
204
215
  return this.bind({ tools: convertToGenerativeAITools(tools), ...kwargs });
205
216
  }
206
217
  invocationParams(options) {
218
+ if (options?.tool_choice) {
219
+ throw new Error("'tool_choice' call option is not supported by ChatGoogleGenerativeAI.");
220
+ }
207
221
  const tools = options?.tools;
208
222
  if (Array.isArray(tools) &&
209
223
  !tools.some(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/google-genai",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "Sample integration for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {
@@ -15,7 +15,7 @@
15
15
  "homepage": "https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-genai/",
16
16
  "scripts": {
17
17
  "build": "yarn turbo:command build:internal --filter=@langchain/google-genai",
18
- "build:internal": "yarn lc-build:v2 --create-entrypoints --pre --tree-shaking",
18
+ "build:internal": "yarn lc_build_v2 --create-entrypoints --pre --tree-shaking",
19
19
  "lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
20
20
  "lint:dpdm": "dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
21
21
  "lint": "yarn lint:eslint && yarn lint:dpdm",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "^29.5.0",
44
- "@langchain/scripts": "~0.0.14",
44
+ "@langchain/scripts": "~0.0.20",
45
45
  "@langchain/standard-tests": "0.0.0",
46
46
  "@swc/core": "^1.3.90",
47
47
  "@swc/jest": "^0.2.29",