langchain 0.3.33 → 0.3.35
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/README.md +2 -4
- package/dist/cache/file_system.cjs +2 -2
- package/dist/cache/file_system.js +3 -3
- package/dist/chat_models/universal.cjs +26 -4
- package/dist/chat_models/universal.d.ts +1 -1
- package/dist/chat_models/universal.js +26 -4
- package/dist/document_loaders/fs/buffer.cjs +2 -2
- package/dist/document_loaders/fs/buffer.d.ts +1 -1
- package/dist/document_loaders/fs/buffer.js +1 -1
- package/dist/document_loaders/fs/json.cjs +13 -1
- package/dist/document_loaders/fs/json.js +13 -1
- package/dist/document_loaders/fs/text.cjs +2 -2
- package/dist/document_loaders/fs/text.d.ts +1 -1
- package/dist/document_loaders/fs/text.js +1 -1
- package/dist/hub/base.cjs +15 -8
- package/dist/hub/base.js +15 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
⚡ Building applications with LLMs through composability ⚡
|
|
4
4
|
|
|
5
|
-
[](https://opensource.org/licenses/MIT)  [](https://twitter.com/langchainai) [](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/langchain-ai/langchainjs)
|
|
6
6
|
[<img src="https://github.com/codespaces/badge.svg" title="Open in Github Codespace" width="150" height="20">](https://codespaces.new/langchain-ai/langchainjs)
|
|
7
7
|
|
|
8
8
|
Looking for the Python version? Check out [LangChain](https://github.com/langchain-ai/langchain).
|
|
@@ -43,15 +43,13 @@ This framework consists of several parts.
|
|
|
43
43
|
|
|
44
44
|
The LangChain libraries themselves are made up of several different packages.
|
|
45
45
|
|
|
46
|
-
- **[`@langchain/core`](https://github.com/langchain-ai/langchainjs/blob/main/langchain-core)**: Base abstractions
|
|
46
|
+
- **[`@langchain/core`](https://github.com/langchain-ai/langchainjs/blob/main/langchain-core)**: Base abstractions.
|
|
47
47
|
- **[`@langchain/community`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community)**: Third party integrations.
|
|
48
48
|
- **[`langchain`](https://github.com/langchain-ai/langchainjs/blob/main/langchain)**: Chains, agents, and retrieval strategies that make up an application's cognitive architecture.
|
|
49
49
|
- **[LangGraph.js](https://langchain-ai.github.io/langgraphjs/)**: LangGraph powers production-grade agents, trusted by Linkedin, Uber, Klarna, GitLab, and many more. Build robust and stateful multi-actor applications with LLMs by modeling steps as edges and nodes in a graph. Integrates smoothly with LangChain, but can be used without it.
|
|
50
50
|
|
|
51
51
|
Integrations may also be split into their own compatible packages.
|
|
52
52
|
|
|
53
|
-

|
|
54
|
-
|
|
55
53
|
This library aims to assist in the development of those types of applications. Common examples of these applications include:
|
|
56
54
|
|
|
57
55
|
**❓Question Answering over specific documents**
|
|
@@ -47,7 +47,7 @@ class LocalFileCache extends caches_1.BaseCache {
|
|
|
47
47
|
* @returns An array of Generations if found, null otherwise.
|
|
48
48
|
*/
|
|
49
49
|
async lookup(prompt, llmKey) {
|
|
50
|
-
const key = `${
|
|
50
|
+
const key = `${this.keyEncoder(prompt, llmKey)}.json`;
|
|
51
51
|
try {
|
|
52
52
|
const content = await promises_1.default.readFile(node_path_1.default.join(this.cacheDir, key));
|
|
53
53
|
return JSON.parse(content.toString()).map(caches_1.deserializeStoredGeneration);
|
|
@@ -65,7 +65,7 @@ class LocalFileCache extends caches_1.BaseCache {
|
|
|
65
65
|
* @param generations The value to be stored in the cache.
|
|
66
66
|
*/
|
|
67
67
|
async update(prompt, llmKey, generations) {
|
|
68
|
-
const key = `${
|
|
68
|
+
const key = `${this.keyEncoder(prompt, llmKey)}.json`;
|
|
69
69
|
await promises_1.default.writeFile(node_path_1.default.join(this.cacheDir, key), JSON.stringify(generations.map(caches_1.serializeGeneration)));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
|
-
import { BaseCache,
|
|
3
|
+
import { BaseCache, serializeGeneration, deserializeStoredGeneration, } from "@langchain/core/caches";
|
|
4
4
|
/**
|
|
5
5
|
* A cache that uses the local filesystem as the backing store.
|
|
6
6
|
* This is useful for local development and testing. But it is not recommended for production use.
|
|
@@ -41,7 +41,7 @@ export class LocalFileCache extends BaseCache {
|
|
|
41
41
|
* @returns An array of Generations if found, null otherwise.
|
|
42
42
|
*/
|
|
43
43
|
async lookup(prompt, llmKey) {
|
|
44
|
-
const key = `${
|
|
44
|
+
const key = `${this.keyEncoder(prompt, llmKey)}.json`;
|
|
45
45
|
try {
|
|
46
46
|
const content = await fs.readFile(path.join(this.cacheDir, key));
|
|
47
47
|
return JSON.parse(content.toString()).map(deserializeStoredGeneration);
|
|
@@ -59,7 +59,7 @@ export class LocalFileCache extends BaseCache {
|
|
|
59
59
|
* @param generations The value to be stored in the cache.
|
|
60
60
|
*/
|
|
61
61
|
async update(prompt, llmKey, generations) {
|
|
62
|
-
const key = `${
|
|
62
|
+
const key = `${this.keyEncoder(prompt, llmKey)}.json`;
|
|
63
63
|
await fs.writeFile(path.join(this.cacheDir, key), JSON.stringify(generations.map(serializeGeneration)));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -56,6 +56,7 @@ const _SUPPORTED_PROVIDERS = [
|
|
|
56
56
|
"cerebras",
|
|
57
57
|
"deepseek",
|
|
58
58
|
"xai",
|
|
59
|
+
"perplexity",
|
|
59
60
|
];
|
|
60
61
|
async function _initChatModelHelper(model, modelProvider,
|
|
61
62
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -148,6 +149,18 @@ params = {}) {
|
|
|
148
149
|
"@langchain/community/chat_models/togetherai")));
|
|
149
150
|
return new ChatTogetherAI({ model, ...passedParams });
|
|
150
151
|
}
|
|
152
|
+
case "perplexity": {
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
154
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
155
|
+
const { ChatPerplexity } = await Promise.resolve().then(() => __importStar(require(
|
|
156
|
+
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
157
|
+
// this import will be able to be resolved, thus there will be no error. However
|
|
158
|
+
// this will never be the case in CI.
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
160
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
161
|
+
"@langchain/community/chat_models/perplexity")));
|
|
162
|
+
return new ChatPerplexity({ model, ...passedParams });
|
|
163
|
+
}
|
|
151
164
|
default: {
|
|
152
165
|
const supported = _SUPPORTED_PROVIDERS.join(", ");
|
|
153
166
|
throw new Error(`Unsupported { modelProvider: ${modelProviderCopy} }.\n\nSupported model providers are: ${supported}`);
|
|
@@ -200,6 +213,12 @@ function _inferModelProvider(modelName) {
|
|
|
200
213
|
else if (modelName.startsWith("amazon.")) {
|
|
201
214
|
return "bedrock";
|
|
202
215
|
}
|
|
216
|
+
else if (modelName.startsWith("mistral")) {
|
|
217
|
+
return "mistralai";
|
|
218
|
+
}
|
|
219
|
+
else if (modelName.startsWith("sonar") || modelName.startsWith("pplx")) {
|
|
220
|
+
return "perplexity";
|
|
221
|
+
}
|
|
203
222
|
else {
|
|
204
223
|
return undefined;
|
|
205
224
|
}
|
|
@@ -263,12 +282,13 @@ class ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
263
282
|
configurable: true,
|
|
264
283
|
writable: true,
|
|
265
284
|
value: (schema, ...args) => {
|
|
266
|
-
|
|
285
|
+
const newQueuedOperations = { ...this._queuedMethodOperations };
|
|
286
|
+
newQueuedOperations.withStructuredOutput = [schema, ...args];
|
|
267
287
|
return new ConfigurableModel({
|
|
268
288
|
defaultConfig: this._defaultConfig,
|
|
269
289
|
configurableFields: this._configurableFields,
|
|
270
290
|
configPrefix: this._configPrefix,
|
|
271
|
-
queuedMethodOperations:
|
|
291
|
+
queuedMethodOperations: newQueuedOperations,
|
|
272
292
|
});
|
|
273
293
|
}
|
|
274
294
|
});
|
|
@@ -317,12 +337,13 @@ class ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
317
337
|
bindTools(tools,
|
|
318
338
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
319
339
|
params) {
|
|
320
|
-
this._queuedMethodOperations
|
|
340
|
+
const newQueuedOperations = { ...this._queuedMethodOperations };
|
|
341
|
+
newQueuedOperations.bindTools = [tools, params];
|
|
321
342
|
return new ConfigurableModel({
|
|
322
343
|
defaultConfig: this._defaultConfig,
|
|
323
344
|
configurableFields: this._configurableFields,
|
|
324
345
|
configPrefix: this._configPrefix,
|
|
325
|
-
queuedMethodOperations:
|
|
346
|
+
queuedMethodOperations: newQueuedOperations,
|
|
326
347
|
});
|
|
327
348
|
}
|
|
328
349
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -451,6 +472,7 @@ exports.ConfigurableModel = ConfigurableModel;
|
|
|
451
472
|
* - mistralai (@langchain/mistralai)
|
|
452
473
|
* - groq (@langchain/groq)
|
|
453
474
|
* - ollama (@langchain/ollama)
|
|
475
|
+
* - perplexity (@langchain/community/chat_models/perplexity)
|
|
454
476
|
* - cerebras (@langchain/cerebras)
|
|
455
477
|
* - deepseek (@langchain/deepseek)
|
|
456
478
|
* - xai (@langchain/xai)
|
|
@@ -9,7 +9,7 @@ import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
|
|
|
9
9
|
import { ChatResult } from "@langchain/core/outputs";
|
|
10
10
|
interface EventStreamCallbackHandlerInput extends Omit<LogStreamCallbackHandlerInput, "_schemaFormat"> {
|
|
11
11
|
}
|
|
12
|
-
declare const _SUPPORTED_PROVIDERS: readonly ["openai", "anthropic", "azure_openai", "cohere", "google-vertexai", "google-vertexai-web", "google-genai", "ollama", "together", "fireworks", "mistralai", "groq", "bedrock", "cerebras", "deepseek", "xai"];
|
|
12
|
+
declare const _SUPPORTED_PROVIDERS: readonly ["openai", "anthropic", "azure_openai", "cohere", "google-vertexai", "google-vertexai-web", "google-genai", "ollama", "together", "fireworks", "mistralai", "groq", "bedrock", "cerebras", "deepseek", "xai", "perplexity"];
|
|
13
13
|
export type ChatModelProvider = (typeof _SUPPORTED_PROVIDERS)[number];
|
|
14
14
|
export interface ConfigurableChatModelCallOptions extends BaseChatModelCallOptions {
|
|
15
15
|
tools?: (StructuredToolInterface | Record<string, unknown> | ToolDefinition | RunnableToolLike)[];
|
|
@@ -18,6 +18,7 @@ const _SUPPORTED_PROVIDERS = [
|
|
|
18
18
|
"cerebras",
|
|
19
19
|
"deepseek",
|
|
20
20
|
"xai",
|
|
21
|
+
"perplexity",
|
|
21
22
|
];
|
|
22
23
|
async function _initChatModelHelper(model, modelProvider,
|
|
23
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -110,6 +111,18 @@ params = {}) {
|
|
|
110
111
|
"@langchain/community/chat_models/togetherai");
|
|
111
112
|
return new ChatTogetherAI({ model, ...passedParams });
|
|
112
113
|
}
|
|
114
|
+
case "perplexity": {
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
116
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
117
|
+
const { ChatPerplexity } = await import(
|
|
118
|
+
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
119
|
+
// this import will be able to be resolved, thus there will be no error. However
|
|
120
|
+
// this will never be the case in CI.
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
122
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
123
|
+
"@langchain/community/chat_models/perplexity");
|
|
124
|
+
return new ChatPerplexity({ model, ...passedParams });
|
|
125
|
+
}
|
|
113
126
|
default: {
|
|
114
127
|
const supported = _SUPPORTED_PROVIDERS.join(", ");
|
|
115
128
|
throw new Error(`Unsupported { modelProvider: ${modelProviderCopy} }.\n\nSupported model providers are: ${supported}`);
|
|
@@ -162,6 +175,12 @@ export function _inferModelProvider(modelName) {
|
|
|
162
175
|
else if (modelName.startsWith("amazon.")) {
|
|
163
176
|
return "bedrock";
|
|
164
177
|
}
|
|
178
|
+
else if (modelName.startsWith("mistral")) {
|
|
179
|
+
return "mistralai";
|
|
180
|
+
}
|
|
181
|
+
else if (modelName.startsWith("sonar") || modelName.startsWith("pplx")) {
|
|
182
|
+
return "perplexity";
|
|
183
|
+
}
|
|
165
184
|
else {
|
|
166
185
|
return undefined;
|
|
167
186
|
}
|
|
@@ -225,12 +244,13 @@ export class ConfigurableModel extends BaseChatModel {
|
|
|
225
244
|
configurable: true,
|
|
226
245
|
writable: true,
|
|
227
246
|
value: (schema, ...args) => {
|
|
228
|
-
|
|
247
|
+
const newQueuedOperations = { ...this._queuedMethodOperations };
|
|
248
|
+
newQueuedOperations.withStructuredOutput = [schema, ...args];
|
|
229
249
|
return new ConfigurableModel({
|
|
230
250
|
defaultConfig: this._defaultConfig,
|
|
231
251
|
configurableFields: this._configurableFields,
|
|
232
252
|
configPrefix: this._configPrefix,
|
|
233
|
-
queuedMethodOperations:
|
|
253
|
+
queuedMethodOperations: newQueuedOperations,
|
|
234
254
|
});
|
|
235
255
|
}
|
|
236
256
|
});
|
|
@@ -279,12 +299,13 @@ export class ConfigurableModel extends BaseChatModel {
|
|
|
279
299
|
bindTools(tools,
|
|
280
300
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
281
301
|
params) {
|
|
282
|
-
this._queuedMethodOperations
|
|
302
|
+
const newQueuedOperations = { ...this._queuedMethodOperations };
|
|
303
|
+
newQueuedOperations.bindTools = [tools, params];
|
|
283
304
|
return new ConfigurableModel({
|
|
284
305
|
defaultConfig: this._defaultConfig,
|
|
285
306
|
configurableFields: this._configurableFields,
|
|
286
307
|
configPrefix: this._configPrefix,
|
|
287
|
-
queuedMethodOperations:
|
|
308
|
+
queuedMethodOperations: newQueuedOperations,
|
|
288
309
|
});
|
|
289
310
|
}
|
|
290
311
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -412,6 +433,7 @@ export class ConfigurableModel extends BaseChatModel {
|
|
|
412
433
|
* - mistralai (@langchain/mistralai)
|
|
413
434
|
* - groq (@langchain/groq)
|
|
414
435
|
* - ollama (@langchain/ollama)
|
|
436
|
+
* - perplexity (@langchain/community/chat_models/perplexity)
|
|
415
437
|
* - cerebras (@langchain/cerebras)
|
|
416
438
|
* - deepseek (@langchain/deepseek)
|
|
417
439
|
* - xai (@langchain/xai)
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.BufferLoader = void 0;
|
|
37
37
|
const env_1 = require("@langchain/core/utils/env");
|
|
38
|
-
const
|
|
38
|
+
const base_1 = require("@langchain/core/document_loaders/base");
|
|
39
39
|
/**
|
|
40
40
|
* Abstract class that extends the `BaseDocumentLoader` class. It
|
|
41
41
|
* represents a document loader that loads documents from a buffer. The
|
|
@@ -43,7 +43,7 @@ const base_js_1 = require("../base.cjs");
|
|
|
43
43
|
* based on the type of `filePathOrBlob`, and then calls the `parse()`
|
|
44
44
|
* method to parse the buffer and return the documents.
|
|
45
45
|
*/
|
|
46
|
-
class BufferLoader extends
|
|
46
|
+
class BufferLoader extends base_1.BaseDocumentLoader {
|
|
47
47
|
constructor(filePathOrBlob) {
|
|
48
48
|
super();
|
|
49
49
|
Object.defineProperty(this, "filePathOrBlob", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { readFile as ReadFileT } from "node:fs/promises";
|
|
2
2
|
import { Document } from "@langchain/core/documents";
|
|
3
|
-
import { BaseDocumentLoader } from "
|
|
3
|
+
import { BaseDocumentLoader } from "@langchain/core/document_loaders/base";
|
|
4
4
|
/**
|
|
5
5
|
* Abstract class that extends the `BaseDocumentLoader` class. It
|
|
6
6
|
* represents a document loader that loads documents from a buffer. The
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getEnv } from "@langchain/core/utils/env";
|
|
2
|
-
import { BaseDocumentLoader } from "
|
|
2
|
+
import { BaseDocumentLoader } from "@langchain/core/document_loaders/base";
|
|
3
3
|
/**
|
|
4
4
|
* Abstract class that extends the `BaseDocumentLoader` class. It
|
|
5
5
|
* represents a document loader that loads documents from a buffer. The
|
|
@@ -141,7 +141,19 @@ class JSONLinesLoader extends text_js_1.TextLoader {
|
|
|
141
141
|
.filter(Boolean)
|
|
142
142
|
.map((line) => JSON.parse(line));
|
|
143
143
|
const pointer = jsonpointer_1.default.compile(this.pointer);
|
|
144
|
-
return jsons.map((json) =>
|
|
144
|
+
return jsons.map((json) => {
|
|
145
|
+
const data = pointer.get(json);
|
|
146
|
+
if (typeof data === "string") {
|
|
147
|
+
return data;
|
|
148
|
+
}
|
|
149
|
+
if (!data) {
|
|
150
|
+
return "";
|
|
151
|
+
}
|
|
152
|
+
if (typeof data === "object") {
|
|
153
|
+
return JSON.stringify(data);
|
|
154
|
+
}
|
|
155
|
+
return "";
|
|
156
|
+
});
|
|
145
157
|
}
|
|
146
158
|
}
|
|
147
159
|
exports.JSONLinesLoader = JSONLinesLoader;
|
|
@@ -134,6 +134,18 @@ export class JSONLinesLoader extends TextLoader {
|
|
|
134
134
|
.filter(Boolean)
|
|
135
135
|
.map((line) => JSON.parse(line));
|
|
136
136
|
const pointer = jsonpointer.compile(this.pointer);
|
|
137
|
-
return jsons.map((json) =>
|
|
137
|
+
return jsons.map((json) => {
|
|
138
|
+
const data = pointer.get(json);
|
|
139
|
+
if (typeof data === "string") {
|
|
140
|
+
return data;
|
|
141
|
+
}
|
|
142
|
+
if (!data) {
|
|
143
|
+
return "";
|
|
144
|
+
}
|
|
145
|
+
if (typeof data === "object") {
|
|
146
|
+
return JSON.stringify(data);
|
|
147
|
+
}
|
|
148
|
+
return "";
|
|
149
|
+
});
|
|
138
150
|
}
|
|
139
151
|
}
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.TextLoader = void 0;
|
|
37
37
|
const documents_1 = require("@langchain/core/documents");
|
|
38
38
|
const env_1 = require("@langchain/core/utils/env");
|
|
39
|
-
const
|
|
39
|
+
const base_1 = require("@langchain/core/document_loaders/base");
|
|
40
40
|
/**
|
|
41
41
|
* A class that extends the `BaseDocumentLoader` class. It represents a
|
|
42
42
|
* document loader that loads documents from a text file. The `load()`
|
|
@@ -50,7 +50,7 @@ const base_js_1 = require("../base.cjs");
|
|
|
50
50
|
* const docs = await loader.load();
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
class TextLoader extends
|
|
53
|
+
class TextLoader extends base_1.BaseDocumentLoader {
|
|
54
54
|
constructor(filePathOrBlob) {
|
|
55
55
|
super();
|
|
56
56
|
Object.defineProperty(this, "filePathOrBlob", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { readFile as ReadFileT } from "node:fs/promises";
|
|
2
2
|
import { Document } from "@langchain/core/documents";
|
|
3
|
-
import { BaseDocumentLoader } from "
|
|
3
|
+
import { BaseDocumentLoader } from "@langchain/core/document_loaders/base";
|
|
4
4
|
/**
|
|
5
5
|
* A class that extends the `BaseDocumentLoader` class. It represents a
|
|
6
6
|
* document loader that loads documents from a text file. The `load()`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Document } from "@langchain/core/documents";
|
|
2
2
|
import { getEnv } from "@langchain/core/utils/env";
|
|
3
|
-
import { BaseDocumentLoader } from "
|
|
3
|
+
import { BaseDocumentLoader } from "@langchain/core/document_loaders/base";
|
|
4
4
|
/**
|
|
5
5
|
* A class that extends the `BaseDocumentLoader` class. It represents a
|
|
6
6
|
* document loader that loads documents from a text file. The `load()`
|
package/dist/hub/base.cjs
CHANGED
|
@@ -146,14 +146,21 @@ function bindOutputSchema(loadedSequence) {
|
|
|
146
146
|
"schema" in loadedSequence.first &&
|
|
147
147
|
"last" in loadedSequence &&
|
|
148
148
|
loadedSequence.last !== null &&
|
|
149
|
-
typeof loadedSequence.last === "object"
|
|
150
|
-
"bound" in loadedSequence.last &&
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
typeof loadedSequence.last === "object") {
|
|
150
|
+
if ("bound" in loadedSequence.last &&
|
|
151
|
+
loadedSequence.last.bound !== null &&
|
|
152
|
+
typeof loadedSequence.last.bound === "object" &&
|
|
153
|
+
"withStructuredOutput" in loadedSequence.last.bound &&
|
|
154
|
+
typeof loadedSequence.last.bound.withStructuredOutput === "function") {
|
|
155
|
+
// eslint-disable-next-line no-param-reassign
|
|
156
|
+
loadedSequence.last.bound =
|
|
157
|
+
loadedSequence.last.bound.withStructuredOutput(loadedSequence.first.schema);
|
|
158
|
+
}
|
|
159
|
+
else if ("withStructuredOutput" in loadedSequence.last &&
|
|
160
|
+
typeof loadedSequence.last.withStructuredOutput === "function") {
|
|
161
|
+
// eslint-disable-next-line no-param-reassign
|
|
162
|
+
loadedSequence.last = loadedSequence.last.withStructuredOutput(loadedSequence.first.schema);
|
|
163
|
+
}
|
|
157
164
|
}
|
|
158
165
|
return loadedSequence;
|
|
159
166
|
}
|
package/dist/hub/base.js
CHANGED
|
@@ -139,14 +139,21 @@ export function bindOutputSchema(loadedSequence) {
|
|
|
139
139
|
"schema" in loadedSequence.first &&
|
|
140
140
|
"last" in loadedSequence &&
|
|
141
141
|
loadedSequence.last !== null &&
|
|
142
|
-
typeof loadedSequence.last === "object"
|
|
143
|
-
"bound" in loadedSequence.last &&
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
typeof loadedSequence.last === "object") {
|
|
143
|
+
if ("bound" in loadedSequence.last &&
|
|
144
|
+
loadedSequence.last.bound !== null &&
|
|
145
|
+
typeof loadedSequence.last.bound === "object" &&
|
|
146
|
+
"withStructuredOutput" in loadedSequence.last.bound &&
|
|
147
|
+
typeof loadedSequence.last.bound.withStructuredOutput === "function") {
|
|
148
|
+
// eslint-disable-next-line no-param-reassign
|
|
149
|
+
loadedSequence.last.bound =
|
|
150
|
+
loadedSequence.last.bound.withStructuredOutput(loadedSequence.first.schema);
|
|
151
|
+
}
|
|
152
|
+
else if ("withStructuredOutput" in loadedSequence.last &&
|
|
153
|
+
typeof loadedSequence.last.withStructuredOutput === "function") {
|
|
154
|
+
// eslint-disable-next-line no-param-reassign
|
|
155
|
+
loadedSequence.last = loadedSequence.last.withStructuredOutput(loadedSequence.first.schema);
|
|
156
|
+
}
|
|
150
157
|
}
|
|
151
158
|
return loadedSequence;
|
|
152
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.35",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
"@types/ws": "^8",
|
|
441
441
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
442
442
|
"@typescript-eslint/parser": "^5.58.0",
|
|
443
|
-
"axios": "^1.
|
|
443
|
+
"axios": "^1.12.0",
|
|
444
444
|
"cheerio": "1.0.0-rc.12",
|
|
445
445
|
"dotenv": "^16.0.3",
|
|
446
446
|
"dpdm": "^3.14.0",
|
|
@@ -545,7 +545,7 @@
|
|
|
545
545
|
"js-tiktoken": "^1.0.12",
|
|
546
546
|
"js-yaml": "^4.1.0",
|
|
547
547
|
"jsonpointer": "^5.0.1",
|
|
548
|
-
"langsmith": "^0.3.
|
|
548
|
+
"langsmith": "^0.3.67",
|
|
549
549
|
"openapi-types": "^12.1.3",
|
|
550
550
|
"p-retry": "4",
|
|
551
551
|
"uuid": "^10.0.0",
|