langchain 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/openai_tools/index.d.ts +2 -1
- package/dist/agents/structured_chat/index.cjs +12 -1
- package/dist/agents/structured_chat/index.d.ts +2 -2
- package/dist/agents/structured_chat/index.js +12 -1
- package/dist/agents/tool_calling/index.d.ts +2 -1
- package/dist/document_loaders/fs/multi_file.cjs +98 -0
- package/dist/document_loaders/fs/multi_file.d.ts +37 -0
- package/dist/document_loaders/fs/multi_file.js +94 -0
- package/dist/document_loaders/tests/multi_file.test.d.ts +1 -0
- package/dist/document_loaders/tests/multi_file.test.js +49 -0
- package/dist/experimental/chrome_ai/app/dist/bundle.cjs +1250 -0
- package/dist/experimental/chrome_ai/app/dist/bundle.d.ts +1 -0
- package/dist/experimental/chrome_ai/app/dist/bundle.js +1249 -0
- package/dist/load/import_constants.cjs +1 -0
- package/dist/load/import_constants.js +1 -0
- package/dist/retrievers/multi_query.cjs +1 -1
- package/dist/retrievers/multi_query.js +1 -1
- package/dist/tools/render.cjs +14 -1
- package/dist/tools/render.d.ts +3 -2
- package/dist/tools/render.js +14 -1
- package/document_loaders/fs/multi_file.cjs +1 -0
- package/document_loaders/fs/multi_file.d.cts +1 -0
- package/document_loaders/fs/multi_file.d.ts +1 -0
- package/document_loaders/fs/multi_file.js +1 -0
- package/package.json +15 -2
|
@@ -38,6 +38,7 @@ exports.optionalImportEntrypoints = [
|
|
|
38
38
|
"langchain/document_loaders/web/couchbase",
|
|
39
39
|
"langchain/document_loaders/web/youtube",
|
|
40
40
|
"langchain/document_loaders/fs/directory",
|
|
41
|
+
"langchain/document_loaders/fs/multi_file",
|
|
41
42
|
"langchain/document_loaders/fs/buffer",
|
|
42
43
|
"langchain/document_loaders/fs/chatgpt",
|
|
43
44
|
"langchain/document_loaders/fs/text",
|
|
@@ -35,6 +35,7 @@ export const optionalImportEntrypoints = [
|
|
|
35
35
|
"langchain/document_loaders/web/couchbase",
|
|
36
36
|
"langchain/document_loaders/web/youtube",
|
|
37
37
|
"langchain/document_loaders/fs/directory",
|
|
38
|
+
"langchain/document_loaders/fs/multi_file",
|
|
38
39
|
"langchain/document_loaders/fs/buffer",
|
|
39
40
|
"langchain/document_loaders/fs/chatgpt",
|
|
40
41
|
"langchain/document_loaders/fs/text",
|
|
@@ -162,7 +162,7 @@ class MultiQueryRetriever extends retrievers_1.BaseRetriever {
|
|
|
162
162
|
const uniqueDocuments = this._uniqueUnion(documents);
|
|
163
163
|
let outputDocs = uniqueDocuments;
|
|
164
164
|
if (this.documentCompressor && uniqueDocuments.length) {
|
|
165
|
-
outputDocs = await this.documentCompressor.compressDocuments(uniqueDocuments, question);
|
|
165
|
+
outputDocs = await this.documentCompressor.compressDocuments(uniqueDocuments, question, runManager?.getChild());
|
|
166
166
|
if (this.documentCompressorFilteringFn) {
|
|
167
167
|
outputDocs = this.documentCompressorFilteringFn(outputDocs);
|
|
168
168
|
}
|
|
@@ -159,7 +159,7 @@ export class MultiQueryRetriever extends BaseRetriever {
|
|
|
159
159
|
const uniqueDocuments = this._uniqueUnion(documents);
|
|
160
160
|
let outputDocs = uniqueDocuments;
|
|
161
161
|
if (this.documentCompressor && uniqueDocuments.length) {
|
|
162
|
-
outputDocs = await this.documentCompressor.compressDocuments(uniqueDocuments, question);
|
|
162
|
+
outputDocs = await this.documentCompressor.compressDocuments(uniqueDocuments, question, runManager?.getChild());
|
|
163
163
|
if (this.documentCompressorFilteringFn) {
|
|
164
164
|
outputDocs = this.documentCompressorFilteringFn(outputDocs);
|
|
165
165
|
}
|
package/dist/tools/render.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderTextDescriptionAndArgs = exports.renderTextDescription = void 0;
|
|
4
4
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
5
|
+
const base_1 = require("@langchain/core/language_models/base");
|
|
5
6
|
/**
|
|
6
7
|
* Render the tool name and description in plain text.
|
|
7
8
|
*
|
|
@@ -14,7 +15,14 @@ const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
|
14
15
|
* @returns a string of all tools and their descriptions
|
|
15
16
|
*/
|
|
16
17
|
function renderTextDescription(tools) {
|
|
17
|
-
|
|
18
|
+
if (tools.every(base_1.isOpenAITool)) {
|
|
19
|
+
return tools
|
|
20
|
+
.map((tool) => `${tool.function.name}${tool.function.description ? `: ${tool.function.description}` : ""}`)
|
|
21
|
+
.join("\n");
|
|
22
|
+
}
|
|
23
|
+
return tools
|
|
24
|
+
.map((tool) => `${tool.name}: ${tool.description}`)
|
|
25
|
+
.join("\n");
|
|
18
26
|
}
|
|
19
27
|
exports.renderTextDescription = renderTextDescription;
|
|
20
28
|
/**
|
|
@@ -29,6 +37,11 @@ exports.renderTextDescription = renderTextDescription;
|
|
|
29
37
|
* @returns a string of all tools, their descriptions and a stringified version of their schemas
|
|
30
38
|
*/
|
|
31
39
|
function renderTextDescriptionAndArgs(tools) {
|
|
40
|
+
if (tools.every(base_1.isOpenAITool)) {
|
|
41
|
+
return tools
|
|
42
|
+
.map((tool) => `${tool.function.name}${tool.function.description ? `: ${tool.function.description}` : ""}, args: ${JSON.stringify(tool.function.parameters)}`)
|
|
43
|
+
.join("\n");
|
|
44
|
+
}
|
|
32
45
|
return tools
|
|
33
46
|
.map((tool) => `${tool.name}: ${tool.description}, args: ${JSON.stringify((0, zod_to_json_schema_1.zodToJsonSchema)(tool.schema).properties)}`)
|
|
34
47
|
.join("\n");
|
package/dist/tools/render.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StructuredToolInterface } from "@langchain/core/tools";
|
|
2
|
+
import { ToolDefinition } from "@langchain/core/language_models/base";
|
|
2
3
|
/**
|
|
3
4
|
* Render the tool name and description in plain text.
|
|
4
5
|
*
|
|
@@ -10,7 +11,7 @@ import { StructuredToolInterface } from "@langchain/core/tools";
|
|
|
10
11
|
* @param tools
|
|
11
12
|
* @returns a string of all tools and their descriptions
|
|
12
13
|
*/
|
|
13
|
-
export declare function renderTextDescription(tools: StructuredToolInterface[]): string;
|
|
14
|
+
export declare function renderTextDescription(tools: StructuredToolInterface[] | ToolDefinition[]): string;
|
|
14
15
|
/**
|
|
15
16
|
* Render the tool name, description, and args in plain text.
|
|
16
17
|
* Output will be in the format of:'
|
|
@@ -22,4 +23,4 @@ export declare function renderTextDescription(tools: StructuredToolInterface[]):
|
|
|
22
23
|
* @param tools
|
|
23
24
|
* @returns a string of all tools, their descriptions and a stringified version of their schemas
|
|
24
25
|
*/
|
|
25
|
-
export declare function renderTextDescriptionAndArgs(tools: StructuredToolInterface[]): string;
|
|
26
|
+
export declare function renderTextDescriptionAndArgs(tools: StructuredToolInterface[] | ToolDefinition[]): string;
|
package/dist/tools/render.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
2
|
+
import { isOpenAITool, } from "@langchain/core/language_models/base";
|
|
2
3
|
/**
|
|
3
4
|
* Render the tool name and description in plain text.
|
|
4
5
|
*
|
|
@@ -11,7 +12,14 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
11
12
|
* @returns a string of all tools and their descriptions
|
|
12
13
|
*/
|
|
13
14
|
export function renderTextDescription(tools) {
|
|
14
|
-
|
|
15
|
+
if (tools.every(isOpenAITool)) {
|
|
16
|
+
return tools
|
|
17
|
+
.map((tool) => `${tool.function.name}${tool.function.description ? `: ${tool.function.description}` : ""}`)
|
|
18
|
+
.join("\n");
|
|
19
|
+
}
|
|
20
|
+
return tools
|
|
21
|
+
.map((tool) => `${tool.name}: ${tool.description}`)
|
|
22
|
+
.join("\n");
|
|
15
23
|
}
|
|
16
24
|
/**
|
|
17
25
|
* Render the tool name, description, and args in plain text.
|
|
@@ -25,6 +33,11 @@ export function renderTextDescription(tools) {
|
|
|
25
33
|
* @returns a string of all tools, their descriptions and a stringified version of their schemas
|
|
26
34
|
*/
|
|
27
35
|
export function renderTextDescriptionAndArgs(tools) {
|
|
36
|
+
if (tools.every(isOpenAITool)) {
|
|
37
|
+
return tools
|
|
38
|
+
.map((tool) => `${tool.function.name}${tool.function.description ? `: ${tool.function.description}` : ""}, args: ${JSON.stringify(tool.function.parameters)}`)
|
|
39
|
+
.join("\n");
|
|
40
|
+
}
|
|
28
41
|
return tools
|
|
29
42
|
.map((tool) => `${tool.name}: ${tool.description}, args: ${JSON.stringify(zodToJsonSchema(tool.schema).properties)}`)
|
|
30
43
|
.join("\n");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../dist/document_loaders/fs/multi_file.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/document_loaders/fs/multi_file.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/document_loaders/fs/multi_file.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/document_loaders/fs/multi_file.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -286,6 +286,10 @@
|
|
|
286
286
|
"document_loaders/fs/directory.js",
|
|
287
287
|
"document_loaders/fs/directory.d.ts",
|
|
288
288
|
"document_loaders/fs/directory.d.cts",
|
|
289
|
+
"document_loaders/fs/multi_file.cjs",
|
|
290
|
+
"document_loaders/fs/multi_file.js",
|
|
291
|
+
"document_loaders/fs/multi_file.d.ts",
|
|
292
|
+
"document_loaders/fs/multi_file.d.cts",
|
|
289
293
|
"document_loaders/fs/buffer.cjs",
|
|
290
294
|
"document_loaders/fs/buffer.js",
|
|
291
295
|
"document_loaders/fs/buffer.d.ts",
|
|
@@ -884,7 +888,7 @@
|
|
|
884
888
|
}
|
|
885
889
|
},
|
|
886
890
|
"dependencies": {
|
|
887
|
-
"@langchain/core": "
|
|
891
|
+
"@langchain/core": ">=0.2.9 <0.3.0",
|
|
888
892
|
"@langchain/openai": ">=0.1.0 <0.3.0",
|
|
889
893
|
"@langchain/textsplitters": "~0.0.0",
|
|
890
894
|
"binary-extensions": "^2.2.0",
|
|
@@ -1540,6 +1544,15 @@
|
|
|
1540
1544
|
"import": "./document_loaders/fs/directory.js",
|
|
1541
1545
|
"require": "./document_loaders/fs/directory.cjs"
|
|
1542
1546
|
},
|
|
1547
|
+
"./document_loaders/fs/multi_file": {
|
|
1548
|
+
"types": {
|
|
1549
|
+
"import": "./document_loaders/fs/multi_file.d.ts",
|
|
1550
|
+
"require": "./document_loaders/fs/multi_file.d.cts",
|
|
1551
|
+
"default": "./document_loaders/fs/multi_file.d.ts"
|
|
1552
|
+
},
|
|
1553
|
+
"import": "./document_loaders/fs/multi_file.js",
|
|
1554
|
+
"require": "./document_loaders/fs/multi_file.cjs"
|
|
1555
|
+
},
|
|
1543
1556
|
"./document_loaders/fs/buffer": {
|
|
1544
1557
|
"types": {
|
|
1545
1558
|
"import": "./document_loaders/fs/buffer.d.ts",
|