langchain 0.0.146 → 0.0.148

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 (168) hide show
  1. package/chat_models/googlevertexai/web.cjs +1 -0
  2. package/chat_models/googlevertexai/web.d.ts +1 -0
  3. package/chat_models/googlevertexai/web.js +1 -0
  4. package/chat_models/googlevertexai.cjs +1 -1
  5. package/chat_models/googlevertexai.d.ts +1 -1
  6. package/chat_models/googlevertexai.js +1 -1
  7. package/dist/base_language/index.cjs +2 -2
  8. package/dist/base_language/index.d.ts +2 -1
  9. package/dist/base_language/index.js +1 -1
  10. package/dist/chains/base.d.ts +1 -1
  11. package/dist/chains/constitutional_ai/constitutional_principle.cjs +272 -1
  12. package/dist/chains/constitutional_ai/constitutional_principle.js +272 -1
  13. package/dist/chains/openai_functions/openapi.cjs +32 -27
  14. package/dist/chains/openai_functions/openapi.d.ts +9 -0
  15. package/dist/chains/openai_functions/openapi.js +31 -27
  16. package/dist/chat_models/base.d.ts +1 -1
  17. package/dist/chat_models/{googlevertexai.cjs → googlevertexai/common.cjs} +14 -26
  18. package/dist/chat_models/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -22
  19. package/dist/chat_models/{googlevertexai.js → googlevertexai/common.js} +12 -24
  20. package/dist/chat_models/googlevertexai/index.cjs +36 -0
  21. package/dist/chat_models/googlevertexai/index.d.ts +21 -0
  22. package/dist/chat_models/googlevertexai/index.js +31 -0
  23. package/dist/chat_models/googlevertexai/web.cjs +33 -0
  24. package/dist/chat_models/googlevertexai/web.d.ts +19 -0
  25. package/dist/chat_models/googlevertexai/web.js +28 -0
  26. package/dist/chat_models/openai.cjs +1 -1
  27. package/dist/chat_models/openai.js +1 -1
  28. package/dist/document_loaders/web/notionapi.cjs +93 -70
  29. package/dist/document_loaders/web/notionapi.d.ts +33 -1
  30. package/dist/document_loaders/web/notionapi.js +89 -71
  31. package/dist/embeddings/googlevertexai.cjs +5 -1
  32. package/dist/embeddings/googlevertexai.d.ts +2 -1
  33. package/dist/embeddings/googlevertexai.js +5 -1
  34. package/dist/evaluation/agents/index.cjs +17 -0
  35. package/dist/evaluation/agents/index.d.ts +1 -0
  36. package/dist/evaluation/agents/index.js +1 -0
  37. package/dist/evaluation/agents/prompt.cjs +132 -0
  38. package/dist/evaluation/agents/prompt.d.ts +6 -0
  39. package/dist/evaluation/agents/prompt.js +129 -0
  40. package/dist/evaluation/agents/trajectory.cjs +189 -0
  41. package/dist/evaluation/agents/trajectory.d.ts +54 -0
  42. package/dist/evaluation/agents/trajectory.js +184 -0
  43. package/dist/evaluation/base.cjs +274 -0
  44. package/dist/evaluation/base.d.ts +232 -0
  45. package/dist/evaluation/base.js +263 -0
  46. package/dist/evaluation/comparison/index.cjs +17 -0
  47. package/dist/evaluation/comparison/index.d.ts +1 -0
  48. package/dist/evaluation/comparison/index.js +1 -0
  49. package/dist/evaluation/comparison/pairwise.cjs +244 -0
  50. package/dist/evaluation/comparison/pairwise.d.ts +50 -0
  51. package/dist/evaluation/comparison/pairwise.js +238 -0
  52. package/dist/evaluation/comparison/prompt.cjs +74 -0
  53. package/dist/evaluation/comparison/prompt.d.ts +21 -0
  54. package/dist/evaluation/comparison/prompt.js +71 -0
  55. package/dist/evaluation/criteria/criteria.cjs +259 -0
  56. package/dist/evaluation/criteria/criteria.d.ts +73 -0
  57. package/dist/evaluation/criteria/criteria.js +253 -0
  58. package/dist/evaluation/criteria/index.cjs +17 -0
  59. package/dist/evaluation/criteria/index.d.ts +1 -0
  60. package/dist/evaluation/criteria/index.js +1 -0
  61. package/dist/evaluation/criteria/prompt.cjs +36 -0
  62. package/dist/evaluation/criteria/prompt.d.ts +12 -0
  63. package/dist/evaluation/criteria/prompt.js +33 -0
  64. package/dist/evaluation/embedding_distance/base.cjs +163 -0
  65. package/dist/evaluation/embedding_distance/base.d.ts +78 -0
  66. package/dist/evaluation/embedding_distance/base.js +156 -0
  67. package/dist/evaluation/embedding_distance/index.cjs +17 -0
  68. package/dist/evaluation/embedding_distance/index.d.ts +1 -0
  69. package/dist/evaluation/embedding_distance/index.js +1 -0
  70. package/dist/evaluation/index.cjs +6 -0
  71. package/dist/evaluation/index.d.ts +6 -0
  72. package/dist/evaluation/index.js +6 -0
  73. package/dist/evaluation/loader.cjs +60 -0
  74. package/dist/evaluation/loader.d.ts +27 -0
  75. package/dist/evaluation/loader.js +56 -0
  76. package/dist/evaluation/types.cjs +2 -0
  77. package/dist/evaluation/types.d.ts +35 -0
  78. package/dist/evaluation/types.js +1 -0
  79. package/dist/experimental/llms/bittensor.cjs +141 -0
  80. package/dist/experimental/llms/bittensor.d.ts +33 -0
  81. package/dist/experimental/llms/bittensor.js +137 -0
  82. package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +5 -1
  83. package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -1
  84. package/dist/experimental/multimodal_embeddings/googlevertexai.js +5 -1
  85. package/dist/hub.d.ts +1 -1
  86. package/dist/llms/base.d.ts +1 -1
  87. package/dist/llms/{googlevertexai.js → googlevertexai/common.cjs} +21 -17
  88. package/dist/llms/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -23
  89. package/dist/llms/{googlevertexai.cjs → googlevertexai/common.js} +17 -21
  90. package/dist/llms/googlevertexai/index.cjs +34 -0
  91. package/dist/llms/googlevertexai/index.d.ts +26 -0
  92. package/dist/llms/googlevertexai/index.js +30 -0
  93. package/dist/llms/googlevertexai/web.cjs +31 -0
  94. package/dist/llms/googlevertexai/web.d.ts +24 -0
  95. package/dist/llms/googlevertexai/web.js +27 -0
  96. package/dist/llms/openai-chat.cjs +1 -1
  97. package/dist/llms/openai-chat.js +1 -1
  98. package/dist/llms/openai.cjs +1 -1
  99. package/dist/llms/openai.js +1 -1
  100. package/dist/load/import_constants.cjs +3 -0
  101. package/dist/load/import_constants.js +3 -0
  102. package/dist/load/import_map.cjs +3 -2
  103. package/dist/load/import_map.d.ts +2 -1
  104. package/dist/load/import_map.js +2 -1
  105. package/dist/load/index.cjs +2 -1
  106. package/dist/load/index.js +2 -1
  107. package/dist/load/serializable.cjs +23 -4
  108. package/dist/load/serializable.js +23 -4
  109. package/dist/prompts/base.cjs +2 -2
  110. package/dist/prompts/base.d.ts +1 -1
  111. package/dist/prompts/base.js +1 -1
  112. package/dist/prompts/chat.cjs +2 -2
  113. package/dist/prompts/chat.d.ts +1 -1
  114. package/dist/prompts/chat.js +1 -1
  115. package/dist/retrievers/multi_query.cjs +140 -0
  116. package/dist/retrievers/multi_query.d.ts +33 -0
  117. package/dist/retrievers/multi_query.js +136 -0
  118. package/dist/schema/document.cjs +2 -2
  119. package/dist/schema/document.d.ts +1 -1
  120. package/dist/schema/document.js +1 -1
  121. package/dist/schema/output_parser.cjs +2 -2
  122. package/dist/schema/output_parser.d.ts +2 -1
  123. package/dist/schema/output_parser.js +1 -1
  124. package/dist/schema/retriever.cjs +2 -2
  125. package/dist/schema/retriever.d.ts +2 -1
  126. package/dist/schema/retriever.js +1 -1
  127. package/dist/schema/runnable/config.cjs +8 -0
  128. package/dist/schema/runnable/config.d.ts +3 -0
  129. package/dist/schema/runnable/config.js +4 -0
  130. package/dist/schema/{runnable.cjs → runnable/index.cjs} +290 -101
  131. package/dist/schema/{runnable.d.ts → runnable/index.d.ts} +127 -41
  132. package/dist/schema/{runnable.js → runnable/index.js} +284 -99
  133. package/dist/tools/base.d.ts +1 -1
  134. package/dist/types/googlevertexai-types.d.ts +11 -4
  135. package/dist/util/async_caller.cjs +35 -25
  136. package/dist/util/async_caller.d.ts +8 -0
  137. package/dist/util/async_caller.js +35 -25
  138. package/dist/util/googlevertexai-connection.cjs +14 -15
  139. package/dist/util/googlevertexai-connection.d.ts +7 -7
  140. package/dist/util/googlevertexai-connection.js +14 -15
  141. package/dist/util/googlevertexai-webauth.cjs +56 -0
  142. package/dist/util/googlevertexai-webauth.d.ts +25 -0
  143. package/dist/util/googlevertexai-webauth.js +52 -0
  144. package/dist/vectorstores/googlevertexai.cjs +9 -8
  145. package/dist/vectorstores/googlevertexai.d.ts +8 -7
  146. package/dist/vectorstores/googlevertexai.js +9 -8
  147. package/dist/vectorstores/pinecone.cjs +30 -22
  148. package/dist/vectorstores/pinecone.d.ts +3 -1
  149. package/dist/vectorstores/pinecone.js +30 -22
  150. package/dist/vectorstores/vectara.cjs +20 -23
  151. package/dist/vectorstores/vectara.d.ts +9 -2
  152. package/dist/vectorstores/vectara.js +20 -23
  153. package/experimental/llms/bittensor.cjs +1 -0
  154. package/experimental/llms/bittensor.d.ts +1 -0
  155. package/experimental/llms/bittensor.js +1 -0
  156. package/llms/googlevertexai/web.cjs +1 -0
  157. package/llms/googlevertexai/web.d.ts +1 -0
  158. package/llms/googlevertexai/web.js +1 -0
  159. package/llms/googlevertexai.cjs +1 -1
  160. package/llms/googlevertexai.d.ts +1 -1
  161. package/llms/googlevertexai.js +1 -1
  162. package/package.json +40 -3
  163. package/retrievers/multi_query.cjs +1 -0
  164. package/retrievers/multi_query.d.ts +1 -0
  165. package/retrievers/multi_query.js +1 -0
  166. package/schema/runnable.cjs +1 -1
  167. package/schema/runnable.d.ts +1 -1
  168. package/schema/runnable.js +1 -1
@@ -31,6 +31,8 @@ const uuid = __importStar(require("uuid"));
31
31
  const flat_1 = __importDefault(require("flat"));
32
32
  const base_js_1 = require("./base.cjs");
33
33
  const document_js_1 = require("../document.cjs");
34
+ const chunk_js_1 = require("../util/chunk.cjs");
35
+ const async_caller_js_1 = require("../util/async_caller.cjs");
34
36
  /**
35
37
  * Class that extends the VectorStore class and provides methods to
36
38
  * interact with the Pinecone vector database.
@@ -65,11 +67,19 @@ class PineconeStore extends base_js_1.VectorStore {
65
67
  writable: true,
66
68
  value: void 0
67
69
  });
70
+ Object.defineProperty(this, "caller", {
71
+ enumerable: true,
72
+ configurable: true,
73
+ writable: true,
74
+ value: void 0
75
+ });
68
76
  this.embeddings = embeddings;
69
- this.namespace = args.namespace;
70
- this.pineconeIndex = args.pineconeIndex;
71
- this.textKey = args.textKey ?? "text";
72
- this.filter = args.filter;
77
+ const { namespace, pineconeIndex, textKey, filter, ...asyncCallerArgs } = args;
78
+ this.namespace = namespace;
79
+ this.pineconeIndex = pineconeIndex;
80
+ this.textKey = textKey ?? "text";
81
+ this.filter = filter;
82
+ this.caller = new async_caller_js_1.AsyncCaller(asyncCallerArgs);
73
83
  }
74
84
  /**
75
85
  * Method that adds documents to the Pinecone database.
@@ -126,16 +136,15 @@ class PineconeStore extends base_js_1.VectorStore {
126
136
  };
127
137
  });
128
138
  // Pinecone recommends a limit of 100 vectors per upsert request
129
- const chunkSize = 50;
130
- for (let i = 0; i < pineconeVectors.length; i += chunkSize) {
131
- const chunk = pineconeVectors.slice(i, i + chunkSize);
132
- await this.pineconeIndex.upsert({
133
- upsertRequest: {
134
- vectors: chunk,
135
- namespace: this.namespace,
136
- },
137
- });
138
- }
139
+ const chunkSize = 100;
140
+ const chunkedVectors = (0, chunk_js_1.chunkArray)(pineconeVectors, chunkSize);
141
+ const batchRequests = chunkedVectors.map((chunk) => this.caller.call(async () => this.pineconeIndex.upsert({
142
+ upsertRequest: {
143
+ vectors: chunk,
144
+ namespace: this.namespace,
145
+ },
146
+ })));
147
+ await Promise.all(batchRequests);
139
148
  return documentIds;
140
149
  }
141
150
  /**
@@ -154,14 +163,13 @@ class PineconeStore extends base_js_1.VectorStore {
154
163
  }
155
164
  else if (ids) {
156
165
  const batchSize = 1000;
157
- for (let i = 0; i < ids.length; i += batchSize) {
158
- const batchIds = ids.slice(i, i + batchSize);
159
- await this.pineconeIndex.delete1({
160
- ids: batchIds,
161
- namespace,
162
- ...rest,
163
- });
164
- }
166
+ const batchedIds = (0, chunk_js_1.chunkArray)(ids, batchSize);
167
+ const batchRequests = batchedIds.map((batchIds) => this.caller.call(async () => this.pineconeIndex.delete1({
168
+ ids: batchIds,
169
+ namespace,
170
+ ...rest,
171
+ })));
172
+ await Promise.all(batchRequests);
165
173
  }
166
174
  else {
167
175
  throw new Error("Either ids or delete_all must be provided.");
@@ -1,9 +1,10 @@
1
1
  import { VectorStore } from "./base.js";
2
2
  import { Embeddings } from "../embeddings/base.js";
3
3
  import { Document } from "../document.js";
4
+ import { AsyncCaller, type AsyncCallerParams } from "../util/async_caller.js";
4
5
  type PineconeMetadata = Record<string, any>;
5
6
  type VectorOperationsApi = ReturnType<import("@pinecone-database/pinecone").PineconeClient["Index"]>;
6
- export interface PineconeLibArgs {
7
+ export interface PineconeLibArgs extends AsyncCallerParams {
7
8
  pineconeIndex: VectorOperationsApi;
8
9
  textKey?: string;
9
10
  namespace?: string;
@@ -28,6 +29,7 @@ export declare class PineconeStore extends VectorStore {
28
29
  namespace?: string;
29
30
  pineconeIndex: VectorOperationsApi;
30
31
  filter?: PineconeMetadata;
32
+ caller: AsyncCaller;
31
33
  _vectorstoreType(): string;
32
34
  constructor(embeddings: Embeddings, args: PineconeLibArgs);
33
35
  /**
@@ -2,6 +2,8 @@ import * as uuid from "uuid";
2
2
  import flatten from "flat";
3
3
  import { VectorStore } from "./base.js";
4
4
  import { Document } from "../document.js";
5
+ import { chunkArray } from "../util/chunk.js";
6
+ import { AsyncCaller } from "../util/async_caller.js";
5
7
  /**
6
8
  * Class that extends the VectorStore class and provides methods to
7
9
  * interact with the Pinecone vector database.
@@ -36,11 +38,19 @@ export class PineconeStore extends VectorStore {
36
38
  writable: true,
37
39
  value: void 0
38
40
  });
41
+ Object.defineProperty(this, "caller", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: void 0
46
+ });
39
47
  this.embeddings = embeddings;
40
- this.namespace = args.namespace;
41
- this.pineconeIndex = args.pineconeIndex;
42
- this.textKey = args.textKey ?? "text";
43
- this.filter = args.filter;
48
+ const { namespace, pineconeIndex, textKey, filter, ...asyncCallerArgs } = args;
49
+ this.namespace = namespace;
50
+ this.pineconeIndex = pineconeIndex;
51
+ this.textKey = textKey ?? "text";
52
+ this.filter = filter;
53
+ this.caller = new AsyncCaller(asyncCallerArgs);
44
54
  }
45
55
  /**
46
56
  * Method that adds documents to the Pinecone database.
@@ -97,16 +107,15 @@ export class PineconeStore extends VectorStore {
97
107
  };
98
108
  });
99
109
  // Pinecone recommends a limit of 100 vectors per upsert request
100
- const chunkSize = 50;
101
- for (let i = 0; i < pineconeVectors.length; i += chunkSize) {
102
- const chunk = pineconeVectors.slice(i, i + chunkSize);
103
- await this.pineconeIndex.upsert({
104
- upsertRequest: {
105
- vectors: chunk,
106
- namespace: this.namespace,
107
- },
108
- });
109
- }
110
+ const chunkSize = 100;
111
+ const chunkedVectors = chunkArray(pineconeVectors, chunkSize);
112
+ const batchRequests = chunkedVectors.map((chunk) => this.caller.call(async () => this.pineconeIndex.upsert({
113
+ upsertRequest: {
114
+ vectors: chunk,
115
+ namespace: this.namespace,
116
+ },
117
+ })));
118
+ await Promise.all(batchRequests);
110
119
  return documentIds;
111
120
  }
112
121
  /**
@@ -125,14 +134,13 @@ export class PineconeStore extends VectorStore {
125
134
  }
126
135
  else if (ids) {
127
136
  const batchSize = 1000;
128
- for (let i = 0; i < ids.length; i += batchSize) {
129
- const batchIds = ids.slice(i, i + batchSize);
130
- await this.pineconeIndex.delete1({
131
- ids: batchIds,
132
- namespace,
133
- ...rest,
134
- });
135
- }
137
+ const batchedIds = chunkArray(ids, batchSize);
138
+ const batchRequests = batchedIds.map((batchIds) => this.caller.call(async () => this.pineconeIndex.delete1({
139
+ ids: batchIds,
140
+ namespace,
141
+ ...rest,
142
+ })));
143
+ await Promise.all(batchRequests);
136
144
  }
137
145
  else {
138
146
  throw new Error("Either ids or delete_all must be provided.");
@@ -185,42 +185,39 @@ class VectaraStore extends base_js_1.VectorStore {
185
185
  * pre-processing and chunking internally in an optimal manner. This method is a wrapper
186
186
  * to utilize that API within LangChain.
187
187
  *
188
- * @param filePaths An array of Blob objects representing the files to be uploaded to Vectara.
188
+ * @param files An array of VectaraFile objects representing the files and their respective file names to be uploaded to Vectara.
189
189
  * @param metadata Optional. An array of metadata objects corresponding to each file in the `filePaths` array.
190
190
  * @returns A Promise that resolves to the number of successfully uploaded files.
191
191
  */
192
- async addFiles(filePaths, metadatas = undefined) {
192
+ async addFiles(files, metadatas = undefined) {
193
193
  if (this.corpusId.length > 1)
194
194
  throw new Error("addFiles does not support multiple corpus ids");
195
195
  let numDocs = 0;
196
- for (const [index, fileBlob] of filePaths.entries()) {
196
+ for (const [index, file] of files.entries()) {
197
197
  const md = metadatas ? metadatas[index] : {};
198
198
  const data = new FormData();
199
- data.append("file", fileBlob, `file_${index}`);
199
+ data.append("file", file.blob, file.fileName);
200
200
  data.append("doc-metadata", JSON.stringify(md));
201
- try {
202
- const response = await fetch(`https://api.vectara.io/v1/upload?c=${this.customerId}&o=${this.corpusId[0]}`, {
203
- method: "POST",
204
- headers: {
205
- "x-api-key": this.apiKey,
206
- },
207
- body: data,
208
- });
209
- const result = await response.json();
210
- const { status } = response;
211
- if (status !== 200 && status !== 409) {
212
- throw new Error(`Vectara API returned status code ${status}: ${result}`);
213
- }
214
- else {
215
- numDocs += 1;
216
- }
201
+ const response = await fetch(`https://api.vectara.io/v1/upload?c=${this.customerId}&o=${this.corpusId[0]}`, {
202
+ method: "POST",
203
+ headers: {
204
+ "x-api-key": this.apiKey,
205
+ },
206
+ body: data,
207
+ });
208
+ const { status } = response;
209
+ if (status === 409) {
210
+ throw new Error(`File at index ${index} already exists in Vectara`);
211
+ }
212
+ else if (status !== 200) {
213
+ throw new Error(`Vectara API returned status code ${status}`);
217
214
  }
218
- catch (err) {
219
- console.error(`Failed to upload file at index ${index}:`, err);
215
+ else {
216
+ numDocs += 1;
220
217
  }
221
218
  }
222
219
  if (this.verbose) {
223
- console.log(`Uploaded ${filePaths.length} files to Vectara`);
220
+ console.log(`Uploaded ${files.length} files to Vectara`);
224
221
  }
225
222
  return numDocs;
226
223
  }
@@ -21,6 +21,13 @@ interface VectaraCallHeader {
21
21
  "customer-id": string;
22
22
  };
23
23
  }
24
+ /**
25
+ * Interface for the file objects to be uploaded to Vectara.
26
+ */
27
+ export interface VectaraFile {
28
+ blob: Blob;
29
+ fileName: string;
30
+ }
24
31
  /**
25
32
  * Interface for the filter options used in Vectara API calls.
26
33
  */
@@ -80,11 +87,11 @@ export declare class VectaraStore extends VectorStore {
80
87
  * pre-processing and chunking internally in an optimal manner. This method is a wrapper
81
88
  * to utilize that API within LangChain.
82
89
  *
83
- * @param filePaths An array of Blob objects representing the files to be uploaded to Vectara.
90
+ * @param files An array of VectaraFile objects representing the files and their respective file names to be uploaded to Vectara.
84
91
  * @param metadata Optional. An array of metadata objects corresponding to each file in the `filePaths` array.
85
92
  * @returns A Promise that resolves to the number of successfully uploaded files.
86
93
  */
87
- addFiles(filePaths: Blob[], metadatas?: Record<string, unknown> | undefined): Promise<number>;
94
+ addFiles(files: VectaraFile[], metadatas?: Record<string, unknown> | undefined): Promise<number>;
88
95
  /**
89
96
  * Performs a similarity search and returns documents along with their
90
97
  * scores.
@@ -182,42 +182,39 @@ export class VectaraStore extends VectorStore {
182
182
  * pre-processing and chunking internally in an optimal manner. This method is a wrapper
183
183
  * to utilize that API within LangChain.
184
184
  *
185
- * @param filePaths An array of Blob objects representing the files to be uploaded to Vectara.
185
+ * @param files An array of VectaraFile objects representing the files and their respective file names to be uploaded to Vectara.
186
186
  * @param metadata Optional. An array of metadata objects corresponding to each file in the `filePaths` array.
187
187
  * @returns A Promise that resolves to the number of successfully uploaded files.
188
188
  */
189
- async addFiles(filePaths, metadatas = undefined) {
189
+ async addFiles(files, metadatas = undefined) {
190
190
  if (this.corpusId.length > 1)
191
191
  throw new Error("addFiles does not support multiple corpus ids");
192
192
  let numDocs = 0;
193
- for (const [index, fileBlob] of filePaths.entries()) {
193
+ for (const [index, file] of files.entries()) {
194
194
  const md = metadatas ? metadatas[index] : {};
195
195
  const data = new FormData();
196
- data.append("file", fileBlob, `file_${index}`);
196
+ data.append("file", file.blob, file.fileName);
197
197
  data.append("doc-metadata", JSON.stringify(md));
198
- try {
199
- const response = await fetch(`https://api.vectara.io/v1/upload?c=${this.customerId}&o=${this.corpusId[0]}`, {
200
- method: "POST",
201
- headers: {
202
- "x-api-key": this.apiKey,
203
- },
204
- body: data,
205
- });
206
- const result = await response.json();
207
- const { status } = response;
208
- if (status !== 200 && status !== 409) {
209
- throw new Error(`Vectara API returned status code ${status}: ${result}`);
210
- }
211
- else {
212
- numDocs += 1;
213
- }
198
+ const response = await fetch(`https://api.vectara.io/v1/upload?c=${this.customerId}&o=${this.corpusId[0]}`, {
199
+ method: "POST",
200
+ headers: {
201
+ "x-api-key": this.apiKey,
202
+ },
203
+ body: data,
204
+ });
205
+ const { status } = response;
206
+ if (status === 409) {
207
+ throw new Error(`File at index ${index} already exists in Vectara`);
208
+ }
209
+ else if (status !== 200) {
210
+ throw new Error(`Vectara API returned status code ${status}`);
214
211
  }
215
- catch (err) {
216
- console.error(`Failed to upload file at index ${index}:`, err);
212
+ else {
213
+ numDocs += 1;
217
214
  }
218
215
  }
219
216
  if (this.verbose) {
220
- console.log(`Uploaded ${filePaths.length} files to Vectara`);
217
+ console.log(`Uploaded ${files.length} files to Vectara`);
221
218
  }
222
219
  return numDocs;
223
220
  }
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/experimental/llms/bittensor.cjs');
@@ -0,0 +1 @@
1
+ export * from '../../dist/experimental/llms/bittensor.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/experimental/llms/bittensor.js'
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/llms/googlevertexai/web.cjs');
@@ -0,0 +1 @@
1
+ export * from '../../dist/llms/googlevertexai/web.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/llms/googlevertexai/web.js'
@@ -1 +1 @@
1
- module.exports = require('../dist/llms/googlevertexai.cjs');
1
+ module.exports = require('../dist/llms/googlevertexai/index.cjs');
@@ -1 +1 @@
1
- export * from '../dist/llms/googlevertexai.js'
1
+ export * from '../dist/llms/googlevertexai/index.js'
@@ -1 +1 @@
1
- export * from '../dist/llms/googlevertexai.js'
1
+ export * from '../dist/llms/googlevertexai/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "0.0.146",
3
+ "version": "0.0.148",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "type": "module",
6
6
  "engines": {
@@ -139,6 +139,9 @@
139
139
  "llms/googlevertexai.cjs",
140
140
  "llms/googlevertexai.js",
141
141
  "llms/googlevertexai.d.ts",
142
+ "llms/googlevertexai/web.cjs",
143
+ "llms/googlevertexai/web.js",
144
+ "llms/googlevertexai/web.d.ts",
142
145
  "llms/googlepalm.cjs",
143
146
  "llms/googlepalm.js",
144
147
  "llms/googlepalm.d.ts",
@@ -385,6 +388,9 @@
385
388
  "chat_models/googlevertexai.cjs",
386
389
  "chat_models/googlevertexai.js",
387
390
  "chat_models/googlevertexai.d.ts",
391
+ "chat_models/googlevertexai/web.cjs",
392
+ "chat_models/googlevertexai/web.js",
393
+ "chat_models/googlevertexai/web.d.ts",
388
394
  "chat_models/googlepalm.cjs",
389
395
  "chat_models/googlepalm.js",
390
396
  "chat_models/googlepalm.d.ts",
@@ -457,6 +463,9 @@
457
463
  "retrievers/document_compressors.cjs",
458
464
  "retrievers/document_compressors.js",
459
465
  "retrievers/document_compressors.d.ts",
466
+ "retrievers/multi_query.cjs",
467
+ "retrievers/multi_query.js",
468
+ "retrievers/multi_query.d.ts",
460
469
  "retrievers/multi_vector.cjs",
461
470
  "retrievers/multi_vector.js",
462
471
  "retrievers/multi_vector.d.ts",
@@ -583,6 +592,9 @@
583
592
  "experimental/chat_models/anthropic_functions.cjs",
584
593
  "experimental/chat_models/anthropic_functions.js",
585
594
  "experimental/chat_models/anthropic_functions.d.ts",
595
+ "experimental/llms/bittensor.cjs",
596
+ "experimental/llms/bittensor.js",
597
+ "experimental/llms/bittensor.d.ts",
586
598
  "evaluation.cjs",
587
599
  "evaluation.js",
588
600
  "evaluation.d.ts",
@@ -638,7 +650,7 @@
638
650
  "@huggingface/inference": "^1.5.1",
639
651
  "@jest/globals": "^29.5.0",
640
652
  "@mozilla/readability": "^0.4.4",
641
- "@notionhq/client": "^2.2.5",
653
+ "@notionhq/client": "^2.2.10",
642
654
  "@opensearch-project/opensearch": "^2.2.0",
643
655
  "@pinecone-database/pinecone": "^0.0.14",
644
656
  "@planetscale/database": "^1.8.0",
@@ -730,6 +742,7 @@
730
742
  "vectordb": "^0.1.4",
731
743
  "voy-search": "0.6.2",
732
744
  "weaviate-ts-client": "^1.4.0",
745
+ "web-auth-library": "^1.0.3",
733
746
  "youtube-transcript": "^1.0.6",
734
747
  "youtubei.js": "^5.8.0"
735
748
  },
@@ -754,7 +767,7 @@
754
767
  "@google-cloud/storage": "^6.10.1",
755
768
  "@huggingface/inference": "^1.5.1",
756
769
  "@mozilla/readability": "*",
757
- "@notionhq/client": "^2.2.5",
770
+ "@notionhq/client": "^2.2.10",
758
771
  "@opensearch-project/opensearch": "*",
759
772
  "@pinecone-database/pinecone": "*",
760
773
  "@planetscale/database": "^1.8.0",
@@ -811,6 +824,7 @@
811
824
  "vectordb": "^0.1.4",
812
825
  "voy-search": "0.6.2",
813
826
  "weaviate-ts-client": "^1.4.0",
827
+ "web-auth-library": "^1.0.3",
814
828
  "youtube-transcript": "^1.0.6",
815
829
  "youtubei.js": "^5.8.0"
816
830
  },
@@ -1046,6 +1060,9 @@
1046
1060
  "weaviate-ts-client": {
1047
1061
  "optional": true
1048
1062
  },
1063
+ "web-auth-library": {
1064
+ "optional": true
1065
+ },
1049
1066
  "youtube-transcript": {
1050
1067
  "optional": true
1051
1068
  },
@@ -1310,6 +1327,11 @@
1310
1327
  "import": "./llms/googlevertexai.js",
1311
1328
  "require": "./llms/googlevertexai.cjs"
1312
1329
  },
1330
+ "./llms/googlevertexai/web": {
1331
+ "types": "./llms/googlevertexai/web.d.ts",
1332
+ "import": "./llms/googlevertexai/web.js",
1333
+ "require": "./llms/googlevertexai/web.cjs"
1334
+ },
1313
1335
  "./llms/googlepalm": {
1314
1336
  "types": "./llms/googlepalm.d.ts",
1315
1337
  "import": "./llms/googlepalm.js",
@@ -1720,6 +1742,11 @@
1720
1742
  "import": "./chat_models/googlevertexai.js",
1721
1743
  "require": "./chat_models/googlevertexai.cjs"
1722
1744
  },
1745
+ "./chat_models/googlevertexai/web": {
1746
+ "types": "./chat_models/googlevertexai/web.d.ts",
1747
+ "import": "./chat_models/googlevertexai/web.js",
1748
+ "require": "./chat_models/googlevertexai/web.cjs"
1749
+ },
1723
1750
  "./chat_models/googlepalm": {
1724
1751
  "types": "./chat_models/googlepalm.d.ts",
1725
1752
  "import": "./chat_models/googlepalm.js",
@@ -1840,6 +1867,11 @@
1840
1867
  "import": "./retrievers/document_compressors.js",
1841
1868
  "require": "./retrievers/document_compressors.cjs"
1842
1869
  },
1870
+ "./retrievers/multi_query": {
1871
+ "types": "./retrievers/multi_query.d.ts",
1872
+ "import": "./retrievers/multi_query.js",
1873
+ "require": "./retrievers/multi_query.cjs"
1874
+ },
1843
1875
  "./retrievers/multi_vector": {
1844
1876
  "types": "./retrievers/multi_vector.d.ts",
1845
1877
  "import": "./retrievers/multi_vector.js",
@@ -2050,6 +2082,11 @@
2050
2082
  "import": "./experimental/chat_models/anthropic_functions.js",
2051
2083
  "require": "./experimental/chat_models/anthropic_functions.cjs"
2052
2084
  },
2085
+ "./experimental/llms/bittensor": {
2086
+ "types": "./experimental/llms/bittensor.d.ts",
2087
+ "import": "./experimental/llms/bittensor.js",
2088
+ "require": "./experimental/llms/bittensor.cjs"
2089
+ },
2053
2090
  "./evaluation": {
2054
2091
  "types": "./evaluation.d.ts",
2055
2092
  "import": "./evaluation.js",
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/retrievers/multi_query.cjs');
@@ -0,0 +1 @@
1
+ export * from '../dist/retrievers/multi_query.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/retrievers/multi_query.js'
@@ -1 +1 @@
1
- module.exports = require('../dist/schema/runnable.cjs');
1
+ module.exports = require('../dist/schema/runnable/index.cjs');
@@ -1 +1 @@
1
- export * from '../dist/schema/runnable.js'
1
+ export * from '../dist/schema/runnable/index.js'
@@ -1 +1 @@
1
- export * from '../dist/schema/runnable.js'
1
+ export * from '../dist/schema/runnable/index.js'