@langchain/google-genai 0.0.22 → 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.
package/dist/chat_models.cjs
CHANGED
|
@@ -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(
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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;
|
package/dist/chat_models.js
CHANGED
|
@@ -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(
|
|
@@ -8,8 +8,7 @@ function removeAdditionalProperties(
|
|
|
8
8
|
obj) {
|
|
9
9
|
if (typeof obj === "object" && obj !== null) {
|
|
10
10
|
const newObj = { ...obj };
|
|
11
|
-
if ("additionalProperties" in newObj
|
|
12
|
-
typeof newObj.additionalProperties === "boolean") {
|
|
11
|
+
if ("additionalProperties" in newObj) {
|
|
13
12
|
delete newObj.additionalProperties;
|
|
14
13
|
}
|
|
15
14
|
for (const key in newObj) {
|
|
@@ -5,8 +5,7 @@ export function removeAdditionalProperties(
|
|
|
5
5
|
obj) {
|
|
6
6
|
if (typeof obj === "object" && obj !== null) {
|
|
7
7
|
const newObj = { ...obj };
|
|
8
|
-
if ("additionalProperties" in newObj
|
|
9
|
-
typeof newObj.additionalProperties === "boolean") {
|
|
8
|
+
if ("additionalProperties" in newObj) {
|
|
10
9
|
delete newObj.additionalProperties;
|
|
11
10
|
}
|
|
12
11
|
for (const key in newObj) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/google-genai",
|
|
3
|
-
"version": "0.0.
|
|
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
|
|
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.
|
|
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",
|