langchain 0.0.78 → 0.0.80
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/document_loaders/index.cjs +1 -3
- package/dist/document_loaders/index.d.ts +0 -1
- package/dist/document_loaders/index.js +0 -1
- package/dist/document_loaders/web/github.cjs +38 -23
- package/dist/document_loaders/web/github.d.ts +5 -2
- package/dist/document_loaders/web/github.js +38 -23
- package/dist/llms/googlevertexai.cjs +97 -0
- package/dist/llms/googlevertexai.d.ts +43 -0
- package/dist/llms/googlevertexai.js +93 -0
- 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/text_splitter.cjs +11 -4
- package/dist/text_splitter.d.ts +7 -2
- package/dist/text_splitter.js +11 -4
- package/dist/types/googlevertexai-types.cjs +2 -0
- package/dist/types/googlevertexai-types.d.ts +47 -0
- package/dist/types/googlevertexai-types.js +1 -0
- package/dist/util/googlevertexai-connection.cjs +66 -0
- package/dist/util/googlevertexai-connection.d.ts +13 -0
- package/dist/util/googlevertexai-connection.js +62 -0
- package/dist/vectorstores/chroma.cjs +34 -7
- package/dist/vectorstores/chroma.d.ts +5 -1
- package/dist/vectorstores/chroma.js +34 -7
- package/dist/vectorstores/milvus.cjs +9 -30
- package/dist/vectorstores/milvus.d.ts +0 -3
- package/dist/vectorstores/milvus.js +9 -30
- package/llms/googlevertexai.cjs +1 -0
- package/llms/googlevertexai.d.ts +1 -0
- package/llms/googlevertexai.js +1 -0
- package/package.json +21 -5
|
@@ -60,6 +60,12 @@ class Chroma extends base_js_1.VectorStore {
|
|
|
60
60
|
writable: true,
|
|
61
61
|
value: void 0
|
|
62
62
|
});
|
|
63
|
+
Object.defineProperty(this, "filter", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
value: void 0
|
|
68
|
+
});
|
|
63
69
|
this.numDimensions = args.numDimensions;
|
|
64
70
|
this.embeddings = embeddings;
|
|
65
71
|
this.collectionName = ensureCollectionName(args.collectionName);
|
|
@@ -69,6 +75,7 @@ class Chroma extends base_js_1.VectorStore {
|
|
|
69
75
|
else if ("url" in args) {
|
|
70
76
|
this.url = args.url || "http://localhost:8000";
|
|
71
77
|
}
|
|
78
|
+
this.filter = args.filter;
|
|
72
79
|
}
|
|
73
80
|
async addDocuments(documents) {
|
|
74
81
|
const texts = documents.map(({ pageContent }) => pageContent);
|
|
@@ -78,9 +85,16 @@ class Chroma extends base_js_1.VectorStore {
|
|
|
78
85
|
if (!this.collection) {
|
|
79
86
|
if (!this.index) {
|
|
80
87
|
const { ChromaClient } = await Chroma.imports();
|
|
81
|
-
this.index = new ChromaClient(this.url);
|
|
88
|
+
this.index = new ChromaClient({ path: this.url });
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
this.collection = await this.index.getOrCreateCollection({
|
|
92
|
+
name: this.collectionName,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
throw new Error(`Chroma getOrCreateCollection error: ${err}`);
|
|
82
97
|
}
|
|
83
|
-
this.collection = await this.index.getOrCreateCollection(this.collectionName);
|
|
84
98
|
}
|
|
85
99
|
return this.collection;
|
|
86
100
|
}
|
|
@@ -99,13 +113,26 @@ class Chroma extends base_js_1.VectorStore {
|
|
|
99
113
|
}
|
|
100
114
|
const collection = await this.ensureCollection();
|
|
101
115
|
const docstoreSize = await collection.count();
|
|
102
|
-
await collection.add(
|
|
116
|
+
await collection.add({
|
|
117
|
+
ids: Array.from({ length: vectors.length }, (_, i) => (docstoreSize + i).toString()),
|
|
118
|
+
embeddings: vectors,
|
|
119
|
+
metadatas: documents.map(({ metadata }) => metadata),
|
|
120
|
+
documents: documents.map(({ pageContent }) => pageContent),
|
|
121
|
+
});
|
|
103
122
|
}
|
|
104
|
-
async similaritySearchVectorWithScore(query, k) {
|
|
123
|
+
async similaritySearchVectorWithScore(query, k, filter) {
|
|
124
|
+
if (filter && this.filter) {
|
|
125
|
+
throw new Error("cannot provide both `filter` and `this.filter`");
|
|
126
|
+
}
|
|
127
|
+
const _filter = filter ?? this.filter;
|
|
105
128
|
const collection = await this.ensureCollection();
|
|
106
129
|
// similaritySearchVectorWithScore supports one query vector at a time
|
|
107
130
|
// chroma supports multiple query vectors at a time
|
|
108
|
-
const result = await collection.query(
|
|
131
|
+
const result = await collection.query({
|
|
132
|
+
query_embeddings: query,
|
|
133
|
+
n_results: k,
|
|
134
|
+
where: { ..._filter },
|
|
135
|
+
});
|
|
109
136
|
const { ids, distances, documents, metadatas } = result;
|
|
110
137
|
if (!ids || !distances || !documents || !metadatas) {
|
|
111
138
|
return [];
|
|
@@ -119,8 +146,8 @@ class Chroma extends base_js_1.VectorStore {
|
|
|
119
146
|
for (let i = 0; i < firstIds.length; i += 1) {
|
|
120
147
|
results.push([
|
|
121
148
|
new document_js_1.Document({
|
|
122
|
-
pageContent: firstDocuments[i],
|
|
123
|
-
metadata: firstMetadatas[i],
|
|
149
|
+
pageContent: firstDocuments?.[i] ?? "",
|
|
150
|
+
metadata: firstMetadatas?.[i] ?? {},
|
|
124
151
|
}),
|
|
125
152
|
firstDistances[i],
|
|
126
153
|
]);
|
|
@@ -6,22 +6,26 @@ export type ChromaLibArgs = {
|
|
|
6
6
|
url?: string;
|
|
7
7
|
numDimensions?: number;
|
|
8
8
|
collectionName?: string;
|
|
9
|
+
filter?: object;
|
|
9
10
|
} | {
|
|
10
11
|
index?: ChromaClientT;
|
|
11
12
|
numDimensions?: number;
|
|
12
13
|
collectionName?: string;
|
|
14
|
+
filter?: object;
|
|
13
15
|
};
|
|
14
16
|
export declare class Chroma extends VectorStore {
|
|
17
|
+
FilterType: object;
|
|
15
18
|
index?: ChromaClientT;
|
|
16
19
|
collection?: Collection;
|
|
17
20
|
collectionName: string;
|
|
18
21
|
numDimensions?: number;
|
|
19
22
|
url: string;
|
|
23
|
+
filter?: object;
|
|
20
24
|
constructor(embeddings: Embeddings, args: ChromaLibArgs);
|
|
21
25
|
addDocuments(documents: Document[]): Promise<void>;
|
|
22
26
|
ensureCollection(): Promise<Collection>;
|
|
23
27
|
addVectors(vectors: number[][], documents: Document[]): Promise<void>;
|
|
24
|
-
similaritySearchVectorWithScore(query: number[], k: number): Promise<[Document<Record<string, any>>, number][]>;
|
|
28
|
+
similaritySearchVectorWithScore(query: number[], k: number, filter?: this["FilterType"]): Promise<[Document<Record<string, any>>, number][]>;
|
|
25
29
|
static fromTexts(texts: string[], metadatas: object[] | object, embeddings: Embeddings, dbConfig: {
|
|
26
30
|
collectionName?: string;
|
|
27
31
|
url?: string;
|
|
@@ -34,6 +34,12 @@ export class Chroma extends VectorStore {
|
|
|
34
34
|
writable: true,
|
|
35
35
|
value: void 0
|
|
36
36
|
});
|
|
37
|
+
Object.defineProperty(this, "filter", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
37
43
|
this.numDimensions = args.numDimensions;
|
|
38
44
|
this.embeddings = embeddings;
|
|
39
45
|
this.collectionName = ensureCollectionName(args.collectionName);
|
|
@@ -43,6 +49,7 @@ export class Chroma extends VectorStore {
|
|
|
43
49
|
else if ("url" in args) {
|
|
44
50
|
this.url = args.url || "http://localhost:8000";
|
|
45
51
|
}
|
|
52
|
+
this.filter = args.filter;
|
|
46
53
|
}
|
|
47
54
|
async addDocuments(documents) {
|
|
48
55
|
const texts = documents.map(({ pageContent }) => pageContent);
|
|
@@ -52,9 +59,16 @@ export class Chroma extends VectorStore {
|
|
|
52
59
|
if (!this.collection) {
|
|
53
60
|
if (!this.index) {
|
|
54
61
|
const { ChromaClient } = await Chroma.imports();
|
|
55
|
-
this.index = new ChromaClient(this.url);
|
|
62
|
+
this.index = new ChromaClient({ path: this.url });
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
this.collection = await this.index.getOrCreateCollection({
|
|
66
|
+
name: this.collectionName,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
throw new Error(`Chroma getOrCreateCollection error: ${err}`);
|
|
56
71
|
}
|
|
57
|
-
this.collection = await this.index.getOrCreateCollection(this.collectionName);
|
|
58
72
|
}
|
|
59
73
|
return this.collection;
|
|
60
74
|
}
|
|
@@ -73,13 +87,26 @@ export class Chroma extends VectorStore {
|
|
|
73
87
|
}
|
|
74
88
|
const collection = await this.ensureCollection();
|
|
75
89
|
const docstoreSize = await collection.count();
|
|
76
|
-
await collection.add(
|
|
90
|
+
await collection.add({
|
|
91
|
+
ids: Array.from({ length: vectors.length }, (_, i) => (docstoreSize + i).toString()),
|
|
92
|
+
embeddings: vectors,
|
|
93
|
+
metadatas: documents.map(({ metadata }) => metadata),
|
|
94
|
+
documents: documents.map(({ pageContent }) => pageContent),
|
|
95
|
+
});
|
|
77
96
|
}
|
|
78
|
-
async similaritySearchVectorWithScore(query, k) {
|
|
97
|
+
async similaritySearchVectorWithScore(query, k, filter) {
|
|
98
|
+
if (filter && this.filter) {
|
|
99
|
+
throw new Error("cannot provide both `filter` and `this.filter`");
|
|
100
|
+
}
|
|
101
|
+
const _filter = filter ?? this.filter;
|
|
79
102
|
const collection = await this.ensureCollection();
|
|
80
103
|
// similaritySearchVectorWithScore supports one query vector at a time
|
|
81
104
|
// chroma supports multiple query vectors at a time
|
|
82
|
-
const result = await collection.query(
|
|
105
|
+
const result = await collection.query({
|
|
106
|
+
query_embeddings: query,
|
|
107
|
+
n_results: k,
|
|
108
|
+
where: { ..._filter },
|
|
109
|
+
});
|
|
83
110
|
const { ids, distances, documents, metadatas } = result;
|
|
84
111
|
if (!ids || !distances || !documents || !metadatas) {
|
|
85
112
|
return [];
|
|
@@ -93,8 +120,8 @@ export class Chroma extends VectorStore {
|
|
|
93
120
|
for (let i = 0; i < firstIds.length; i += 1) {
|
|
94
121
|
results.push([
|
|
95
122
|
new Document({
|
|
96
|
-
pageContent: firstDocuments[i],
|
|
97
|
-
metadata: firstMetadatas[i],
|
|
123
|
+
pageContent: firstDocuments?.[i] ?? "",
|
|
124
|
+
metadata: firstMetadatas?.[i] ?? {},
|
|
98
125
|
}),
|
|
99
126
|
firstDistances[i],
|
|
100
127
|
]);
|
|
@@ -85,24 +85,6 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
85
85
|
writable: true,
|
|
86
86
|
value: void 0
|
|
87
87
|
});
|
|
88
|
-
Object.defineProperty(this, "colMgr", {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
configurable: true,
|
|
91
|
-
writable: true,
|
|
92
|
-
value: void 0
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(this, "idxMgr", {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
configurable: true,
|
|
97
|
-
writable: true,
|
|
98
|
-
value: void 0
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(this, "dataMgr", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
configurable: true,
|
|
103
|
-
writable: true,
|
|
104
|
-
value: void 0
|
|
105
|
-
});
|
|
106
88
|
Object.defineProperty(this, "indexParams", {
|
|
107
89
|
enumerable: true,
|
|
108
90
|
configurable: true,
|
|
@@ -149,9 +131,6 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
149
131
|
throw new Error("Milvus URL address is not provided.");
|
|
150
132
|
}
|
|
151
133
|
this.client = new milvus2_sdk_node_1.MilvusClient(url, args.ssl, args.username, args.password);
|
|
152
|
-
this.colMgr = this.client.collectionManager;
|
|
153
|
-
this.idxMgr = this.client.indexManager;
|
|
154
|
-
this.dataMgr = this.client.dataManager;
|
|
155
134
|
}
|
|
156
135
|
async addDocuments(documents) {
|
|
157
136
|
const texts = documents.map(({ pageContent }) => pageContent);
|
|
@@ -202,17 +181,17 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
202
181
|
});
|
|
203
182
|
insertDatas.push(data);
|
|
204
183
|
}
|
|
205
|
-
const insertResp = await this.
|
|
184
|
+
const insertResp = await this.client.insert({
|
|
206
185
|
collection_name: this.collectionName,
|
|
207
186
|
fields_data: insertDatas,
|
|
208
187
|
});
|
|
209
188
|
if (insertResp.status.error_code !== types_js_1.ErrorCode.SUCCESS) {
|
|
210
189
|
throw new Error(`Error inserting data: ${JSON.stringify(insertResp)}`);
|
|
211
190
|
}
|
|
212
|
-
await this.
|
|
191
|
+
await this.client.flushSync({ collection_names: [this.collectionName] });
|
|
213
192
|
}
|
|
214
193
|
async similaritySearchVectorWithScore(query, k) {
|
|
215
|
-
const hasColResp = await this.
|
|
194
|
+
const hasColResp = await this.client.hasCollection({
|
|
216
195
|
collection_name: this.collectionName,
|
|
217
196
|
});
|
|
218
197
|
if (hasColResp.status.error_code !== types_js_1.ErrorCode.SUCCESS) {
|
|
@@ -222,7 +201,7 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
222
201
|
throw new Error(`Collection not found: ${this.collectionName}, please create collection before search.`);
|
|
223
202
|
}
|
|
224
203
|
await this.grabCollectionFields();
|
|
225
|
-
const loadResp = await this.
|
|
204
|
+
const loadResp = await this.client.loadCollectionSync({
|
|
226
205
|
collection_name: this.collectionName,
|
|
227
206
|
});
|
|
228
207
|
if (loadResp.error_code !== types_js_1.ErrorCode.SUCCESS) {
|
|
@@ -230,7 +209,7 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
230
209
|
}
|
|
231
210
|
// clone this.field and remove vectorField
|
|
232
211
|
const outputFields = this.fields.filter((field) => field !== this.vectorField);
|
|
233
|
-
const searchResp = await this.
|
|
212
|
+
const searchResp = await this.client.search({
|
|
234
213
|
collection_name: this.collectionName,
|
|
235
214
|
search_params: {
|
|
236
215
|
anns_field: this.vectorField,
|
|
@@ -269,7 +248,7 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
269
248
|
return results;
|
|
270
249
|
}
|
|
271
250
|
async ensureCollection(vectors, documents) {
|
|
272
|
-
const hasColResp = await this.
|
|
251
|
+
const hasColResp = await this.client.hasCollection({
|
|
273
252
|
collection_name: this.collectionName,
|
|
274
253
|
});
|
|
275
254
|
if (hasColResp.status.error_code !== types_js_1.ErrorCode.SUCCESS) {
|
|
@@ -314,7 +293,7 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
314
293
|
this.fields.push(field.name);
|
|
315
294
|
}
|
|
316
295
|
});
|
|
317
|
-
const createRes = await this.
|
|
296
|
+
const createRes = await this.client.createCollection({
|
|
318
297
|
collection_name: this.collectionName,
|
|
319
298
|
fields: fieldList,
|
|
320
299
|
});
|
|
@@ -322,7 +301,7 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
322
301
|
console.log(createRes);
|
|
323
302
|
throw new Error(`Failed to create collection: ${createRes}`);
|
|
324
303
|
}
|
|
325
|
-
await this.
|
|
304
|
+
await this.client.createIndex({
|
|
326
305
|
collection_name: this.collectionName,
|
|
327
306
|
field_name: this.vectorField,
|
|
328
307
|
extra_params: this.indexCreateParams,
|
|
@@ -338,7 +317,7 @@ class Milvus extends base_js_1.VectorStore {
|
|
|
338
317
|
this.fields.length > 0) {
|
|
339
318
|
return;
|
|
340
319
|
}
|
|
341
|
-
const desc = await this.
|
|
320
|
+
const desc = await this.client.describeCollection({
|
|
342
321
|
collection_name: this.collectionName,
|
|
343
322
|
});
|
|
344
323
|
desc.schema.fields.forEach((field) => {
|
|
@@ -29,9 +29,6 @@ export declare class Milvus extends VectorStore {
|
|
|
29
29
|
textField: string;
|
|
30
30
|
fields: string[];
|
|
31
31
|
client: MilvusClient;
|
|
32
|
-
colMgr: MilvusClient["collectionManager"];
|
|
33
|
-
idxMgr: MilvusClient["indexManager"];
|
|
34
|
-
dataMgr: MilvusClient["dataManager"];
|
|
35
32
|
indexParams: Record<IndexType, IndexParam>;
|
|
36
33
|
indexCreateParams: {
|
|
37
34
|
index_type: string;
|
|
@@ -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) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/llms/googlevertexai.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/llms/googlevertexai.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/llms/googlevertexai.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.80",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
"llms/replicate.cjs",
|
|
86
86
|
"llms/replicate.js",
|
|
87
87
|
"llms/replicate.d.ts",
|
|
88
|
+
"llms/googlevertexai.cjs",
|
|
89
|
+
"llms/googlevertexai.js",
|
|
90
|
+
"llms/googlevertexai.d.ts",
|
|
88
91
|
"llms/sagemaker_endpoint.cjs",
|
|
89
92
|
"llms/sagemaker_endpoint.js",
|
|
90
93
|
"llms/sagemaker_endpoint.d.ts",
|
|
@@ -354,7 +357,7 @@
|
|
|
354
357
|
"@aws-sdk/client-sagemaker-runtime": "^3.310.0",
|
|
355
358
|
"@clickhouse/client": "^0.0.14",
|
|
356
359
|
"@faker-js/faker": "^7.6.0",
|
|
357
|
-
"@getmetal/metal-sdk": "^
|
|
360
|
+
"@getmetal/metal-sdk": "^4.0.0",
|
|
358
361
|
"@huggingface/inference": "^1.5.1",
|
|
359
362
|
"@jest/globals": "^29.5.0",
|
|
360
363
|
"@opensearch-project/opensearch": "^2.2.0",
|
|
@@ -373,10 +376,11 @@
|
|
|
373
376
|
"@types/uuid": "^9",
|
|
374
377
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
375
378
|
"@typescript-eslint/parser": "^5.58.0",
|
|
379
|
+
"@zilliz/milvus2-sdk-node": ">=2.2.7",
|
|
376
380
|
"apify-client": "^2.7.1",
|
|
377
381
|
"axios": "^0.26.0",
|
|
378
382
|
"cheerio": "^1.0.0-rc.12",
|
|
379
|
-
"chromadb": "^1.4.
|
|
383
|
+
"chromadb": "^1.4.2",
|
|
380
384
|
"cohere-ai": "^5.0.2",
|
|
381
385
|
"d3-dsv": "^2.0.0",
|
|
382
386
|
"dotenv": "^16.0.3",
|
|
@@ -389,9 +393,11 @@
|
|
|
389
393
|
"eslint-plugin-no-instanceof": "^1.0.1",
|
|
390
394
|
"eslint-plugin-prettier": "^4.2.1",
|
|
391
395
|
"faiss-node": "^0.1.1",
|
|
396
|
+
"google-auth-library": "^8.8.0",
|
|
392
397
|
"graphql": "^16.6.0",
|
|
393
398
|
"hnswlib-node": "^1.4.2",
|
|
394
399
|
"html-to-text": "^9.0.5",
|
|
400
|
+
"ignore": "^5.2.0",
|
|
395
401
|
"jest": "^29.5.0",
|
|
396
402
|
"mammoth": "^1.5.1",
|
|
397
403
|
"meriyah": "^4.3.7",
|
|
@@ -426,17 +432,19 @@
|
|
|
426
432
|
"@tensorflow-models/universal-sentence-encoder": "*",
|
|
427
433
|
"@tensorflow/tfjs-converter": "*",
|
|
428
434
|
"@tensorflow/tfjs-core": "*",
|
|
429
|
-
"@zilliz/milvus2-sdk-node": "
|
|
435
|
+
"@zilliz/milvus2-sdk-node": ">=2.2.7",
|
|
430
436
|
"apify-client": "^2.7.1",
|
|
431
437
|
"axios": "*",
|
|
432
438
|
"cheerio": "^1.0.0-rc.12",
|
|
433
|
-
"chromadb": "^1.4.
|
|
439
|
+
"chromadb": "^1.4.2",
|
|
434
440
|
"cohere-ai": "^5.0.2",
|
|
435
441
|
"d3-dsv": "^2.0.0",
|
|
436
442
|
"epub2": "^3.0.1",
|
|
437
443
|
"faiss-node": "^0.1.1",
|
|
444
|
+
"google-auth-library": "^8.8.0",
|
|
438
445
|
"hnswlib-node": "^1.4.2",
|
|
439
446
|
"html-to-text": "^9.0.5",
|
|
447
|
+
"ignore": "^5.2.0",
|
|
440
448
|
"mammoth": "*",
|
|
441
449
|
"meriyah": "*",
|
|
442
450
|
"mongodb": "^5.2.0",
|
|
@@ -523,6 +531,9 @@
|
|
|
523
531
|
"html-to-text": {
|
|
524
532
|
"optional": true
|
|
525
533
|
},
|
|
534
|
+
"ignore": {
|
|
535
|
+
"optional": true
|
|
536
|
+
},
|
|
526
537
|
"mammoth": {
|
|
527
538
|
"optional": true
|
|
528
539
|
},
|
|
@@ -730,6 +741,11 @@
|
|
|
730
741
|
"import": "./llms/replicate.js",
|
|
731
742
|
"require": "./llms/replicate.cjs"
|
|
732
743
|
},
|
|
744
|
+
"./llms/googlevertexai": {
|
|
745
|
+
"types": "./llms/googlevertexai.d.ts",
|
|
746
|
+
"import": "./llms/googlevertexai.js",
|
|
747
|
+
"require": "./llms/googlevertexai.cjs"
|
|
748
|
+
},
|
|
733
749
|
"./llms/sagemaker_endpoint": {
|
|
734
750
|
"types": "./llms/sagemaker_endpoint.d.ts",
|
|
735
751
|
"import": "./llms/sagemaker_endpoint.js",
|