langchain 0.0.132 → 0.0.134

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 (70) hide show
  1. package/dist/agents/chat/outputParser.cjs +2 -1
  2. package/dist/agents/chat/outputParser.js +2 -1
  3. package/dist/agents/executor.cjs +106 -7
  4. package/dist/agents/executor.d.ts +23 -0
  5. package/dist/agents/executor.js +104 -6
  6. package/dist/agents/mrkl/outputParser.cjs +2 -1
  7. package/dist/agents/mrkl/outputParser.js +2 -1
  8. package/dist/callbacks/index.cjs +2 -1
  9. package/dist/callbacks/index.d.ts +1 -1
  10. package/dist/callbacks/index.js +1 -1
  11. package/dist/chains/sql_db/sql_db_chain.d.ts +1 -1
  12. package/dist/chains/sql_db/sql_db_prompt.d.ts +6 -6
  13. package/dist/chat_models/googlevertexai.cjs +1 -1
  14. package/dist/chat_models/googlevertexai.d.ts +2 -2
  15. package/dist/chat_models/googlevertexai.js +2 -2
  16. package/dist/chat_models/ollama.cjs +8 -8
  17. package/dist/chat_models/ollama.js +8 -8
  18. package/dist/document_loaders/web/notionapi.cjs +153 -74
  19. package/dist/document_loaders/web/notionapi.d.ts +19 -10
  20. package/dist/document_loaders/web/notionapi.js +154 -75
  21. package/dist/document_loaders/web/recursive_url.cjs +177 -0
  22. package/dist/document_loaders/web/recursive_url.d.ts +27 -0
  23. package/dist/document_loaders/web/recursive_url.js +173 -0
  24. package/dist/embeddings/googlevertexai.cjs +1 -1
  25. package/dist/embeddings/googlevertexai.d.ts +2 -2
  26. package/dist/embeddings/googlevertexai.js +2 -2
  27. package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +1 -1
  28. package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -2
  29. package/dist/experimental/multimodal_embeddings/googlevertexai.js +2 -2
  30. package/dist/hub.cjs +16 -0
  31. package/dist/hub.d.ts +4 -0
  32. package/dist/hub.js +11 -0
  33. package/dist/llms/bedrock.cjs +63 -19
  34. package/dist/llms/bedrock.d.ts +9 -1
  35. package/dist/llms/bedrock.js +63 -19
  36. package/dist/llms/googlevertexai.cjs +1 -1
  37. package/dist/llms/googlevertexai.js +2 -2
  38. package/dist/load/import_constants.cjs +3 -0
  39. package/dist/load/import_constants.js +3 -0
  40. package/dist/schema/output_parser.cjs +2 -2
  41. package/dist/schema/output_parser.js +2 -2
  42. package/dist/tools/base.cjs +26 -2
  43. package/dist/tools/base.d.ts +9 -0
  44. package/dist/tools/base.js +24 -1
  45. package/dist/tools/sql.cjs +9 -3
  46. package/dist/tools/sql.d.ts +0 -1
  47. package/dist/tools/sql.js +9 -3
  48. package/dist/types/googlevertexai-types.d.ts +8 -3
  49. package/dist/util/googlevertexai-connection.cjs +49 -15
  50. package/dist/util/googlevertexai-connection.d.ts +12 -4
  51. package/dist/util/googlevertexai-connection.js +46 -13
  52. package/dist/vectorstores/googlevertexai.cjs +551 -0
  53. package/dist/vectorstores/googlevertexai.d.ts +180 -0
  54. package/dist/vectorstores/googlevertexai.js +520 -0
  55. package/dist/vectorstores/myscale.cjs +2 -2
  56. package/dist/vectorstores/myscale.d.ts +1 -1
  57. package/dist/vectorstores/myscale.js +2 -2
  58. package/dist/vectorstores/vectara.cjs +11 -2
  59. package/dist/vectorstores/vectara.d.ts +10 -1
  60. package/dist/vectorstores/vectara.js +11 -2
  61. package/document_loaders/web/recursive_url.cjs +1 -0
  62. package/document_loaders/web/recursive_url.d.ts +1 -0
  63. package/document_loaders/web/recursive_url.js +1 -0
  64. package/hub.cjs +1 -0
  65. package/hub.d.ts +1 -0
  66. package/hub.js +1 -0
  67. package/package.json +41 -2
  68. package/vectorstores/googlevertexai.cjs +1 -0
  69. package/vectorstores/googlevertexai.d.ts +1 -0
  70. package/vectorstores/googlevertexai.js +1 -0
@@ -98,7 +98,7 @@ class MyScaleStore extends base_js_1.VectorStore {
98
98
  };
99
99
  this.database = args.database || "default";
100
100
  this.table = args.table || "vector_table";
101
- this.metric = args.metric || "cosine";
101
+ this.metric = args.metric || "Cosine";
102
102
  this.client = (0, client_1.createClient)({
103
103
  host: `${args.protocol ?? "https://"}${args.host}:${args.port}`,
104
104
  username: args.username,
@@ -263,7 +263,7 @@ class MyScaleStore extends base_js_1.VectorStore {
263
263
  * @returns The SQL query string.
264
264
  */
265
265
  buildSearchQuery(query, k, filter) {
266
- const order = this.metric === "ip" ? "DESC" : "ASC";
266
+ const order = this.metric === "IP" ? "DESC" : "ASC";
267
267
  const whereStr = filter ? `PREWHERE ${filter.whereStr}` : "";
268
268
  return `
269
269
  SELECT ${this.columnMap.text} AS text, ${this.columnMap.metadata} AS metadata, dist
@@ -31,7 +31,7 @@ export interface ColumnMap {
31
31
  /**
32
32
  * Type of metric used in the MyScale database.
33
33
  */
34
- export type metric = "ip" | "cosine" | "l2";
34
+ export type metric = "L2" | "Cosine" | "IP";
35
35
  /**
36
36
  * Type for filtering search results in the MyScale database.
37
37
  */
@@ -72,7 +72,7 @@ export class MyScaleStore extends VectorStore {
72
72
  };
73
73
  this.database = args.database || "default";
74
74
  this.table = args.table || "vector_table";
75
- this.metric = args.metric || "cosine";
75
+ this.metric = args.metric || "Cosine";
76
76
  this.client = createClient({
77
77
  host: `${args.protocol ?? "https://"}${args.host}:${args.port}`,
78
78
  username: args.username,
@@ -237,7 +237,7 @@ export class MyScaleStore extends VectorStore {
237
237
  * @returns The SQL query string.
238
238
  */
239
239
  buildSearchQuery(query, k, filter) {
240
- const order = this.metric === "ip" ? "DESC" : "ASC";
240
+ const order = this.metric === "IP" ? "DESC" : "ASC";
241
241
  const whereStr = filter ? `PREWHERE ${filter.whereStr}` : "";
242
242
  return `
243
243
  SELECT ${this.columnMap.text} AS text, ${this.columnMap.metadata} AS metadata, dist
@@ -163,10 +163,19 @@ class VectaraStore extends base_js_1.VectorStore {
163
163
  console.log(`Added ${countAdded} documents to Vectara`);
164
164
  }
165
165
  }
166
- async addFiles(filePaths, metadata = undefined) {
166
+ /**
167
+ * Vectara provides a way to add documents directly via their API. This API handles
168
+ * pre-processing and chunking internally in an optimal manner. This method is a wrapper
169
+ * to utilize that API within LangChain.
170
+ *
171
+ * @param filePaths An array of Blob objects representing the files to be uploaded to Vectara.
172
+ * @param metadata Optional. An array of metadata objects corresponding to each file in the `filePaths` array.
173
+ * @returns A Promise that resolves to the number of successfully uploaded files.
174
+ */
175
+ async addFiles(filePaths, metadatas = undefined) {
167
176
  let numDocs = 0;
168
177
  for (const [index, fileBlob] of filePaths.entries()) {
169
- const md = metadata ? metadata[index] : {};
178
+ const md = metadatas ? metadatas[index] : {};
170
179
  const data = new FormData();
171
180
  data.append("file", fileBlob, `file_${index}`);
172
181
  data.append("doc-metadata", JSON.stringify(md));
@@ -75,7 +75,16 @@ export declare class VectaraStore extends VectorStore {
75
75
  * @returns A Promise that resolves when the documents have been added.
76
76
  */
77
77
  addDocuments(documents: Document[]): Promise<void>;
78
- addFiles(filePaths: Blob[], metadata?: Record<string, unknown> | undefined): Promise<number>;
78
+ /**
79
+ * Vectara provides a way to add documents directly via their API. This API handles
80
+ * pre-processing and chunking internally in an optimal manner. This method is a wrapper
81
+ * to utilize that API within LangChain.
82
+ *
83
+ * @param filePaths An array of Blob objects representing the files to be uploaded to Vectara.
84
+ * @param metadata Optional. An array of metadata objects corresponding to each file in the `filePaths` array.
85
+ * @returns A Promise that resolves to the number of successfully uploaded files.
86
+ */
87
+ addFiles(filePaths: Blob[], metadatas?: Record<string, unknown> | undefined): Promise<number>;
79
88
  /**
80
89
  * Performs a similarity search and returns documents along with their
81
90
  * scores.
@@ -160,10 +160,19 @@ export class VectaraStore extends VectorStore {
160
160
  console.log(`Added ${countAdded} documents to Vectara`);
161
161
  }
162
162
  }
163
- async addFiles(filePaths, metadata = undefined) {
163
+ /**
164
+ * Vectara provides a way to add documents directly via their API. This API handles
165
+ * pre-processing and chunking internally in an optimal manner. This method is a wrapper
166
+ * to utilize that API within LangChain.
167
+ *
168
+ * @param filePaths An array of Blob objects representing the files to be uploaded to Vectara.
169
+ * @param metadata Optional. An array of metadata objects corresponding to each file in the `filePaths` array.
170
+ * @returns A Promise that resolves to the number of successfully uploaded files.
171
+ */
172
+ async addFiles(filePaths, metadatas = undefined) {
164
173
  let numDocs = 0;
165
174
  for (const [index, fileBlob] of filePaths.entries()) {
166
- const md = metadata ? metadata[index] : {};
175
+ const md = metadatas ? metadatas[index] : {};
167
176
  const data = new FormData();
168
177
  data.append("file", fileBlob, `file_${index}`);
169
178
  data.append("doc-metadata", JSON.stringify(md));
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/document_loaders/web/recursive_url.cjs');
@@ -0,0 +1 @@
1
+ export * from '../../dist/document_loaders/web/recursive_url.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/document_loaders/web/recursive_url.js'
package/hub.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/hub.cjs');
package/hub.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/hub.js'
package/hub.js ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/hub.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "0.0.132",
3
+ "version": "0.0.134",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "type": "module",
6
6
  "engines": {
@@ -169,6 +169,9 @@
169
169
  "vectorstores/chroma.cjs",
170
170
  "vectorstores/chroma.js",
171
171
  "vectorstores/chroma.d.ts",
172
+ "vectorstores/googlevertexai.cjs",
173
+ "vectorstores/googlevertexai.js",
174
+ "vectorstores/googlevertexai.d.ts",
172
175
  "vectorstores/hnswlib.cjs",
173
176
  "vectorstores/hnswlib.js",
174
177
  "vectorstores/hnswlib.d.ts",
@@ -298,6 +301,9 @@
298
301
  "document_loaders/web/notionapi.cjs",
299
302
  "document_loaders/web/notionapi.js",
300
303
  "document_loaders/web/notionapi.d.ts",
304
+ "document_loaders/web/recursive_url.cjs",
305
+ "document_loaders/web/recursive_url.js",
306
+ "document_loaders/web/recursive_url.d.ts",
301
307
  "document_loaders/web/s3.cjs",
302
308
  "document_loaders/web/s3.js",
303
309
  "document_loaders/web/s3.d.ts",
@@ -532,6 +538,9 @@
532
538
  "storage/ioredis.cjs",
533
539
  "storage/ioredis.js",
534
540
  "storage/ioredis.d.ts",
541
+ "hub.cjs",
542
+ "hub.js",
543
+ "hub.d.ts",
535
544
  "util/math.cjs",
536
545
  "util/math.js",
537
546
  "util/math.d.ts",
@@ -611,6 +620,8 @@
611
620
  "@planetscale/database": "^1.8.0",
612
621
  "@qdrant/js-client-rest": "^1.2.0",
613
622
  "@raycast/api": "^1.55.2",
623
+ "@smithy/eventstream-codec": "^2.0.5",
624
+ "@smithy/util-utf8": "^2.0.0",
614
625
  "@supabase/postgrest-js": "^1.1.1",
615
626
  "@supabase/supabase-js": "^2.10.0",
616
627
  "@tensorflow-models/universal-sentence-encoder": "^1.3.3",
@@ -661,6 +672,7 @@
661
672
  "ioredis": "^5.3.2",
662
673
  "jest": "^29.5.0",
663
674
  "jsdom": "^22.1.0",
675
+ "langchainhub": "~0.0.3",
664
676
  "mammoth": "^1.5.1",
665
677
  "ml-matrix": "^6.10.4",
666
678
  "mongodb": "^5.2.0",
@@ -719,6 +731,8 @@
719
731
  "@planetscale/database": "^1.8.0",
720
732
  "@qdrant/js-client-rest": "^1.2.0",
721
733
  "@raycast/api": "^1.55.2",
734
+ "@smithy/eventstream-codec": "^2.0.5",
735
+ "@smithy/util-utf8": "^2.0.0",
722
736
  "@supabase/postgrest-js": "^1.1.1",
723
737
  "@supabase/supabase-js": "^2.10.0",
724
738
  "@tensorflow-models/universal-sentence-encoder": "*",
@@ -743,6 +757,7 @@
743
757
  "ignore": "^5.2.0",
744
758
  "ioredis": "^5.3.2",
745
759
  "jsdom": "*",
760
+ "langchainhub": "~0.0.3",
746
761
  "mammoth": "*",
747
762
  "mongodb": "^5.2.0",
748
763
  "mysql2": "^3.3.3",
@@ -845,6 +860,12 @@
845
860
  "@raycast/api": {
846
861
  "optional": true
847
862
  },
863
+ "@smithy/eventstream-codec": {
864
+ "optional": true
865
+ },
866
+ "@smithy/util-utf8": {
867
+ "optional": true
868
+ },
848
869
  "@supabase/postgrest-js": {
849
870
  "optional": true
850
871
  },
@@ -917,6 +938,9 @@
917
938
  "jsdom": {
918
939
  "optional": true
919
940
  },
941
+ "langchainhub": {
942
+ "optional": true
943
+ },
920
944
  "mammoth": {
921
945
  "optional": true
922
946
  },
@@ -995,7 +1019,7 @@
995
1019
  "js-tiktoken": "^1.0.7",
996
1020
  "js-yaml": "^4.1.0",
997
1021
  "jsonpointer": "^5.0.1",
998
- "langsmith": "~0.0.16",
1022
+ "langsmith": "~0.0.26",
999
1023
  "ml-distance": "^4.0.0",
1000
1024
  "object-hash": "^3.0.0",
1001
1025
  "openai": "^3.3.0",
@@ -1301,6 +1325,11 @@
1301
1325
  "import": "./vectorstores/chroma.js",
1302
1326
  "require": "./vectorstores/chroma.cjs"
1303
1327
  },
1328
+ "./vectorstores/googlevertexai": {
1329
+ "types": "./vectorstores/googlevertexai.d.ts",
1330
+ "import": "./vectorstores/googlevertexai.js",
1331
+ "require": "./vectorstores/googlevertexai.cjs"
1332
+ },
1304
1333
  "./vectorstores/hnswlib": {
1305
1334
  "types": "./vectorstores/hnswlib.d.ts",
1306
1335
  "import": "./vectorstores/hnswlib.js",
@@ -1518,6 +1547,11 @@
1518
1547
  "import": "./document_loaders/web/notionapi.js",
1519
1548
  "require": "./document_loaders/web/notionapi.cjs"
1520
1549
  },
1550
+ "./document_loaders/web/recursive_url": {
1551
+ "types": "./document_loaders/web/recursive_url.d.ts",
1552
+ "import": "./document_loaders/web/recursive_url.js",
1553
+ "require": "./document_loaders/web/recursive_url.cjs"
1554
+ },
1521
1555
  "./document_loaders/web/s3": {
1522
1556
  "types": "./document_loaders/web/s3.d.ts",
1523
1557
  "import": "./document_loaders/web/s3.js",
@@ -1912,6 +1946,11 @@
1912
1946
  "import": "./storage/ioredis.js",
1913
1947
  "require": "./storage/ioredis.cjs"
1914
1948
  },
1949
+ "./hub": {
1950
+ "types": "./hub.d.ts",
1951
+ "import": "./hub.js",
1952
+ "require": "./hub.cjs"
1953
+ },
1915
1954
  "./util/math": {
1916
1955
  "types": "./util/math.d.ts",
1917
1956
  "import": "./util/math.js",
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/vectorstores/googlevertexai.cjs');
@@ -0,0 +1 @@
1
+ export * from '../dist/vectorstores/googlevertexai.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/vectorstores/googlevertexai.js'