langchain 0.1.34 → 0.1.36

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.
Files changed (72) hide show
  1. package/dist/chains/history_aware_retriever.cjs +1 -2
  2. package/dist/chains/history_aware_retriever.d.ts +1 -2
  3. package/dist/chains/history_aware_retriever.js +1 -2
  4. package/dist/chains/openai_functions/base.cjs +2 -0
  5. package/dist/chains/openai_functions/base.d.ts +2 -0
  6. package/dist/chains/openai_functions/base.js +2 -0
  7. package/dist/chains/query_constructor/index.cjs +5 -8
  8. package/dist/chains/query_constructor/index.d.ts +5 -4
  9. package/dist/chains/query_constructor/index.js +3 -6
  10. package/dist/chains/query_constructor/ir.cjs +15 -139
  11. package/dist/chains/query_constructor/ir.d.ts +1 -138
  12. package/dist/chains/query_constructor/ir.js +1 -132
  13. package/dist/chains/query_constructor/prompt.cjs +2 -2
  14. package/dist/chains/query_constructor/prompt.d.ts +1 -1
  15. package/dist/chains/query_constructor/prompt.js +1 -1
  16. package/dist/document_loaders/web/firecrawl.cjs +88 -0
  17. package/dist/document_loaders/web/firecrawl.d.ts +48 -0
  18. package/dist/document_loaders/web/firecrawl.js +81 -0
  19. package/dist/load/import_constants.cjs +1 -0
  20. package/dist/load/import_constants.js +1 -0
  21. package/dist/output_parsers/expression.cjs +1 -1
  22. package/dist/output_parsers/expression.d.ts +1 -1
  23. package/dist/output_parsers/expression.js +1 -1
  24. package/dist/retrievers/multi_query.cjs +24 -3
  25. package/dist/retrievers/multi_query.d.ts +6 -0
  26. package/dist/retrievers/multi_query.js +24 -3
  27. package/dist/retrievers/parent_document.cjs +20 -1
  28. package/dist/retrievers/parent_document.d.ts +6 -0
  29. package/dist/retrievers/parent_document.js +20 -1
  30. package/dist/retrievers/self_query/base.cjs +3 -136
  31. package/dist/retrievers/self_query/base.d.ts +1 -69
  32. package/dist/retrievers/self_query/base.js +1 -134
  33. package/dist/retrievers/self_query/chroma.cjs +9 -10
  34. package/dist/retrievers/self_query/chroma.d.ts +1 -1
  35. package/dist/retrievers/self_query/chroma.js +1 -2
  36. package/dist/retrievers/self_query/functional.cjs +2 -195
  37. package/dist/retrievers/self_query/functional.d.ts +1 -87
  38. package/dist/retrievers/self_query/functional.js +1 -194
  39. package/dist/retrievers/self_query/index.cjs +9 -13
  40. package/dist/retrievers/self_query/index.d.ts +11 -8
  41. package/dist/retrievers/self_query/index.js +7 -11
  42. package/dist/retrievers/self_query/pinecone.cjs +9 -10
  43. package/dist/retrievers/self_query/pinecone.d.ts +1 -1
  44. package/dist/retrievers/self_query/pinecone.js +1 -2
  45. package/dist/retrievers/self_query/supabase.cjs +28 -30
  46. package/dist/retrievers/self_query/supabase.d.ts +1 -2
  47. package/dist/retrievers/self_query/supabase.js +1 -3
  48. package/dist/retrievers/self_query/supabase_utils.cjs +2 -2
  49. package/dist/retrievers/self_query/supabase_utils.d.ts +1 -1
  50. package/dist/retrievers/self_query/supabase_utils.js +1 -1
  51. package/dist/retrievers/self_query/vectara.cjs +15 -17
  52. package/dist/retrievers/self_query/vectara.d.ts +1 -2
  53. package/dist/retrievers/self_query/vectara.js +1 -3
  54. package/dist/retrievers/self_query/weaviate.cjs +19 -21
  55. package/dist/retrievers/self_query/weaviate.d.ts +1 -2
  56. package/dist/retrievers/self_query/weaviate.js +1 -3
  57. package/dist/smith/runner_utils.cjs +18 -10
  58. package/dist/smith/runner_utils.js +18 -10
  59. package/dist/storage/in_memory.cjs +2 -81
  60. package/dist/storage/in_memory.d.ts +1 -49
  61. package/dist/storage/in_memory.js +1 -80
  62. package/dist/text_splitter.cjs +15 -727
  63. package/dist/text_splitter.d.ts +1 -77
  64. package/dist/text_splitter.js +1 -720
  65. package/document_loaders/web/firecrawl.cjs +1 -0
  66. package/document_loaders/web/firecrawl.d.cts +1 -0
  67. package/document_loaders/web/firecrawl.d.ts +1 -0
  68. package/document_loaders/web/firecrawl.js +1 -0
  69. package/package.json +22 -3
  70. package/dist/retrievers/self_query/utils.cjs +0 -94
  71. package/dist/retrievers/self_query/utils.d.ts +0 -29
  72. package/dist/retrievers/self_query/utils.js +0 -85
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/document_loaders/web/firecrawl.cjs');
@@ -0,0 +1 @@
1
+ export * from '../../dist/document_loaders/web/firecrawl.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/document_loaders/web/firecrawl.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/document_loaders/web/firecrawl.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "type": "module",
6
6
  "engines": {
@@ -578,6 +578,10 @@
578
578
  "document_loaders/web/figma.js",
579
579
  "document_loaders/web/figma.d.ts",
580
580
  "document_loaders/web/figma.d.cts",
581
+ "document_loaders/web/firecrawl.cjs",
582
+ "document_loaders/web/firecrawl.js",
583
+ "document_loaders/web/firecrawl.d.ts",
584
+ "document_loaders/web/firecrawl.d.cts",
581
585
  "document_loaders/web/github.cjs",
582
586
  "document_loaders/web/github.js",
583
587
  "document_loaders/web/github.d.ts",
@@ -1190,7 +1194,7 @@
1190
1194
  "homepage": "https://github.com/langchain-ai/langchainjs/tree/main/langchain/",
1191
1195
  "scripts": {
1192
1196
  "build": "yarn run build:deps && yarn clean && yarn build:esm && yarn build:cjs && yarn build:scripts",
1193
- "build:deps": "yarn run turbo:command build --filter=@langchain/openai --filter=@langchain/community --concurrency=1",
1197
+ "build:deps": "yarn run turbo:command build --filter=@langchain/openai --filter=@langchain/community --filter=@langchain/textsplitters --concurrency=1",
1194
1198
  "build:esm": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist/ && rimraf dist/tests dist/**/tests",
1195
1199
  "build:cjs": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist-cjs/ -p tsconfig.cjs.json && yarn move-cjs-to-dist && rimraf dist-cjs",
1196
1200
  "build:watch": "yarn create-entrypoints && tsc --outDir dist/ --watch",
@@ -1230,6 +1234,7 @@
1230
1234
  "@google-cloud/storage": "^7.7.0",
1231
1235
  "@jest/globals": "^29.5.0",
1232
1236
  "@langchain/scripts": "~0.0",
1237
+ "@mendable/firecrawl-js": "^0.0.13",
1233
1238
  "@notionhq/client": "^2.2.10",
1234
1239
  "@pinecone-database/pinecone": "^1.1.0",
1235
1240
  "@supabase/supabase-js": "^2.10.0",
@@ -1314,6 +1319,7 @@
1314
1319
  "@gomomento/sdk-web": "^1.51.1",
1315
1320
  "@google-ai/generativelanguage": "^0.2.1",
1316
1321
  "@google-cloud/storage": "^6.10.1 || ^7.7.0",
1322
+ "@mendable/firecrawl-js": "^0.0.13",
1317
1323
  "@notionhq/client": "^2.2.10",
1318
1324
  "@pinecone-database/pinecone": "*",
1319
1325
  "@supabase/supabase-js": "^2.10.0",
@@ -1386,6 +1392,9 @@
1386
1392
  "@google-cloud/storage": {
1387
1393
  "optional": true
1388
1394
  },
1395
+ "@mendable/firecrawl-js": {
1396
+ "optional": true
1397
+ },
1389
1398
  "@notionhq/client": {
1390
1399
  "optional": true
1391
1400
  },
@@ -1513,8 +1522,9 @@
1513
1522
  "dependencies": {
1514
1523
  "@anthropic-ai/sdk": "^0.9.1",
1515
1524
  "@langchain/community": "~0.0.47",
1516
- "@langchain/core": "~0.1.56",
1525
+ "@langchain/core": "~0.1.60",
1517
1526
  "@langchain/openai": "~0.0.28",
1527
+ "@langchain/textsplitters": "~0.0.0",
1518
1528
  "binary-extensions": "^2.2.0",
1519
1529
  "js-tiktoken": "^1.0.7",
1520
1530
  "js-yaml": "^4.1.0",
@@ -2825,6 +2835,15 @@
2825
2835
  "import": "./document_loaders/web/figma.js",
2826
2836
  "require": "./document_loaders/web/figma.cjs"
2827
2837
  },
2838
+ "./document_loaders/web/firecrawl": {
2839
+ "types": {
2840
+ "import": "./document_loaders/web/firecrawl.d.ts",
2841
+ "require": "./document_loaders/web/firecrawl.d.cts",
2842
+ "default": "./document_loaders/web/firecrawl.d.ts"
2843
+ },
2844
+ "import": "./document_loaders/web/firecrawl.js",
2845
+ "require": "./document_loaders/web/firecrawl.cjs"
2846
+ },
2828
2847
  "./document_loaders/web/github": {
2829
2848
  "types": {
2830
2849
  "import": "./document_loaders/web/github.d.ts",
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.castValue = exports.isString = exports.isFloat = exports.isInt = exports.isFilterEmpty = exports.isObject = void 0;
4
- /**
5
- * Checks if the provided argument is an object and not an array.
6
- */
7
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
- function isObject(obj) {
9
- return obj && typeof obj === "object" && !Array.isArray(obj);
10
- }
11
- exports.isObject = isObject;
12
- /**
13
- * Checks if a provided filter is empty. The filter can be a function, an
14
- * object, a string, or undefined.
15
- */
16
- function isFilterEmpty(
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- filter) {
19
- if (!filter)
20
- return true;
21
- // for Milvus
22
- if (typeof filter === "string" && filter.length > 0) {
23
- return false;
24
- }
25
- if (typeof filter === "function") {
26
- return false;
27
- }
28
- return isObject(filter) && Object.keys(filter).length === 0;
29
- }
30
- exports.isFilterEmpty = isFilterEmpty;
31
- /**
32
- * Checks if the provided value is an integer.
33
- */
34
- function isInt(value) {
35
- if (typeof value === "number") {
36
- return value % 1 === 0;
37
- }
38
- else if (typeof value === "string") {
39
- const numberValue = parseInt(value, 10);
40
- return (!Number.isNaN(numberValue) &&
41
- numberValue % 1 === 0 &&
42
- numberValue.toString() === value);
43
- }
44
- return false;
45
- }
46
- exports.isInt = isInt;
47
- /**
48
- * Checks if the provided value is a floating-point number.
49
- */
50
- function isFloat(value) {
51
- if (typeof value === "number") {
52
- return value % 1 !== 0;
53
- }
54
- else if (typeof value === "string") {
55
- const numberValue = parseFloat(value);
56
- return (!Number.isNaN(numberValue) &&
57
- numberValue % 1 !== 0 &&
58
- numberValue.toString() === value);
59
- }
60
- return false;
61
- }
62
- exports.isFloat = isFloat;
63
- /**
64
- * Checks if the provided value is a string that cannot be parsed into a
65
- * number.
66
- */
67
- function isString(value) {
68
- return (typeof value === "string" &&
69
- (Number.isNaN(parseFloat(value)) || parseFloat(value).toString() !== value));
70
- }
71
- exports.isString = isString;
72
- /**
73
- * Casts a value that might be string or number to actual string or number.
74
- * Since LLM might return back an integer/float as a string, we need to cast
75
- * it back to a number, as many vector databases can't handle number as string
76
- * values as a comparator.
77
- */
78
- function castValue(input) {
79
- let value;
80
- if (isString(input)) {
81
- value = input;
82
- }
83
- else if (isInt(input)) {
84
- value = parseInt(input, 10);
85
- }
86
- else if (isFloat(input)) {
87
- value = parseFloat(input);
88
- }
89
- else {
90
- throw new Error("Unsupported value type");
91
- }
92
- return value;
93
- }
94
- exports.castValue = castValue;
@@ -1,29 +0,0 @@
1
- /**
2
- * Checks if the provided argument is an object and not an array.
3
- */
4
- export declare function isObject(obj: any): obj is object;
5
- /**
6
- * Checks if a provided filter is empty. The filter can be a function, an
7
- * object, a string, or undefined.
8
- */
9
- export declare function isFilterEmpty(filter: ((q: any) => any) | object | string | undefined): filter is undefined;
10
- /**
11
- * Checks if the provided value is an integer.
12
- */
13
- export declare function isInt(value: unknown): boolean;
14
- /**
15
- * Checks if the provided value is a floating-point number.
16
- */
17
- export declare function isFloat(value: unknown): boolean;
18
- /**
19
- * Checks if the provided value is a string that cannot be parsed into a
20
- * number.
21
- */
22
- export declare function isString(value: unknown): boolean;
23
- /**
24
- * Casts a value that might be string or number to actual string or number.
25
- * Since LLM might return back an integer/float as a string, we need to cast
26
- * it back to a number, as many vector databases can't handle number as string
27
- * values as a comparator.
28
- */
29
- export declare function castValue(input: unknown): string | number;
@@ -1,85 +0,0 @@
1
- /**
2
- * Checks if the provided argument is an object and not an array.
3
- */
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- export function isObject(obj) {
6
- return obj && typeof obj === "object" && !Array.isArray(obj);
7
- }
8
- /**
9
- * Checks if a provided filter is empty. The filter can be a function, an
10
- * object, a string, or undefined.
11
- */
12
- export function isFilterEmpty(
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- filter) {
15
- if (!filter)
16
- return true;
17
- // for Milvus
18
- if (typeof filter === "string" && filter.length > 0) {
19
- return false;
20
- }
21
- if (typeof filter === "function") {
22
- return false;
23
- }
24
- return isObject(filter) && Object.keys(filter).length === 0;
25
- }
26
- /**
27
- * Checks if the provided value is an integer.
28
- */
29
- export function isInt(value) {
30
- if (typeof value === "number") {
31
- return value % 1 === 0;
32
- }
33
- else if (typeof value === "string") {
34
- const numberValue = parseInt(value, 10);
35
- return (!Number.isNaN(numberValue) &&
36
- numberValue % 1 === 0 &&
37
- numberValue.toString() === value);
38
- }
39
- return false;
40
- }
41
- /**
42
- * Checks if the provided value is a floating-point number.
43
- */
44
- export function isFloat(value) {
45
- if (typeof value === "number") {
46
- return value % 1 !== 0;
47
- }
48
- else if (typeof value === "string") {
49
- const numberValue = parseFloat(value);
50
- return (!Number.isNaN(numberValue) &&
51
- numberValue % 1 !== 0 &&
52
- numberValue.toString() === value);
53
- }
54
- return false;
55
- }
56
- /**
57
- * Checks if the provided value is a string that cannot be parsed into a
58
- * number.
59
- */
60
- export function isString(value) {
61
- return (typeof value === "string" &&
62
- (Number.isNaN(parseFloat(value)) || parseFloat(value).toString() !== value));
63
- }
64
- /**
65
- * Casts a value that might be string or number to actual string or number.
66
- * Since LLM might return back an integer/float as a string, we need to cast
67
- * it back to a number, as many vector databases can't handle number as string
68
- * values as a comparator.
69
- */
70
- export function castValue(input) {
71
- let value;
72
- if (isString(input)) {
73
- value = input;
74
- }
75
- else if (isInt(input)) {
76
- value = parseInt(input, 10);
77
- }
78
- else if (isFloat(input)) {
79
- value = parseFloat(input);
80
- }
81
- else {
82
- throw new Error("Unsupported value type");
83
- }
84
- return value;
85
- }