@langchain/google-genai 0.0.13 → 0.0.15
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 +14 -0
- package/dist/chat_models.d.ts +10 -1
- package/dist/chat_models.js +14 -0
- package/package.json +6 -6
package/dist/chat_models.cjs
CHANGED
|
@@ -171,8 +171,22 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
|
|
|
171
171
|
topP: this.topP,
|
|
172
172
|
topK: this.topK,
|
|
173
173
|
},
|
|
174
|
+
}, {
|
|
175
|
+
apiVersion: fields?.apiVersion,
|
|
176
|
+
baseUrl: fields?.baseUrl,
|
|
174
177
|
});
|
|
175
178
|
}
|
|
179
|
+
getLsParams(options) {
|
|
180
|
+
const params = this.invocationParams(options);
|
|
181
|
+
return {
|
|
182
|
+
ls_provider: "google_genai",
|
|
183
|
+
ls_model_name: this.model,
|
|
184
|
+
ls_model_type: "chat",
|
|
185
|
+
ls_temperature: params.temperature ?? undefined,
|
|
186
|
+
ls_max_tokens: params.maxOutputTokens ?? undefined,
|
|
187
|
+
ls_stop: options.stop,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
176
190
|
_combineLLMOutput() {
|
|
177
191
|
return [];
|
|
178
192
|
}
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { SafetySetting } from "@google/generative-ai";
|
|
|
2
2
|
import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
|
|
3
3
|
import { BaseMessage } from "@langchain/core/messages";
|
|
4
4
|
import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
|
|
5
|
-
import { BaseChatModel, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
5
|
+
import { BaseChatModel, LangSmithParams, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
6
6
|
export type BaseMessageExamplePair = {
|
|
7
7
|
input: BaseMessage;
|
|
8
8
|
output: BaseMessage;
|
|
@@ -84,6 +84,14 @@ export interface GoogleGenerativeAIChatInput extends BaseChatModelParams {
|
|
|
84
84
|
* Google API key to use
|
|
85
85
|
*/
|
|
86
86
|
apiKey?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Google API version to use
|
|
89
|
+
*/
|
|
90
|
+
apiVersion?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Google API base URL to use
|
|
93
|
+
*/
|
|
94
|
+
baseUrl?: string;
|
|
87
95
|
/** Whether to stream the results or not */
|
|
88
96
|
streaming?: boolean;
|
|
89
97
|
}
|
|
@@ -135,6 +143,7 @@ export declare class ChatGoogleGenerativeAI extends BaseChatModel implements Goo
|
|
|
135
143
|
private client;
|
|
136
144
|
get _isMultimodalModel(): boolean;
|
|
137
145
|
constructor(fields?: GoogleGenerativeAIChatInput);
|
|
146
|
+
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
138
147
|
_combineLLMOutput(): never[];
|
|
139
148
|
_llmType(): string;
|
|
140
149
|
_generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
package/dist/chat_models.js
CHANGED
|
@@ -168,8 +168,22 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
|
168
168
|
topP: this.topP,
|
|
169
169
|
topK: this.topK,
|
|
170
170
|
},
|
|
171
|
+
}, {
|
|
172
|
+
apiVersion: fields?.apiVersion,
|
|
173
|
+
baseUrl: fields?.baseUrl,
|
|
171
174
|
});
|
|
172
175
|
}
|
|
176
|
+
getLsParams(options) {
|
|
177
|
+
const params = this.invocationParams(options);
|
|
178
|
+
return {
|
|
179
|
+
ls_provider: "google_genai",
|
|
180
|
+
ls_model_name: this.model,
|
|
181
|
+
ls_model_type: "chat",
|
|
182
|
+
ls_temperature: params.temperature ?? undefined,
|
|
183
|
+
ls_max_tokens: params.maxOutputTokens ?? undefined,
|
|
184
|
+
ls_stop: options.stop,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
173
187
|
_combineLLMOutput() {
|
|
174
188
|
return [];
|
|
175
189
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/google-genai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Sample integration for LangChain.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
|
|
27
27
|
"clean": "rm -rf dist/ && NODE_OPTIONS=--max-old-space-size=4096 yarn lc-build --config ./langchain.config.js --create-entrypoints --pre",
|
|
28
28
|
"prepack": "yarn build",
|
|
29
|
-
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
|
|
30
|
-
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
|
31
|
-
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
|
|
32
|
-
"test:int": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
29
|
+
"test": "yarn build:deps && NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
|
|
30
|
+
"test:watch": "yarn build:deps && NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
|
31
|
+
"test:single": "yarn build:deps && NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
|
|
32
|
+
"test:int": "yarn build:deps && NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
33
33
|
"format": "prettier --config .prettierrc --write \"src\"",
|
|
34
34
|
"format:check": "prettier --config .prettierrc --check \"src\"",
|
|
35
35
|
"move-cjs-to-dist": "yarn lc-build --config ./langchain.config.js --move-cjs-dist",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@google/generative-ai": "^0.7.0",
|
|
43
|
-
"@langchain/core": "
|
|
43
|
+
"@langchain/core": ">0.1.5 <0.3.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^29.5.0",
|