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.
@@ -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.dataMgr.insert({
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.dataMgr.flushSync({ collection_names: [this.collectionName] });
165
+ await this.client.flushSync({ collection_names: [this.collectionName] });
187
166
  }
188
167
  async similaritySearchVectorWithScore(query, k) {
189
- const hasColResp = await this.colMgr.hasCollection({
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.colMgr.loadCollectionSync({
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.dataMgr.search({
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.colMgr.hasCollection({
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.colMgr.createCollection({
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.idxMgr.createIndex({
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.colMgr.describeCollection({
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.78",
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": "^2.0.1",
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": "^2.2.0",
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",