@langchain/google-vertexai-web 2.1.18 → 2.1.20
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/CHANGELOG.md +16 -0
- package/dist/chat_models.cjs +7 -4
- package/dist/chat_models.cjs.map +1 -1
- package/dist/chat_models.d.cts +1 -1
- package/dist/chat_models.d.cts.map +1 -1
- package/dist/chat_models.d.ts +1 -1
- package/dist/chat_models.d.ts.map +1 -1
- package/dist/chat_models.js +5 -1
- package/dist/chat_models.js.map +1 -1
- package/dist/embeddings.cjs +2 -3
- package/dist/embeddings.cjs.map +1 -1
- package/dist/embeddings.d.cts +0 -1
- package/dist/embeddings.d.cts.map +1 -1
- package/dist/embeddings.d.ts +0 -1
- package/dist/embeddings.d.ts.map +1 -1
- package/dist/embeddings.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/llms.cjs +2 -3
- package/dist/llms.cjs.map +1 -1
- package/dist/llms.d.cts +0 -1
- package/dist/llms.d.cts.map +1 -1
- package/dist/llms.d.ts +0 -1
- package/dist/llms.d.ts.map +1 -1
- package/dist/llms.js.map +1 -1
- package/dist/types.cjs +3 -3
- package/dist/types.js +2 -0
- package/dist/utils.cjs +3 -3
- package/dist/utils.js +2 -0
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @langchain/google-vertexai-web
|
|
2
2
|
|
|
3
|
+
## 2.1.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#10080](https://github.com/langchain-ai/langchainjs/pull/10080) [`b583729`](https://github.com/langchain-ai/langchainjs/commit/b583729e99cf0c035630f6b311c4d069a1980cca) Thanks [@hntrl](https://github.com/hntrl)! - Add string-model constructor overloads for chat models (with supporting tests where applicable).
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`b583729`](https://github.com/langchain-ai/langchainjs/commit/b583729e99cf0c035630f6b311c4d069a1980cca)]:
|
|
10
|
+
- @langchain/google-webauth@2.1.20
|
|
11
|
+
|
|
12
|
+
## 2.1.19
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies []:
|
|
17
|
+
- @langchain/google-webauth@2.1.19
|
|
18
|
+
|
|
3
19
|
## 2.1.18
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/chat_models.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const __langchain_google_webauth = require_rolldown_runtime.__toESM(require("@langchain/google-webauth"));
|
|
1
|
+
let _langchain_google_webauth = require("@langchain/google-webauth");
|
|
3
2
|
|
|
4
3
|
//#region src/chat_models.ts
|
|
5
4
|
/**
|
|
@@ -287,7 +286,7 @@ const __langchain_google_webauth = require_rolldown_runtime.__toESM(require("@la
|
|
|
287
286
|
*
|
|
288
287
|
* <br />
|
|
289
288
|
*/
|
|
290
|
-
var ChatVertexAI = class extends
|
|
289
|
+
var ChatVertexAI = class extends _langchain_google_webauth.ChatGoogle {
|
|
291
290
|
lc_namespace = [
|
|
292
291
|
"langchain",
|
|
293
292
|
"chat_models",
|
|
@@ -296,7 +295,11 @@ var ChatVertexAI = class extends __langchain_google_webauth.ChatGoogle {
|
|
|
296
295
|
static lc_name() {
|
|
297
296
|
return "ChatVertexAI";
|
|
298
297
|
}
|
|
299
|
-
constructor(
|
|
298
|
+
constructor(modelOrFields, fieldsArg) {
|
|
299
|
+
const fields = typeof modelOrFields === "string" ? {
|
|
300
|
+
...fieldsArg ?? {},
|
|
301
|
+
model: modelOrFields
|
|
302
|
+
} : modelOrFields ?? {};
|
|
300
303
|
super({
|
|
301
304
|
...fields,
|
|
302
305
|
platformType: "gcp"
|
package/dist/chat_models.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_models.cjs","names":["ChatGoogle"
|
|
1
|
+
{"version":3,"file":"chat_models.cjs","names":["ChatGoogle"],"sources":["../src/chat_models.ts"],"sourcesContent":["import { type ChatGoogleInput, ChatGoogle } from \"@langchain/google-webauth\";\n\n/**\n * Input to a Google Vertex AI chat model class.\n */\nexport interface ChatVertexAIInput extends ChatGoogleInput {}\n\n/**\n * Integration with Google Vertex AI chat models in web environments.\n *\n * Setup:\n * Install `@langchain/google-vertexai-web` and set your stringified\n * Vertex AI credentials as an environment variable named `GOOGLE_VERTEX_AI_WEB_CREDENTIALS`.\n *\n * ```bash\n * npm install @langchain/google-vertexai-web\n * export GOOGLE_VERTEX_AI_WEB_CREDENTIALS={\"type\":\"service_account\",\"project_id\":\"YOUR_PROJECT-12345\",...}\n * ```\n *\n * ## [Constructor args](https://api.js.langchain.com/classes/_langchain_google_vertexai_web.index.ChatVertexAI.html#constructor)\n *\n * ## [Runtime args](https://api.js.langchain.com/interfaces/langchain_google_common_types.GoogleAIBaseLanguageModelCallOptions.html)\n *\n * Runtime args can be passed as the second argument to any of the base runnable methods `.invoke`. `.stream`, `.batch`, etc.\n * They can also be passed via `.withConfig`, or the second arg in `.bindTools`, like shown in the examples below:\n *\n * ```typescript\n * // If binding tools along with other options, chain `.bindTools` and `.withConfig`\n * const llmWithArgsBound = llm.bindTools([...]) // tools array\n * .withConfig({\n * stop: [\"\\n\"], // other call options\n * });\n *\n * // When calling `.bindTools`, call options should be passed via the second argument\n * const llmWithTools = llm.bindTools(\n * [...],\n * {\n * tool_choice: \"auto\",\n * }\n * );\n * ```\n *\n * ## Examples\n *\n * <details open>\n * <summary><strong>Instantiate</strong></summary>\n *\n * ```typescript\n * import { ChatVertexAI } from '@langchain/google-vertexai-web';\n *\n * const llm = new ChatVertexAI({\n * model: \"gemini-1.5-pro\",\n * temperature: 0,\n * authOptions: {\n * credentials: process.env.GOOGLE_VERTEX_AI_WEB_CREDENTIALS,\n * },\n * // other params...\n * });\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Invoking</strong></summary>\n *\n * ```typescript\n * const input = `Translate \"I love programming\" into French.`;\n *\n * // Models also accept a list of chat messages or a formatted prompt\n * const result = await llm.invoke(input);\n * console.log(result);\n * ```\n *\n * ```txt\n * AIMessageChunk {\n * \"content\": \"\\\"J'adore programmer\\\" \\n\\nHere's why this is the best translation:\\n\\n* **J'adore** means \\\"I love\\\" and conveys a strong passion.\\n* **Programmer** is the French verb for \\\"to program.\\\"\\n\\nThis translation is natural and idiomatic in French. \\n\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": [],\n * \"usage_metadata\": {\n * \"input_tokens\": 9,\n * \"output_tokens\": 63,\n * \"total_tokens\": 72\n * }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Streaming Chunks</strong></summary>\n *\n * ```typescript\n * for await (const chunk of await llm.stream(input)) {\n * console.log(chunk);\n * }\n * ```\n *\n * ```txt\n * AIMessageChunk {\n * \"content\": \"\\\"\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n * \"content\": \"J'adore programmer\\\" \\n\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n * \"content\": \"\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n * \"content\": \"\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {\n * \"finishReason\": \"stop\"\n * },\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": [],\n * \"usage_metadata\": {\n * \"input_tokens\": 9,\n * \"output_tokens\": 8,\n * \"total_tokens\": 17\n * }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Aggregate Streamed Chunks</strong></summary>\n *\n * ```typescript\n * import { AIMessageChunk } from '@langchain/core/messages';\n * import { concat } from '@langchain/core/utils/stream';\n *\n * const stream = await llm.stream(input);\n * let full: AIMessageChunk | undefined;\n * for await (const chunk of stream) {\n * full = !full ? chunk : concat(full, chunk);\n * }\n * console.log(full);\n * ```\n *\n * ```txt\n * AIMessageChunk {\n * \"content\": \"\\\"J'adore programmer\\\" \\n\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {\n * \"finishReason\": \"stop\"\n * },\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": [],\n * \"usage_metadata\": {\n * \"input_tokens\": 9,\n * \"output_tokens\": 8,\n * \"total_tokens\": 17\n * }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Bind tools</strong></summary>\n *\n * ```typescript\n * import { z } from 'zod';\n *\n * const GetWeather = {\n * name: \"GetWeather\",\n * description: \"Get the current weather in a given location\",\n * schema: z.object({\n * location: z.string().describe(\"The city and state, e.g. San Francisco, CA\")\n * }),\n * }\n *\n * const GetPopulation = {\n * name: \"GetPopulation\",\n * description: \"Get the current population in a given location\",\n * schema: z.object({\n * location: z.string().describe(\"The city and state, e.g. San Francisco, CA\")\n * }),\n * }\n *\n * const llmWithTools = llm.bindTools([GetWeather, GetPopulation]);\n * const aiMsg = await llmWithTools.invoke(\n * \"Which city is hotter today and which is bigger: LA or NY?\"\n * );\n * console.log(aiMsg.tool_calls);\n * ```\n *\n * ```txt\n * [\n * {\n * name: 'GetPopulation',\n * args: { location: 'New York City, NY' },\n * id: '33c1c1f47e2f492799c77d2800a43912',\n * type: 'tool_call'\n * }\n * ]\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Structured Output</strong></summary>\n *\n * ```typescript\n * import { z } from 'zod';\n *\n * const Joke = z.object({\n * setup: z.string().describe(\"The setup of the joke\"),\n * punchline: z.string().describe(\"The punchline to the joke\"),\n * rating: z.number().optional().describe(\"How funny the joke is, from 1 to 10\")\n * }).describe('Joke to tell user.');\n *\n * const structuredLlm = llm.withStructuredOutput(Joke, { name: \"Joke\" });\n * const jokeResult = await structuredLlm.invoke(\"Tell me a joke about cats\");\n * console.log(jokeResult);\n * ```\n *\n * ```txt\n * {\n * setup: 'What do you call a cat that loves to bowl?',\n * punchline: 'An alley cat!'\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Usage Metadata</strong></summary>\n *\n * ```typescript\n * const aiMsgForMetadata = await llm.invoke(input);\n * console.log(aiMsgForMetadata.usage_metadata);\n * ```\n *\n * ```txt\n * { input_tokens: 9, output_tokens: 8, total_tokens: 17 }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Stream Usage Metadata</strong></summary>\n *\n * ```typescript\n * const streamForMetadata = await llm.stream(\n * input,\n * {\n * streamUsage: true\n * }\n * );\n * let fullForMetadata: AIMessageChunk | undefined;\n * for await (const chunk of streamForMetadata) {\n * fullForMetadata = !fullForMetadata ? chunk : concat(fullForMetadata, chunk);\n * }\n * console.log(fullForMetadata?.usage_metadata);\n * ```\n *\n * ```txt\n * { input_tokens: 9, output_tokens: 8, total_tokens: 17 }\n * ```\n * </details>\n *\n * <br />\n */\nexport class ChatVertexAI extends ChatGoogle {\n lc_namespace = [\"langchain\", \"chat_models\", \"vertexai\"];\n\n static lc_name() {\n return \"ChatVertexAI\";\n }\n\n constructor(model: string, fields?: Omit<ChatVertexAIInput, \"model\">);\n constructor(fields?: ChatVertexAIInput);\n constructor(\n modelOrFields?: string | ChatVertexAIInput,\n fieldsArg?: Omit<ChatVertexAIInput, \"model\">\n ) {\n const fields =\n typeof modelOrFields === \"string\"\n ? { ...(fieldsArg ?? {}), model: modelOrFields }\n : (modelOrFields ?? {});\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoSA,IAAa,eAAb,cAAkCA,qCAAW;CAC3C,eAAe;EAAC;EAAa;EAAe;EAAW;CAEvD,OAAO,UAAU;AACf,SAAO;;CAKT,YACE,eACA,WACA;EACA,MAAM,SACJ,OAAO,kBAAkB,WACrB;GAAE,GAAI,aAAa,EAAE;GAAG,OAAO;GAAe,GAC7C,iBAAiB,EAAE;AAC1B,QAAM;GACJ,GAAG;GACH,cAAc;GACf,CAAC"}
|
package/dist/chat_models.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ChatGoogle, ChatGoogleInput } from "@langchain/google-webauth";
|
|
2
2
|
|
|
3
3
|
//#region src/chat_models.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Input to a Google Vertex AI chat model class.
|
|
7
6
|
*/
|
|
@@ -294,6 +293,7 @@ interface ChatVertexAIInput extends ChatGoogleInput {}
|
|
|
294
293
|
declare class ChatVertexAI extends ChatGoogle {
|
|
295
294
|
lc_namespace: string[];
|
|
296
295
|
static lc_name(): string;
|
|
296
|
+
constructor(model: string, fields?: Omit<ChatVertexAIInput, "model">);
|
|
297
297
|
constructor(fields?: ChatVertexAIInput);
|
|
298
298
|
}
|
|
299
299
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_models.d.cts","names":[
|
|
1
|
+
{"version":3,"file":"chat_models.d.cts","names":[],"sources":["../src/chat_models.ts"],"mappings":";;;;;AAKA;UAAiB,iBAAA,SAA0B,eAAA;;;AA+R3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,YAAA,SAAqB,UAAA;EAChC,YAAA;EAAA,OAEO,OAAA,CAAA;EAIP,WAAA,CAAY,KAAA,UAAe,MAAA,GAAS,IAAA,CAAK,iBAAA;EACzC,WAAA,CAAY,MAAA,GAAS,iBAAA;AAAA"}
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ChatGoogle, ChatGoogleInput } from "@langchain/google-webauth";
|
|
2
2
|
|
|
3
3
|
//#region src/chat_models.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Input to a Google Vertex AI chat model class.
|
|
7
6
|
*/
|
|
@@ -294,6 +293,7 @@ interface ChatVertexAIInput extends ChatGoogleInput {}
|
|
|
294
293
|
declare class ChatVertexAI extends ChatGoogle {
|
|
295
294
|
lc_namespace: string[];
|
|
296
295
|
static lc_name(): string;
|
|
296
|
+
constructor(model: string, fields?: Omit<ChatVertexAIInput, "model">);
|
|
297
297
|
constructor(fields?: ChatVertexAIInput);
|
|
298
298
|
}
|
|
299
299
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_models.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"chat_models.d.ts","names":[],"sources":["../src/chat_models.ts"],"mappings":";;;;;AAKA;UAAiB,iBAAA,SAA0B,eAAA;;;AA+R3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,YAAA,SAAqB,UAAA;EAChC,YAAA;EAAA,OAEO,OAAA,CAAA;EAIP,WAAA,CAAY,KAAA,UAAe,MAAA,GAAS,IAAA,CAAK,iBAAA;EACzC,WAAA,CAAY,MAAA,GAAS,iBAAA;AAAA"}
|
package/dist/chat_models.js
CHANGED
|
@@ -295,7 +295,11 @@ var ChatVertexAI = class extends ChatGoogle {
|
|
|
295
295
|
static lc_name() {
|
|
296
296
|
return "ChatVertexAI";
|
|
297
297
|
}
|
|
298
|
-
constructor(
|
|
298
|
+
constructor(modelOrFields, fieldsArg) {
|
|
299
|
+
const fields = typeof modelOrFields === "string" ? {
|
|
300
|
+
...fieldsArg ?? {},
|
|
301
|
+
model: modelOrFields
|
|
302
|
+
} : modelOrFields ?? {};
|
|
299
303
|
super({
|
|
300
304
|
...fields,
|
|
301
305
|
platformType: "gcp"
|
package/dist/chat_models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_models.js","names":[
|
|
1
|
+
{"version":3,"file":"chat_models.js","names":[],"sources":["../src/chat_models.ts"],"sourcesContent":["import { type ChatGoogleInput, ChatGoogle } from \"@langchain/google-webauth\";\n\n/**\n * Input to a Google Vertex AI chat model class.\n */\nexport interface ChatVertexAIInput extends ChatGoogleInput {}\n\n/**\n * Integration with Google Vertex AI chat models in web environments.\n *\n * Setup:\n * Install `@langchain/google-vertexai-web` and set your stringified\n * Vertex AI credentials as an environment variable named `GOOGLE_VERTEX_AI_WEB_CREDENTIALS`.\n *\n * ```bash\n * npm install @langchain/google-vertexai-web\n * export GOOGLE_VERTEX_AI_WEB_CREDENTIALS={\"type\":\"service_account\",\"project_id\":\"YOUR_PROJECT-12345\",...}\n * ```\n *\n * ## [Constructor args](https://api.js.langchain.com/classes/_langchain_google_vertexai_web.index.ChatVertexAI.html#constructor)\n *\n * ## [Runtime args](https://api.js.langchain.com/interfaces/langchain_google_common_types.GoogleAIBaseLanguageModelCallOptions.html)\n *\n * Runtime args can be passed as the second argument to any of the base runnable methods `.invoke`. `.stream`, `.batch`, etc.\n * They can also be passed via `.withConfig`, or the second arg in `.bindTools`, like shown in the examples below:\n *\n * ```typescript\n * // If binding tools along with other options, chain `.bindTools` and `.withConfig`\n * const llmWithArgsBound = llm.bindTools([...]) // tools array\n * .withConfig({\n * stop: [\"\\n\"], // other call options\n * });\n *\n * // When calling `.bindTools`, call options should be passed via the second argument\n * const llmWithTools = llm.bindTools(\n * [...],\n * {\n * tool_choice: \"auto\",\n * }\n * );\n * ```\n *\n * ## Examples\n *\n * <details open>\n * <summary><strong>Instantiate</strong></summary>\n *\n * ```typescript\n * import { ChatVertexAI } from '@langchain/google-vertexai-web';\n *\n * const llm = new ChatVertexAI({\n * model: \"gemini-1.5-pro\",\n * temperature: 0,\n * authOptions: {\n * credentials: process.env.GOOGLE_VERTEX_AI_WEB_CREDENTIALS,\n * },\n * // other params...\n * });\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Invoking</strong></summary>\n *\n * ```typescript\n * const input = `Translate \"I love programming\" into French.`;\n *\n * // Models also accept a list of chat messages or a formatted prompt\n * const result = await llm.invoke(input);\n * console.log(result);\n * ```\n *\n * ```txt\n * AIMessageChunk {\n * \"content\": \"\\\"J'adore programmer\\\" \\n\\nHere's why this is the best translation:\\n\\n* **J'adore** means \\\"I love\\\" and conveys a strong passion.\\n* **Programmer** is the French verb for \\\"to program.\\\"\\n\\nThis translation is natural and idiomatic in French. \\n\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": [],\n * \"usage_metadata\": {\n * \"input_tokens\": 9,\n * \"output_tokens\": 63,\n * \"total_tokens\": 72\n * }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Streaming Chunks</strong></summary>\n *\n * ```typescript\n * for await (const chunk of await llm.stream(input)) {\n * console.log(chunk);\n * }\n * ```\n *\n * ```txt\n * AIMessageChunk {\n * \"content\": \"\\\"\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n * \"content\": \"J'adore programmer\\\" \\n\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n * \"content\": \"\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {},\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n * \"content\": \"\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {\n * \"finishReason\": \"stop\"\n * },\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": [],\n * \"usage_metadata\": {\n * \"input_tokens\": 9,\n * \"output_tokens\": 8,\n * \"total_tokens\": 17\n * }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Aggregate Streamed Chunks</strong></summary>\n *\n * ```typescript\n * import { AIMessageChunk } from '@langchain/core/messages';\n * import { concat } from '@langchain/core/utils/stream';\n *\n * const stream = await llm.stream(input);\n * let full: AIMessageChunk | undefined;\n * for await (const chunk of stream) {\n * full = !full ? chunk : concat(full, chunk);\n * }\n * console.log(full);\n * ```\n *\n * ```txt\n * AIMessageChunk {\n * \"content\": \"\\\"J'adore programmer\\\" \\n\",\n * \"additional_kwargs\": {},\n * \"response_metadata\": {\n * \"finishReason\": \"stop\"\n * },\n * \"tool_calls\": [],\n * \"tool_call_chunks\": [],\n * \"invalid_tool_calls\": [],\n * \"usage_metadata\": {\n * \"input_tokens\": 9,\n * \"output_tokens\": 8,\n * \"total_tokens\": 17\n * }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Bind tools</strong></summary>\n *\n * ```typescript\n * import { z } from 'zod';\n *\n * const GetWeather = {\n * name: \"GetWeather\",\n * description: \"Get the current weather in a given location\",\n * schema: z.object({\n * location: z.string().describe(\"The city and state, e.g. San Francisco, CA\")\n * }),\n * }\n *\n * const GetPopulation = {\n * name: \"GetPopulation\",\n * description: \"Get the current population in a given location\",\n * schema: z.object({\n * location: z.string().describe(\"The city and state, e.g. San Francisco, CA\")\n * }),\n * }\n *\n * const llmWithTools = llm.bindTools([GetWeather, GetPopulation]);\n * const aiMsg = await llmWithTools.invoke(\n * \"Which city is hotter today and which is bigger: LA or NY?\"\n * );\n * console.log(aiMsg.tool_calls);\n * ```\n *\n * ```txt\n * [\n * {\n * name: 'GetPopulation',\n * args: { location: 'New York City, NY' },\n * id: '33c1c1f47e2f492799c77d2800a43912',\n * type: 'tool_call'\n * }\n * ]\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Structured Output</strong></summary>\n *\n * ```typescript\n * import { z } from 'zod';\n *\n * const Joke = z.object({\n * setup: z.string().describe(\"The setup of the joke\"),\n * punchline: z.string().describe(\"The punchline to the joke\"),\n * rating: z.number().optional().describe(\"How funny the joke is, from 1 to 10\")\n * }).describe('Joke to tell user.');\n *\n * const structuredLlm = llm.withStructuredOutput(Joke, { name: \"Joke\" });\n * const jokeResult = await structuredLlm.invoke(\"Tell me a joke about cats\");\n * console.log(jokeResult);\n * ```\n *\n * ```txt\n * {\n * setup: 'What do you call a cat that loves to bowl?',\n * punchline: 'An alley cat!'\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Usage Metadata</strong></summary>\n *\n * ```typescript\n * const aiMsgForMetadata = await llm.invoke(input);\n * console.log(aiMsgForMetadata.usage_metadata);\n * ```\n *\n * ```txt\n * { input_tokens: 9, output_tokens: 8, total_tokens: 17 }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Stream Usage Metadata</strong></summary>\n *\n * ```typescript\n * const streamForMetadata = await llm.stream(\n * input,\n * {\n * streamUsage: true\n * }\n * );\n * let fullForMetadata: AIMessageChunk | undefined;\n * for await (const chunk of streamForMetadata) {\n * fullForMetadata = !fullForMetadata ? chunk : concat(fullForMetadata, chunk);\n * }\n * console.log(fullForMetadata?.usage_metadata);\n * ```\n *\n * ```txt\n * { input_tokens: 9, output_tokens: 8, total_tokens: 17 }\n * ```\n * </details>\n *\n * <br />\n */\nexport class ChatVertexAI extends ChatGoogle {\n lc_namespace = [\"langchain\", \"chat_models\", \"vertexai\"];\n\n static lc_name() {\n return \"ChatVertexAI\";\n }\n\n constructor(model: string, fields?: Omit<ChatVertexAIInput, \"model\">);\n constructor(fields?: ChatVertexAIInput);\n constructor(\n modelOrFields?: string | ChatVertexAIInput,\n fieldsArg?: Omit<ChatVertexAIInput, \"model\">\n ) {\n const fields =\n typeof modelOrFields === \"string\"\n ? { ...(fieldsArg ?? {}), model: modelOrFields }\n : (modelOrFields ?? {});\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoSA,IAAa,eAAb,cAAkC,WAAW;CAC3C,eAAe;EAAC;EAAa;EAAe;EAAW;CAEvD,OAAO,UAAU;AACf,SAAO;;CAKT,YACE,eACA,WACA;EACA,MAAM,SACJ,OAAO,kBAAkB,WACrB;GAAE,GAAI,aAAa,EAAE;GAAG,OAAO;GAAe,GAC7C,iBAAiB,EAAE;AAC1B,QAAM;GACJ,GAAG;GACH,cAAc;GACf,CAAC"}
|
package/dist/embeddings.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
const __langchain_google_webauth = require_rolldown_runtime.__toESM(require("@langchain/google-webauth"));
|
|
1
|
+
let _langchain_google_webauth = require("@langchain/google-webauth");
|
|
3
2
|
|
|
4
3
|
//#region src/embeddings.ts
|
|
5
4
|
/**
|
|
6
5
|
* Integration with a Google Vertex AI embeddings model using
|
|
7
6
|
* the "@langchain/google-webauth" package for auth.
|
|
8
7
|
*/
|
|
9
|
-
var VertexAIEmbeddings = class extends
|
|
8
|
+
var VertexAIEmbeddings = class extends _langchain_google_webauth.GoogleEmbeddings {
|
|
10
9
|
static lc_name() {
|
|
11
10
|
return "VertexAIEmbeddings";
|
|
12
11
|
}
|
package/dist/embeddings.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.cjs","names":["GoogleEmbeddings"
|
|
1
|
+
{"version":3,"file":"embeddings.cjs","names":["GoogleEmbeddings"],"sources":["../src/embeddings.ts"],"sourcesContent":["import {\n type GoogleEmbeddingsInput,\n GoogleEmbeddings,\n} from \"@langchain/google-webauth\";\n\n/**\n * Input to a Google Vertex AI embeddings class.\n */\nexport interface GoogleVertexAIEmbeddingsInput extends GoogleEmbeddingsInput {}\n\n/**\n * Integration with a Google Vertex AI embeddings model using\n * the \"@langchain/google-webauth\" package for auth.\n */\nexport class VertexAIEmbeddings extends GoogleEmbeddings {\n static lc_name() {\n return \"VertexAIEmbeddings\";\n }\n\n constructor(fields: GoogleVertexAIEmbeddingsInput) {\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;AAcA,IAAa,qBAAb,cAAwCA,2CAAiB;CACvD,OAAO,UAAU;AACf,SAAO;;CAGT,YAAY,QAAuC;AACjD,QAAM;GACJ,GAAG;GACH,cAAc;GACf,CAAC"}
|
package/dist/embeddings.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.d.cts","names":[
|
|
1
|
+
{"version":3,"file":"embeddings.d.cts","names":[],"sources":["../src/embeddings.ts"],"mappings":";;;;;AAQA;UAAiB,6BAAA,SAAsC,qBAAA;;;AAMvD;;cAAa,kBAAA,SAA2B,gBAAA;EAAA,OAC/B,OAAA,CAAA;EAIP,WAAA,CAAY,MAAA,EAAQ,6BAAA;AAAA"}
|
package/dist/embeddings.d.ts
CHANGED
package/dist/embeddings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"embeddings.d.ts","names":[],"sources":["../src/embeddings.ts"],"mappings":";;;;;AAQA;UAAiB,6BAAA,SAAsC,qBAAA;;;AAMvD;;cAAa,kBAAA,SAA2B,gBAAA;EAAA,OAC/B,OAAA,CAAA;EAIP,WAAA,CAAY,MAAA,EAAQ,6BAAA;AAAA"}
|
package/dist/embeddings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.js","names":[
|
|
1
|
+
{"version":3,"file":"embeddings.js","names":[],"sources":["../src/embeddings.ts"],"sourcesContent":["import {\n type GoogleEmbeddingsInput,\n GoogleEmbeddings,\n} from \"@langchain/google-webauth\";\n\n/**\n * Input to a Google Vertex AI embeddings class.\n */\nexport interface GoogleVertexAIEmbeddingsInput extends GoogleEmbeddingsInput {}\n\n/**\n * Integration with a Google Vertex AI embeddings model using\n * the \"@langchain/google-webauth\" package for auth.\n */\nexport class VertexAIEmbeddings extends GoogleEmbeddings {\n static lc_name() {\n return \"VertexAIEmbeddings\";\n }\n\n constructor(fields: GoogleVertexAIEmbeddingsInput) {\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;AAcA,IAAa,qBAAb,cAAwC,iBAAiB;CACvD,OAAO,UAAU;AACf,SAAO;;CAGT,YAAY,QAAuC;AACjD,QAAM;GACJ,GAAG;GACH,cAAc;GACf,CAAC"}
|
package/dist/index.cjs
CHANGED
package/dist/llms.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
const __langchain_google_webauth = require_rolldown_runtime.__toESM(require("@langchain/google-webauth"));
|
|
1
|
+
let _langchain_google_webauth = require("@langchain/google-webauth");
|
|
3
2
|
|
|
4
3
|
//#region src/llms.ts
|
|
5
4
|
/**
|
|
6
5
|
* Integration with a Google Vertex AI LLM using
|
|
7
6
|
* the "@langchain/google-webauth" package for auth.
|
|
8
7
|
*/
|
|
9
|
-
var VertexAI = class extends
|
|
8
|
+
var VertexAI = class extends _langchain_google_webauth.GoogleLLM {
|
|
10
9
|
lc_namespace = [
|
|
11
10
|
"langchain",
|
|
12
11
|
"llms",
|
package/dist/llms.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llms.cjs","names":["GoogleLLM"
|
|
1
|
+
{"version":3,"file":"llms.cjs","names":["GoogleLLM"],"sources":["../src/llms.ts"],"sourcesContent":["import { type GoogleLLMInput, GoogleLLM } from \"@langchain/google-webauth\";\n\n/**\n * Input to a Google Vertex LLM class.\n */\nexport interface VertexAIInput extends GoogleLLMInput {}\n\n/**\n * Integration with a Google Vertex AI LLM using\n * the \"@langchain/google-webauth\" package for auth.\n */\nexport class VertexAI extends GoogleLLM {\n lc_namespace = [\"langchain\", \"llms\", \"vertexai\"];\n\n static lc_name() {\n return \"VertexAI\";\n }\n\n constructor(fields?: VertexAIInput) {\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAa,WAAb,cAA8BA,oCAAU;CACtC,eAAe;EAAC;EAAa;EAAQ;EAAW;CAEhD,OAAO,UAAU;AACf,SAAO;;CAGT,YAAY,QAAwB;AAClC,QAAM;GACJ,GAAG;GACH,cAAc;GACf,CAAC"}
|
package/dist/llms.d.cts
CHANGED
package/dist/llms.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llms.d.cts","names":[
|
|
1
|
+
{"version":3,"file":"llms.d.cts","names":[],"sources":["../src/llms.ts"],"mappings":";;;;;AAKA;UAAiB,aAAA,SAAsB,cAAA;;;AAMvC;;cAAa,QAAA,SAAiB,SAAA;EAC5B,YAAA;EAAA,OAEO,OAAA,CAAA;EAIP,WAAA,CAAY,MAAA,GAAS,aAAA;AAAA"}
|
package/dist/llms.d.ts
CHANGED
package/dist/llms.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llms.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"llms.d.ts","names":[],"sources":["../src/llms.ts"],"mappings":";;;;;AAKA;UAAiB,aAAA,SAAsB,cAAA;;;AAMvC;;cAAa,QAAA,SAAiB,SAAA;EAC5B,YAAA;EAAA,OAEO,OAAA,CAAA;EAIP,WAAA,CAAY,MAAA,GAAS,aAAA;AAAA"}
|
package/dist/llms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llms.js","names":[
|
|
1
|
+
{"version":3,"file":"llms.js","names":[],"sources":["../src/llms.ts"],"sourcesContent":["import { type GoogleLLMInput, GoogleLLM } from \"@langchain/google-webauth\";\n\n/**\n * Input to a Google Vertex LLM class.\n */\nexport interface VertexAIInput extends GoogleLLMInput {}\n\n/**\n * Integration with a Google Vertex AI LLM using\n * the \"@langchain/google-webauth\" package for auth.\n */\nexport class VertexAI extends GoogleLLM {\n lc_namespace = [\"langchain\", \"llms\", \"vertexai\"];\n\n static lc_name() {\n return \"VertexAI\";\n }\n\n constructor(fields?: VertexAIInput) {\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAa,WAAb,cAA8B,UAAU;CACtC,eAAe;EAAC;EAAa;EAAQ;EAAW;CAEhD,OAAO,UAAU;AACf,SAAO;;CAGT,YAAY,QAAwB;AAClC,QAAM;GACJ,GAAG;GACH,cAAc;GACf,CAAC"}
|
package/dist/types.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
Object.keys(
|
|
3
|
+
var _langchain_google_webauth_types = require("@langchain/google-webauth/types");
|
|
4
|
+
Object.keys(_langchain_google_webauth_types).forEach(function (k) {
|
|
5
5
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: function () { return
|
|
7
|
+
get: function () { return _langchain_google_webauth_types[k]; }
|
|
8
8
|
});
|
|
9
9
|
});
|
package/dist/types.js
CHANGED
package/dist/utils.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
Object.keys(
|
|
3
|
+
var _langchain_google_webauth_utils = require("@langchain/google-webauth/utils");
|
|
4
|
+
Object.keys(_langchain_google_webauth_utils).forEach(function (k) {
|
|
5
5
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: function () { return
|
|
7
|
+
get: function () { return _langchain_google_webauth_utils[k]; }
|
|
8
8
|
});
|
|
9
9
|
});
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/google-vertexai-web",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.20",
|
|
4
4
|
"description": "LangChain.js support for Google Vertex AI Web",
|
|
5
5
|
"author": "LangChain",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-vertexai-web/",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@langchain/google-webauth": "2.1.
|
|
17
|
+
"@langchain/google-webauth": "2.1.20"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@jest/globals": "^30.2.0",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"ts-jest": "^29.4.6",
|
|
31
31
|
"typescript": "~5.8.3",
|
|
32
32
|
"zod": "^3.25.76",
|
|
33
|
-
"@langchain/google-common": "2.1.18",
|
|
34
33
|
"@langchain/eslint": "0.1.1",
|
|
35
|
-
"@langchain/
|
|
36
|
-
"@langchain/standard-tests": "0.0.23"
|
|
34
|
+
"@langchain/google-common": "2.1.20",
|
|
35
|
+
"@langchain/standard-tests": "0.0.23",
|
|
36
|
+
"@langchain/tsconfig": "0.0.1"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
|
|
25
|
-
exports.__toESM = __toESM;
|