@langchain/google-vertexai 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 +3 -3
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @langchain/google-vertexai
|
|
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-gauth@2.1.20
|
|
11
|
+
|
|
12
|
+
## 2.1.19
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies []:
|
|
17
|
+
- @langchain/google-gauth@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_gauth = require_rolldown_runtime.__toESM(require("@langchain/google-gauth"));
|
|
1
|
+
let _langchain_google_gauth = require("@langchain/google-gauth");
|
|
3
2
|
|
|
4
3
|
//#region src/chat_models.ts
|
|
5
4
|
/**
|
|
@@ -284,7 +283,7 @@ const __langchain_google_gauth = require_rolldown_runtime.__toESM(require("@lang
|
|
|
284
283
|
*
|
|
285
284
|
* <br />
|
|
286
285
|
*/
|
|
287
|
-
var ChatVertexAI = class extends
|
|
286
|
+
var ChatVertexAI = class extends _langchain_google_gauth.ChatGoogle {
|
|
288
287
|
lc_namespace = [
|
|
289
288
|
"langchain",
|
|
290
289
|
"chat_models",
|
|
@@ -293,7 +292,11 @@ var ChatVertexAI = class extends __langchain_google_gauth.ChatGoogle {
|
|
|
293
292
|
static lc_name() {
|
|
294
293
|
return "ChatVertexAI";
|
|
295
294
|
}
|
|
296
|
-
constructor(
|
|
295
|
+
constructor(modelOrFields, paramsArg) {
|
|
296
|
+
const fields = typeof modelOrFields === "string" ? {
|
|
297
|
+
...paramsArg ?? {},
|
|
298
|
+
model: modelOrFields
|
|
299
|
+
} : modelOrFields ?? {};
|
|
297
300
|
super({
|
|
298
301
|
...fields,
|
|
299
302
|
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-gauth\";\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.\n *\n * Setup:\n * Install `@langchain/google-vertexai` and set your stringified\n * Vertex AI credentials as an environment variable named `GOOGLE_APPLICATION_CREDENTIALS`.\n *\n * ```bash\n * npm install @langchain/google-vertexai\n * export GOOGLE_APPLICATION_CREDENTIALS=\"path/to/credentials\"\n * ```\n *\n * ## [Constructor args](https://api.js.langchain.com/classes/_langchain_google_vertexai.index.ChatVertexAI.html#constructor.new_ChatVertexAI)\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 * // When calling `.withConfig`, call options should be passed via the first argument\n * const llmWithArgsBound = llm.withConfig({\n * stop: [\"\\n\"],\n * tools: [...],\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';\n *\n * const llm = new ChatVertexAI({\n * model: \"gemini-1.5-pro\",\n * temperature: 0,\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, params?: Omit<ChatVertexAIInput, \"model\">);\n constructor(fields?: ChatVertexAIInput);\n constructor(\n modelOrFields?: string | ChatVertexAIInput,\n paramsArg?: Omit<ChatVertexAIInput, \"model\">\n ) {\n const fields =\n typeof modelOrFields === \"string\"\n ? { ...(paramsArg ?? {}), model: modelOrFields }\n : (modelOrFields ?? {});\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiSA,IAAa,eAAb,cAAkCA,mCAAW;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-gauth";
|
|
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
|
*/
|
|
@@ -291,6 +290,7 @@ interface ChatVertexAIInput extends ChatGoogleInput {}
|
|
|
291
290
|
declare class ChatVertexAI extends ChatGoogle {
|
|
292
291
|
lc_namespace: string[];
|
|
293
292
|
static lc_name(): string;
|
|
293
|
+
constructor(model: string, params?: Omit<ChatVertexAIInput, "model">);
|
|
294
294
|
constructor(fields?: ChatVertexAIInput);
|
|
295
295
|
}
|
|
296
296
|
//#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;;;AA4R3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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-gauth";
|
|
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
|
*/
|
|
@@ -291,6 +290,7 @@ interface ChatVertexAIInput extends ChatGoogleInput {}
|
|
|
291
290
|
declare class ChatVertexAI extends ChatGoogle {
|
|
292
291
|
lc_namespace: string[];
|
|
293
292
|
static lc_name(): string;
|
|
293
|
+
constructor(model: string, params?: Omit<ChatVertexAIInput, "model">);
|
|
294
294
|
constructor(fields?: ChatVertexAIInput);
|
|
295
295
|
}
|
|
296
296
|
//#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;;;AA4R3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
@@ -292,7 +292,11 @@ var ChatVertexAI = class extends ChatGoogle {
|
|
|
292
292
|
static lc_name() {
|
|
293
293
|
return "ChatVertexAI";
|
|
294
294
|
}
|
|
295
|
-
constructor(
|
|
295
|
+
constructor(modelOrFields, paramsArg) {
|
|
296
|
+
const fields = typeof modelOrFields === "string" ? {
|
|
297
|
+
...paramsArg ?? {},
|
|
298
|
+
model: modelOrFields
|
|
299
|
+
} : modelOrFields ?? {};
|
|
296
300
|
super({
|
|
297
301
|
...fields,
|
|
298
302
|
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-gauth\";\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.\n *\n * Setup:\n * Install `@langchain/google-vertexai` and set your stringified\n * Vertex AI credentials as an environment variable named `GOOGLE_APPLICATION_CREDENTIALS`.\n *\n * ```bash\n * npm install @langchain/google-vertexai\n * export GOOGLE_APPLICATION_CREDENTIALS=\"path/to/credentials\"\n * ```\n *\n * ## [Constructor args](https://api.js.langchain.com/classes/_langchain_google_vertexai.index.ChatVertexAI.html#constructor.new_ChatVertexAI)\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 * // When calling `.withConfig`, call options should be passed via the first argument\n * const llmWithArgsBound = llm.withConfig({\n * stop: [\"\\n\"],\n * tools: [...],\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';\n *\n * const llm = new ChatVertexAI({\n * model: \"gemini-1.5-pro\",\n * temperature: 0,\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, params?: Omit<ChatVertexAIInput, \"model\">);\n constructor(fields?: ChatVertexAIInput);\n constructor(\n modelOrFields?: string | ChatVertexAIInput,\n paramsArg?: Omit<ChatVertexAIInput, \"model\">\n ) {\n const fields =\n typeof modelOrFields === \"string\"\n ? { ...(paramsArg ?? {}), model: modelOrFields }\n : (modelOrFields ?? {});\n super({\n ...fields,\n platformType: \"gcp\",\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiSA,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_gauth = require_rolldown_runtime.__toESM(require("@langchain/google-gauth"));
|
|
1
|
+
let _langchain_google_gauth = require("@langchain/google-gauth");
|
|
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-gauth" package for auth.
|
|
8
7
|
*/
|
|
9
|
-
var VertexAIEmbeddings = class extends
|
|
8
|
+
var VertexAIEmbeddings = class extends _langchain_google_gauth.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-gauth\";\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-gauth\" 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,yCAAiB;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-gauth\";\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-gauth\" 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_gauth = require_rolldown_runtime.__toESM(require("@langchain/google-gauth"));
|
|
1
|
+
let _langchain_google_gauth = require("@langchain/google-gauth");
|
|
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-gauth" package for auth.
|
|
8
7
|
*/
|
|
9
|
-
var VertexAI = class extends
|
|
8
|
+
var VertexAI = class extends _langchain_google_gauth.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-gauth\";\n\n/**\n * Input to a Google Vertex AI LLM class.\n */\nexport interface VertexAIInput extends GoogleLLMInput {}\n\n/**\n * Integration with a Google Vertex AI LLM using\n * the \"@langchain/google-gauth\" 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,kCAAU;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-gauth\";\n\n/**\n * Input to a Google Vertex AI LLM class.\n */\nexport interface VertexAIInput extends GoogleLLMInput {}\n\n/**\n * Integration with a Google Vertex AI LLM using\n * the \"@langchain/google-gauth\" 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_gauth_types = require("@langchain/google-gauth/types");
|
|
4
|
+
Object.keys(_langchain_google_gauth_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_gauth_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_gauth_utils = require("@langchain/google-gauth/utils");
|
|
4
|
+
Object.keys(_langchain_google_gauth_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_gauth_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",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.20",
|
|
4
4
|
"description": "LangChain.js support for Google Vertex AI",
|
|
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/",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@langchain/google-gauth": "2.1.
|
|
17
|
+
"@langchain/google-gauth": "2.1.20"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@jest/globals": "^30.2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "~5.8.3",
|
|
32
32
|
"zod": "^3.25.76",
|
|
33
33
|
"@langchain/eslint": "0.1.1",
|
|
34
|
-
"@langchain/google-common": "2.1.
|
|
34
|
+
"@langchain/google-common": "2.1.20",
|
|
35
35
|
"@langchain/standard-tests": "0.0.23",
|
|
36
36
|
"@langchain/tsconfig": "0.0.1"
|
|
37
37
|
},
|
|
@@ -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;
|