@langchain/google-genai 0.0.14 → 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 +13 -14
- package/dist/chat_models.d.ts +2 -3
- package/dist/chat_models.js +13 -14
- package/package.json +5 -5
package/dist/chat_models.cjs
CHANGED
|
@@ -108,18 +108,6 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
|
|
|
108
108
|
writable: true,
|
|
109
109
|
value: void 0
|
|
110
110
|
});
|
|
111
|
-
Object.defineProperty(this, "apiVersion", {
|
|
112
|
-
enumerable: true,
|
|
113
|
-
configurable: true,
|
|
114
|
-
writable: true,
|
|
115
|
-
value: "v1"
|
|
116
|
-
});
|
|
117
|
-
Object.defineProperty(this, "baseUrl", {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
configurable: true,
|
|
120
|
-
writable: true,
|
|
121
|
-
value: "https://generativeai.googleapis.com"
|
|
122
|
-
});
|
|
123
111
|
Object.defineProperty(this, "streaming", {
|
|
124
112
|
enumerable: true,
|
|
125
113
|
configurable: true,
|
|
@@ -184,10 +172,21 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
|
|
|
184
172
|
topK: this.topK,
|
|
185
173
|
},
|
|
186
174
|
}, {
|
|
187
|
-
apiVersion:
|
|
188
|
-
baseUrl:
|
|
175
|
+
apiVersion: fields?.apiVersion,
|
|
176
|
+
baseUrl: fields?.baseUrl,
|
|
189
177
|
});
|
|
190
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
|
+
}
|
|
191
190
|
_combineLLMOutput() {
|
|
192
191
|
return [];
|
|
193
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;
|
|
@@ -139,12 +139,11 @@ export declare class ChatGoogleGenerativeAI extends BaseChatModel implements Goo
|
|
|
139
139
|
stopSequences: string[];
|
|
140
140
|
safetySettings?: SafetySetting[];
|
|
141
141
|
apiKey?: string;
|
|
142
|
-
apiVersion?: string;
|
|
143
|
-
baseUrl?: string;
|
|
144
142
|
streaming: boolean;
|
|
145
143
|
private client;
|
|
146
144
|
get _isMultimodalModel(): boolean;
|
|
147
145
|
constructor(fields?: GoogleGenerativeAIChatInput);
|
|
146
|
+
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
148
147
|
_combineLLMOutput(): never[];
|
|
149
148
|
_llmType(): string;
|
|
150
149
|
_generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
package/dist/chat_models.js
CHANGED
|
@@ -105,18 +105,6 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
|
105
105
|
writable: true,
|
|
106
106
|
value: void 0
|
|
107
107
|
});
|
|
108
|
-
Object.defineProperty(this, "apiVersion", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
configurable: true,
|
|
111
|
-
writable: true,
|
|
112
|
-
value: "v1"
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(this, "baseUrl", {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
configurable: true,
|
|
117
|
-
writable: true,
|
|
118
|
-
value: "https://generativeai.googleapis.com"
|
|
119
|
-
});
|
|
120
108
|
Object.defineProperty(this, "streaming", {
|
|
121
109
|
enumerable: true,
|
|
122
110
|
configurable: true,
|
|
@@ -181,10 +169,21 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
|
181
169
|
topK: this.topK,
|
|
182
170
|
},
|
|
183
171
|
}, {
|
|
184
|
-
apiVersion:
|
|
185
|
-
baseUrl:
|
|
172
|
+
apiVersion: fields?.apiVersion,
|
|
173
|
+
baseUrl: fields?.baseUrl,
|
|
186
174
|
});
|
|
187
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
|
+
}
|
|
188
187
|
_combineLLMOutput() {
|
|
189
188
|
return [];
|
|
190
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",
|