langchain 0.0.78 → 0.0.79
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/chains/query_constructor/prompt.cjs +5 -5
- package/dist/chains/query_constructor/prompt.d.ts +2 -2
- package/dist/chains/query_constructor/prompt.js +5 -5
- package/dist/chains/sql_db/sql_db_chain.cjs +0 -3
- package/dist/chains/sql_db/sql_db_chain.js +0 -3
- package/dist/chains/vector_db_qa.cjs +1 -1
- package/dist/chains/vector_db_qa.js +1 -1
- package/dist/client/langchainplus.cjs +143 -52
- package/dist/client/langchainplus.d.ts +72 -15
- package/dist/client/langchainplus.js +144 -53
- package/dist/prompts/selectors/conditional.cjs +4 -0
- package/dist/prompts/selectors/conditional.d.ts +5 -0
- package/dist/prompts/selectors/conditional.js +4 -0
- package/dist/retrievers/metal.d.ts +2 -1
- package/dist/stores/message/redis.cjs +1 -10
- package/dist/stores/message/redis.js +1 -10
- package/dist/vectorstores/milvus.cjs +9 -30
- package/dist/vectorstores/milvus.d.ts +0 -3
- package/dist/vectorstores/milvus.js +9 -30
- package/package.json +4 -3
|
@@ -59,24 +59,6 @@ export class Milvus extends VectorStore {
|
|
|
59
59
|
writable: true,
|
|
60
60
|
value: void 0
|
|
61
61
|
});
|
|
62
|
-
Object.defineProperty(this, "colMgr", {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
configurable: true,
|
|
65
|
-
writable: true,
|
|
66
|
-
value: void 0
|
|
67
|
-
});
|
|
68
|
-
Object.defineProperty(this, "idxMgr", {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
configurable: true,
|
|
71
|
-
writable: true,
|
|
72
|
-
value: void 0
|
|
73
|
-
});
|
|
74
|
-
Object.defineProperty(this, "dataMgr", {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
configurable: true,
|
|
77
|
-
writable: true,
|
|
78
|
-
value: void 0
|
|
79
|
-
});
|
|
80
62
|
Object.defineProperty(this, "indexParams", {
|
|
81
63
|
enumerable: true,
|
|
82
64
|
configurable: true,
|
|
@@ -123,9 +105,6 @@ export class Milvus extends VectorStore {
|
|
|
123
105
|
throw new Error("Milvus URL address is not provided.");
|
|
124
106
|
}
|
|
125
107
|
this.client = new MilvusClient(url, args.ssl, args.username, args.password);
|
|
126
|
-
this.colMgr = this.client.collectionManager;
|
|
127
|
-
this.idxMgr = this.client.indexManager;
|
|
128
|
-
this.dataMgr = this.client.dataManager;
|
|
129
108
|
}
|
|
130
109
|
async addDocuments(documents) {
|
|
131
110
|
const texts = documents.map(({ pageContent }) => pageContent);
|
|
@@ -176,17 +155,17 @@ export class Milvus extends VectorStore {
|
|
|
176
155
|
});
|
|
177
156
|
insertDatas.push(data);
|
|
178
157
|
}
|
|
179
|
-
const insertResp = await this.
|
|
158
|
+
const insertResp = await this.client.insert({
|
|
180
159
|
collection_name: this.collectionName,
|
|
181
160
|
fields_data: insertDatas,
|
|
182
161
|
});
|
|
183
162
|
if (insertResp.status.error_code !== ErrorCode.SUCCESS) {
|
|
184
163
|
throw new Error(`Error inserting data: ${JSON.stringify(insertResp)}`);
|
|
185
164
|
}
|
|
186
|
-
await this.
|
|
165
|
+
await this.client.flushSync({ collection_names: [this.collectionName] });
|
|
187
166
|
}
|
|
188
167
|
async similaritySearchVectorWithScore(query, k) {
|
|
189
|
-
const hasColResp = await this.
|
|
168
|
+
const hasColResp = await this.client.hasCollection({
|
|
190
169
|
collection_name: this.collectionName,
|
|
191
170
|
});
|
|
192
171
|
if (hasColResp.status.error_code !== ErrorCode.SUCCESS) {
|
|
@@ -196,7 +175,7 @@ export class Milvus extends VectorStore {
|
|
|
196
175
|
throw new Error(`Collection not found: ${this.collectionName}, please create collection before search.`);
|
|
197
176
|
}
|
|
198
177
|
await this.grabCollectionFields();
|
|
199
|
-
const loadResp = await this.
|
|
178
|
+
const loadResp = await this.client.loadCollectionSync({
|
|
200
179
|
collection_name: this.collectionName,
|
|
201
180
|
});
|
|
202
181
|
if (loadResp.error_code !== ErrorCode.SUCCESS) {
|
|
@@ -204,7 +183,7 @@ export class Milvus extends VectorStore {
|
|
|
204
183
|
}
|
|
205
184
|
// clone this.field and remove vectorField
|
|
206
185
|
const outputFields = this.fields.filter((field) => field !== this.vectorField);
|
|
207
|
-
const searchResp = await this.
|
|
186
|
+
const searchResp = await this.client.search({
|
|
208
187
|
collection_name: this.collectionName,
|
|
209
188
|
search_params: {
|
|
210
189
|
anns_field: this.vectorField,
|
|
@@ -243,7 +222,7 @@ export class Milvus extends VectorStore {
|
|
|
243
222
|
return results;
|
|
244
223
|
}
|
|
245
224
|
async ensureCollection(vectors, documents) {
|
|
246
|
-
const hasColResp = await this.
|
|
225
|
+
const hasColResp = await this.client.hasCollection({
|
|
247
226
|
collection_name: this.collectionName,
|
|
248
227
|
});
|
|
249
228
|
if (hasColResp.status.error_code !== ErrorCode.SUCCESS) {
|
|
@@ -288,7 +267,7 @@ export class Milvus extends VectorStore {
|
|
|
288
267
|
this.fields.push(field.name);
|
|
289
268
|
}
|
|
290
269
|
});
|
|
291
|
-
const createRes = await this.
|
|
270
|
+
const createRes = await this.client.createCollection({
|
|
292
271
|
collection_name: this.collectionName,
|
|
293
272
|
fields: fieldList,
|
|
294
273
|
});
|
|
@@ -296,7 +275,7 @@ export class Milvus extends VectorStore {
|
|
|
296
275
|
console.log(createRes);
|
|
297
276
|
throw new Error(`Failed to create collection: ${createRes}`);
|
|
298
277
|
}
|
|
299
|
-
await this.
|
|
278
|
+
await this.client.createIndex({
|
|
300
279
|
collection_name: this.collectionName,
|
|
301
280
|
field_name: this.vectorField,
|
|
302
281
|
extra_params: this.indexCreateParams,
|
|
@@ -312,7 +291,7 @@ export class Milvus extends VectorStore {
|
|
|
312
291
|
this.fields.length > 0) {
|
|
313
292
|
return;
|
|
314
293
|
}
|
|
315
|
-
const desc = await this.
|
|
294
|
+
const desc = await this.client.describeCollection({
|
|
316
295
|
collection_name: this.collectionName,
|
|
317
296
|
});
|
|
318
297
|
desc.schema.fields.forEach((field) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.79",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -354,7 +354,7 @@
|
|
|
354
354
|
"@aws-sdk/client-sagemaker-runtime": "^3.310.0",
|
|
355
355
|
"@clickhouse/client": "^0.0.14",
|
|
356
356
|
"@faker-js/faker": "^7.6.0",
|
|
357
|
-
"@getmetal/metal-sdk": "^
|
|
357
|
+
"@getmetal/metal-sdk": "^4.0.0",
|
|
358
358
|
"@huggingface/inference": "^1.5.1",
|
|
359
359
|
"@jest/globals": "^29.5.0",
|
|
360
360
|
"@opensearch-project/opensearch": "^2.2.0",
|
|
@@ -373,6 +373,7 @@
|
|
|
373
373
|
"@types/uuid": "^9",
|
|
374
374
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
375
375
|
"@typescript-eslint/parser": "^5.58.0",
|
|
376
|
+
"@zilliz/milvus2-sdk-node": ">=2.2.7",
|
|
376
377
|
"apify-client": "^2.7.1",
|
|
377
378
|
"axios": "^0.26.0",
|
|
378
379
|
"cheerio": "^1.0.0-rc.12",
|
|
@@ -426,7 +427,7 @@
|
|
|
426
427
|
"@tensorflow-models/universal-sentence-encoder": "*",
|
|
427
428
|
"@tensorflow/tfjs-converter": "*",
|
|
428
429
|
"@tensorflow/tfjs-core": "*",
|
|
429
|
-
"@zilliz/milvus2-sdk-node": "
|
|
430
|
+
"@zilliz/milvus2-sdk-node": ">=2.2.7",
|
|
430
431
|
"apify-client": "^2.7.1",
|
|
431
432
|
"axios": "*",
|
|
432
433
|
"cheerio": "^1.0.0-rc.12",
|