langchain 0.1.3 → 0.1.5
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/toolkits/conversational_retrieval/tool.cjs +2 -2
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.js +1 -1
- package/dist/agents/toolkits/openapi/openapi.cjs +2 -2
- package/dist/agents/toolkits/openapi/openapi.js +1 -1
- package/dist/chains/openai_functions/base.d.ts +1 -1
- package/dist/chains/openai_functions/openapi.d.ts +1 -1
- package/dist/chains/openai_functions/structured_output.cjs +2 -0
- package/dist/chains/openai_functions/structured_output.d.ts +3 -1
- package/dist/chains/openai_functions/structured_output.js +2 -0
- package/dist/chat_models/anthropic.cjs +2 -0
- package/dist/chat_models/anthropic.js +2 -0
- package/dist/document_transformers/openai_functions.d.ts +1 -1
- package/dist/document_transformers/openai_functions.js +1 -1
- package/dist/experimental/chat_models/anthropic_functions.cjs +11 -2
- package/dist/experimental/chat_models/anthropic_functions.d.ts +3 -0
- package/dist/experimental/chat_models/anthropic_functions.js +11 -2
- package/dist/experimental/hubs/makersuite/googlemakersuitehub.d.ts +2 -1
- package/dist/experimental/plan_and_execute/agent_executor.d.ts +1 -2
- package/dist/experimental/plan_and_execute/prompt.d.ts +1 -2
- package/dist/output_parsers/index.cjs +2 -1
- package/dist/output_parsers/index.d.ts +1 -1
- package/dist/output_parsers/index.js +1 -1
- package/dist/output_parsers/openai_functions.d.ts +1 -1
- package/dist/output_parsers/openai_tools.cjs +86 -8
- package/dist/output_parsers/openai_tools.d.ts +31 -2
- package/dist/output_parsers/openai_tools.js +84 -7
- package/dist/output_parsers/structured.js +1 -1
- package/dist/retrievers/self_query/pinecone.d.ts +2 -2
- package/dist/runnables/remote.cjs +179 -74
- package/dist/runnables/remote.d.ts +3 -0
- package/dist/runnables/remote.js +180 -75
- package/dist/text_splitter.cjs +6 -5
- package/dist/text_splitter.js +6 -5
- package/dist/tools/chain.cjs +3 -2
- package/dist/tools/chain.d.ts +3 -1
- package/dist/tools/chain.js +2 -1
- package/dist/tools/retriever.cjs +2 -2
- package/dist/tools/retriever.d.ts +1 -1
- package/dist/tools/retriever.js +1 -1
- package/dist/util/sql_utils.cjs +16 -9
- package/dist/util/sql_utils.js +16 -9
- package/dist/vectorstores/pinecone.cjs +2 -0
- package/dist/vectorstores/pinecone.js +2 -0
- package/package.json +7 -7
package/dist/text_splitter.js
CHANGED
|
@@ -685,13 +685,14 @@ export class TokenTextSplitter extends TextSplitter {
|
|
|
685
685
|
const splits = [];
|
|
686
686
|
const input_ids = this.tokenizer.encode(text, this.allowedSpecial, this.disallowedSpecial);
|
|
687
687
|
let start_idx = 0;
|
|
688
|
-
let cur_idx = Math.min(start_idx + this.chunkSize, input_ids.length);
|
|
689
|
-
let chunk_ids = input_ids.slice(start_idx, cur_idx);
|
|
690
688
|
while (start_idx < input_ids.length) {
|
|
689
|
+
if (start_idx > 0) {
|
|
690
|
+
start_idx -= this.chunkOverlap;
|
|
691
|
+
}
|
|
692
|
+
const end_idx = Math.min(start_idx + this.chunkSize, input_ids.length);
|
|
693
|
+
const chunk_ids = input_ids.slice(start_idx, end_idx);
|
|
691
694
|
splits.push(this.tokenizer.decode(chunk_ids));
|
|
692
|
-
start_idx
|
|
693
|
-
cur_idx = Math.min(start_idx + this.chunkSize, input_ids.length);
|
|
694
|
-
chunk_ids = input_ids.slice(start_idx, cur_idx);
|
|
695
|
+
start_idx = end_idx;
|
|
695
696
|
}
|
|
696
697
|
return splits;
|
|
697
698
|
}
|
package/dist/tools/chain.cjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChainTool = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tools_1 = require("@langchain/core/tools");
|
|
5
5
|
/**
|
|
6
|
+
* @deprecated Wrap in a DynamicTool instead.
|
|
6
7
|
* Class that extends DynamicTool for creating tools that can run chains.
|
|
7
8
|
* Takes an instance of a class that extends BaseChain as a parameter in
|
|
8
9
|
* its constructor and uses it to run the chain when its 'func' method is
|
|
9
10
|
* called.
|
|
10
11
|
*/
|
|
11
|
-
class ChainTool extends
|
|
12
|
+
class ChainTool extends tools_1.DynamicTool {
|
|
12
13
|
static lc_name() {
|
|
13
14
|
return "ChainTool";
|
|
14
15
|
}
|
package/dist/tools/chain.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DynamicTool, DynamicToolInput } from "@langchain/
|
|
1
|
+
import { DynamicTool, DynamicToolInput } from "@langchain/core/tools";
|
|
2
2
|
import { BaseChain } from "../chains/base.js";
|
|
3
3
|
/**
|
|
4
|
+
* @deprecated Wrap in a DynamicTool instead.
|
|
4
5
|
* Interface for the input parameters of the ChainTool constructor.
|
|
5
6
|
* Extends the DynamicToolInput interface, replacing the 'func' property
|
|
6
7
|
* with a 'chain' property.
|
|
@@ -9,6 +10,7 @@ export interface ChainToolInput extends Omit<DynamicToolInput, "func"> {
|
|
|
9
10
|
chain: BaseChain;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
13
|
+
* @deprecated Wrap in a DynamicTool instead.
|
|
12
14
|
* Class that extends DynamicTool for creating tools that can run chains.
|
|
13
15
|
* Takes an instance of a class that extends BaseChain as a parameter in
|
|
14
16
|
* its constructor and uses it to run the chain when its 'func' method is
|
package/dist/tools/chain.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DynamicTool
|
|
1
|
+
import { DynamicTool } from "@langchain/core/tools";
|
|
2
2
|
/**
|
|
3
|
+
* @deprecated Wrap in a DynamicTool instead.
|
|
3
4
|
* Class that extends DynamicTool for creating tools that can run chains.
|
|
4
5
|
* Takes an instance of a class that extends BaseChain as a parameter in
|
|
5
6
|
* its constructor and uses it to run the chain when its 'func' method is
|
package/dist/tools/retriever.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createRetrieverTool = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const tools_1 = require("@langchain/core/tools");
|
|
6
6
|
const document_js_1 = require("../util/document.cjs");
|
|
7
7
|
function createRetrieverTool(retriever, input) {
|
|
8
8
|
const func = async ({ query }, runManager) => {
|
|
@@ -12,6 +12,6 @@ function createRetrieverTool(retriever, input) {
|
|
|
12
12
|
const schema = zod_1.z.object({
|
|
13
13
|
query: zod_1.z.string().describe("query to look up in retriever"),
|
|
14
14
|
});
|
|
15
|
-
return new
|
|
15
|
+
return new tools_1.DynamicStructuredTool({ ...input, func, schema });
|
|
16
16
|
}
|
|
17
17
|
exports.createRetrieverTool = createRetrieverTool;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseRetrieverInterface } from "@langchain/core/retrievers";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { DynamicStructuredTool, type DynamicStructuredToolInput } from "@langchain/
|
|
3
|
+
import { DynamicStructuredTool, type DynamicStructuredToolInput } from "@langchain/core/tools";
|
|
4
4
|
export declare function createRetrieverTool(retriever: BaseRetrieverInterface, input: Omit<DynamicStructuredToolInput, "func" | "schema">): DynamicStructuredTool<z.ZodObject<{
|
|
5
5
|
query: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
package/dist/tools/retriever.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { DynamicStructuredTool, } from "@langchain/
|
|
2
|
+
import { DynamicStructuredTool, } from "@langchain/core/tools";
|
|
3
3
|
import { formatDocumentsAsString } from "../util/document.js";
|
|
4
4
|
export function createRetrieverTool(retriever, input) {
|
|
5
5
|
const func = async ({ query }, runManager) => {
|
package/dist/util/sql_utils.cjs
CHANGED
|
@@ -96,14 +96,15 @@ const getTableAndColumnsName = async (appDataSource) => {
|
|
|
96
96
|
return formatToSqlTable(rep);
|
|
97
97
|
}
|
|
98
98
|
if (appDataSource.options.type === "mssql") {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
const schema = appDataSource.options?.schema;
|
|
100
|
+
const sql = `SELECT
|
|
101
|
+
TABLE_NAME AS table_name,
|
|
102
|
+
COLUMN_NAME AS column_name,
|
|
103
|
+
DATA_TYPE AS data_type,
|
|
104
|
+
IS_NULLABLE AS is_nullable
|
|
105
|
+
FROM INFORMATION_SCHEMA.COLUMNS
|
|
106
|
+
${schema && `WHERE TABLE_SCHEMA = '${schema}'`}
|
|
107
|
+
ORDER BY TABLE_NAME, ORDINAL_POSITION;`;
|
|
107
108
|
const rep = await appDataSource.query(sql);
|
|
108
109
|
return formatToSqlTable(rep);
|
|
109
110
|
}
|
|
@@ -169,6 +170,9 @@ const generateTableInfoFromTables = async (tables, appDataSource, nbSampleRow, c
|
|
|
169
170
|
if (appDataSource.options.type === "postgres") {
|
|
170
171
|
schema = appDataSource.options?.schema ?? "public";
|
|
171
172
|
}
|
|
173
|
+
else if (appDataSource.options.type === "mssql") {
|
|
174
|
+
schema = appDataSource.options?.schema;
|
|
175
|
+
}
|
|
172
176
|
else if (appDataSource.options.type === "sap") {
|
|
173
177
|
schema =
|
|
174
178
|
appDataSource.options?.schema ??
|
|
@@ -198,7 +202,10 @@ const generateTableInfoFromTables = async (tables, appDataSource, nbSampleRow, c
|
|
|
198
202
|
sqlSelectInfoQuery = `SELECT * FROM "${schema}"."${currentTable.tableName}" LIMIT ${nbSampleRow};\n`;
|
|
199
203
|
}
|
|
200
204
|
else if (appDataSource.options.type === "mssql") {
|
|
201
|
-
|
|
205
|
+
const schema = appDataSource.options?.schema;
|
|
206
|
+
sqlSelectInfoQuery = schema
|
|
207
|
+
? `SELECT TOP ${nbSampleRow} * FROM ${schema}.[${currentTable.tableName}];\n`
|
|
208
|
+
: `SELECT TOP ${nbSampleRow} * FROM [${currentTable.tableName}];\n`;
|
|
202
209
|
}
|
|
203
210
|
else if (appDataSource.options.type === "sap") {
|
|
204
211
|
const schema = appDataSource.options?.schema ??
|
package/dist/util/sql_utils.js
CHANGED
|
@@ -90,14 +90,15 @@ export const getTableAndColumnsName = async (appDataSource) => {
|
|
|
90
90
|
return formatToSqlTable(rep);
|
|
91
91
|
}
|
|
92
92
|
if (appDataSource.options.type === "mssql") {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
const schema = appDataSource.options?.schema;
|
|
94
|
+
const sql = `SELECT
|
|
95
|
+
TABLE_NAME AS table_name,
|
|
96
|
+
COLUMN_NAME AS column_name,
|
|
97
|
+
DATA_TYPE AS data_type,
|
|
98
|
+
IS_NULLABLE AS is_nullable
|
|
99
|
+
FROM INFORMATION_SCHEMA.COLUMNS
|
|
100
|
+
${schema && `WHERE TABLE_SCHEMA = '${schema}'`}
|
|
101
|
+
ORDER BY TABLE_NAME, ORDINAL_POSITION;`;
|
|
101
102
|
const rep = await appDataSource.query(sql);
|
|
102
103
|
return formatToSqlTable(rep);
|
|
103
104
|
}
|
|
@@ -162,6 +163,9 @@ export const generateTableInfoFromTables = async (tables, appDataSource, nbSampl
|
|
|
162
163
|
if (appDataSource.options.type === "postgres") {
|
|
163
164
|
schema = appDataSource.options?.schema ?? "public";
|
|
164
165
|
}
|
|
166
|
+
else if (appDataSource.options.type === "mssql") {
|
|
167
|
+
schema = appDataSource.options?.schema;
|
|
168
|
+
}
|
|
165
169
|
else if (appDataSource.options.type === "sap") {
|
|
166
170
|
schema =
|
|
167
171
|
appDataSource.options?.schema ??
|
|
@@ -191,7 +195,10 @@ export const generateTableInfoFromTables = async (tables, appDataSource, nbSampl
|
|
|
191
195
|
sqlSelectInfoQuery = `SELECT * FROM "${schema}"."${currentTable.tableName}" LIMIT ${nbSampleRow};\n`;
|
|
192
196
|
}
|
|
193
197
|
else if (appDataSource.options.type === "mssql") {
|
|
194
|
-
|
|
198
|
+
const schema = appDataSource.options?.schema;
|
|
199
|
+
sqlSelectInfoQuery = schema
|
|
200
|
+
? `SELECT TOP ${nbSampleRow} * FROM ${schema}.[${currentTable.tableName}];\n`
|
|
201
|
+
: `SELECT TOP ${nbSampleRow} * FROM [${currentTable.tableName}];\n`;
|
|
195
202
|
}
|
|
196
203
|
else if (appDataSource.options.type === "sap") {
|
|
197
204
|
const schema = appDataSource.options?.schema ??
|
|
@@ -17,5 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const entrypoint_deprecation_js_1 = require("../util/entrypoint_deprecation.cjs");
|
|
18
18
|
/* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion010MigrationWarning)({
|
|
19
19
|
oldEntrypointName: "vectorstores/pinecone",
|
|
20
|
+
newEntrypointName: "",
|
|
21
|
+
newPackageName: "@langchain/pinecone",
|
|
20
22
|
});
|
|
21
23
|
__exportStar(require("@langchain/community/vectorstores/pinecone"), exports);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
|
|
2
2
|
/* #__PURE__ */ logVersion010MigrationWarning({
|
|
3
3
|
oldEntrypointName: "vectorstores/pinecone",
|
|
4
|
+
newEntrypointName: "",
|
|
5
|
+
newPackageName: "@langchain/pinecone",
|
|
4
6
|
});
|
|
5
7
|
export * from "@langchain/community/vectorstores/pinecone";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -886,7 +886,7 @@
|
|
|
886
886
|
"build:cjs": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist-cjs/ -p tsconfig.cjs.json && node scripts/move-cjs-to-dist.js && rimraf dist-cjs",
|
|
887
887
|
"build:watch": "node scripts/create-entrypoints.js && tsc --outDir dist/ --watch",
|
|
888
888
|
"build:scripts": "node scripts/create-entrypoints.js && node scripts/check-tree-shaking.js",
|
|
889
|
-
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint src",
|
|
889
|
+
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
|
|
890
890
|
"lint:dpdm": "dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
891
891
|
"lint": "yarn lint:eslint && yarn lint:dpdm",
|
|
892
892
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
|
|
@@ -898,8 +898,8 @@
|
|
|
898
898
|
"test:watch": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
|
899
899
|
"test:integration": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
900
900
|
"test:single": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
|
|
901
|
-
"format": "prettier --write \"src\"",
|
|
902
|
-
"format:check": "prettier --check \"src\""
|
|
901
|
+
"format": "prettier --config .prettierrc --write \"src\" \"scripts\"",
|
|
902
|
+
"format:check": "prettier --config .prettierrc --check \"src\" \"scripts\""
|
|
903
903
|
},
|
|
904
904
|
"author": "LangChain",
|
|
905
905
|
"license": "MIT",
|
|
@@ -1203,7 +1203,7 @@
|
|
|
1203
1203
|
"dependencies": {
|
|
1204
1204
|
"@anthropic-ai/sdk": "^0.9.1",
|
|
1205
1205
|
"@langchain/community": "~0.0.17",
|
|
1206
|
-
"@langchain/core": "~0.1.
|
|
1206
|
+
"@langchain/core": "~0.1.16",
|
|
1207
1207
|
"@langchain/openai": "~0.0.12",
|
|
1208
1208
|
"binary-extensions": "^2.2.0",
|
|
1209
1209
|
"expr-eval": "^2.0.2",
|
|
@@ -1217,8 +1217,8 @@
|
|
|
1217
1217
|
"p-retry": "4",
|
|
1218
1218
|
"uuid": "^9.0.0",
|
|
1219
1219
|
"yaml": "^2.2.1",
|
|
1220
|
-
"zod": "^3.22.
|
|
1221
|
-
"zod-to-json-schema": "3.
|
|
1220
|
+
"zod": "^3.22.4",
|
|
1221
|
+
"zod-to-json-schema": "^3.22.3"
|
|
1222
1222
|
},
|
|
1223
1223
|
"publishConfig": {
|
|
1224
1224
|
"access": "public"
|