@langchain/google-cloud-sql-pg 0.0.2 → 1.0.1

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 (48) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +6 -6
  3. package/README.md +1 -1
  4. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  5. package/dist/chat_message_history.cjs +104 -137
  6. package/dist/chat_message_history.cjs.map +1 -0
  7. package/dist/chat_message_history.d.cts +57 -0
  8. package/dist/chat_message_history.d.ts +53 -43
  9. package/dist/chat_message_history.js +103 -133
  10. package/dist/chat_message_history.js.map +1 -0
  11. package/dist/engine.cjs +188 -242
  12. package/dist/engine.cjs.map +1 -0
  13. package/dist/engine.d.cts +138 -0
  14. package/dist/engine.d.ts +102 -80
  15. package/dist/engine.js +186 -234
  16. package/dist/engine.js.map +1 -0
  17. package/dist/index.cjs +21 -20
  18. package/dist/index.d.cts +6 -0
  19. package/dist/index.d.ts +6 -4
  20. package/dist/index.js +7 -4
  21. package/dist/indexes.cjs +96 -168
  22. package/dist/indexes.cjs.map +1 -0
  23. package/dist/indexes.d.cts +68 -0
  24. package/dist/indexes.d.ts +50 -47
  25. package/dist/indexes.js +90 -161
  26. package/dist/indexes.js.map +1 -0
  27. package/dist/loader.cjs +159 -242
  28. package/dist/loader.cjs.map +1 -0
  29. package/dist/loader.d.cts +101 -0
  30. package/dist/loader.d.ts +40 -26
  31. package/dist/loader.js +157 -237
  32. package/dist/loader.js.map +1 -0
  33. package/dist/utils/utils.cjs +36 -65
  34. package/dist/utils/utils.cjs.map +1 -0
  35. package/dist/utils/utils.js +36 -62
  36. package/dist/utils/utils.js.map +1 -0
  37. package/dist/vectorstore.cjs +438 -593
  38. package/dist/vectorstore.cjs.map +1 -0
  39. package/dist/vectorstore.d.cts +300 -0
  40. package/dist/vectorstore.d.ts +147 -130
  41. package/dist/vectorstore.js +436 -588
  42. package/dist/vectorstore.js.map +1 -0
  43. package/package.json +41 -48
  44. package/dist/utils/utils.d.ts +0 -22
  45. package/index.cjs +0 -1
  46. package/index.d.cts +0 -1
  47. package/index.d.ts +0 -1
  48. package/index.js +0 -1
@@ -1,593 +1,441 @@
1
- import { VectorStore, } from "@langchain/core/vectorstores";
1
+ import { customZip } from "./utils/utils.js";
2
+ import { DEFAULT_DISTANCE_STRATEGY, DEFAULT_INDEX_NAME_SUFFIX } from "./indexes.js";
3
+ import { VectorStore } from "@langchain/core/vectorstores";
2
4
  import { Document } from "@langchain/core/documents";
3
- import { v4 as uuidv4 } from "uuid";
5
+ import { v4 } from "uuid";
4
6
  import { maximalMarginalRelevance } from "@langchain/core/utils/math";
5
- import { DEFAULT_DISTANCE_STRATEGY, DEFAULT_INDEX_NAME_SUFFIX, } from "./indexes.js";
6
- import { customZip } from "./utils/utils.js";
7
+
8
+ //#region src/vectorstore.ts
7
9
  /**
8
- * Google Cloud SQL for PostgreSQL vector store integration.
9
- *
10
- * Setup:
11
- * Install `@langchain/google-cloud-sql-pg`
12
- *
13
- * ```bash
14
- * npm install @langchain/google-cloud-sql-pg
15
- * ```
16
- *
17
- * <details open>
18
- * <summary><strong>Instantiate</strong></summary>
19
- *
20
- * ```typescript
21
- * import { Column, PostgresEngine, PostgresEngineArgs, PostgresVectorStore, VectorStoreTableArgs } from "@langchain/google-cloud-sql-pg";
22
- * // Or other embeddings
23
- * import { OpenAIEmbeddings } from '@langchain/openai';
24
- *
25
- *
26
- * const embeddings = new OpenAIEmbeddings({
27
- * model: "text-embedding-3-small",
28
- * });
29
- *
30
- * const pgArgs: PostgresEngineArgs = {
31
- * user: "db-user",
32
- * password: "password"
33
- * }
34
- * // Create a shared connection pool
35
- * const engine: PostgresEngine = await PostgresEngine.fromInstance(
36
- * "project-id",
37
- * "region",
38
- * "instance-name",
39
- * "database-name",
40
- * pgArgs
41
- * );
42
- * // (Optional) Specify metadata columns for filtering
43
- * // All other metadata will be added to JSON
44
- * const vectorStoreTableArgs: VectorStoreTableArgs = {
45
- * metadataColumns: [new Column("baz", "TEXT")],
46
- * };
47
- * // Create a vector store table
48
- * await engine.initVectorstoreTable("my-table", 768, vectorStoreTableArgs);
49
- * // Customize the vector store
50
- * const pvectorArgs: PostgresVectorStoreArgs = {
51
- * idColumn: "ID_COLUMN",
52
- * contentColumn: "CONTENT_COLUMN",
53
- * embeddingColumn: "EMBEDDING_COLUMN",
54
- * metadataColumns: ["baz"]
55
- * }
56
- *
57
- * const vectorStore = await PostgresVectorStore.initialize(engine, embeddingService, "my-table", pvectorArgs);
58
- * ```
59
- * </details>
60
- *
61
- * <br />
62
- *
63
- * <details>
64
- * <summary><strong>Add documents</strong></summary>
65
- *
66
- * ```typescript
67
- * import type { Document } from '@langchain/core/documents';
68
- *
69
- * const document1 = { pageContent: "foo", metadata: { baz: "bar" } };
70
- * const document2 = { pageContent: "thud", metadata: { bar: "baz" } };
71
- * const document3 = { pageContent: "i will be deleted :(", metadata: {} };
72
- *
73
- * const documents: Document[] = [document1, document2, document3];
74
- * const ids = ["1", "2", "3"];
75
- * await vectorStore.addDocuments(documents, { ids });
76
- * ```
77
- * </details>
78
- *
79
- * <br />
80
- *
81
- * <details>
82
- * <summary><strong>Delete documents</strong></summary>
83
- *
84
- * ```typescript
85
- * await vectorStore.delete({ ids: ["3"] });
86
- * ```
87
- * </details>
88
- *
89
- * <br />
90
- *
91
- * <details>
92
- * <summary><strong>Similarity search</strong></summary>
93
- *
94
- * ```typescript
95
- * const results = await vectorStore.similaritySearch("thud", 1);
96
- * for (const doc of results) {
97
- * console.log(`* ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);
98
- * }
99
- * // Output:thud [{"baz":"bar"}]
100
- * ```
101
- * </details>
102
- *
103
- * <br />
104
- *
105
- *
106
- * <details>
107
- * <summary><strong>Similarity search with filter</strong></summary>
108
- *
109
- * ```typescript
110
- * const resultsWithFilter = await vectorStore.similaritySearch("thud", 1, "baz = 'bar'");
111
- *
112
- * for (const doc of resultsWithFilter) {
113
- * console.log(`* ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);
114
- * }
115
- * // Output:foo [{"baz":"bar"}]
116
- * ```
117
- * </details>
118
- *
119
- * <br />
120
- *
121
- *
122
- * <details>
123
- * <summary><strong>Similarity search with score</strong></summary>
124
- *
125
- * ```typescript
126
- * const resultsWithScore = await vectorStore.similaritySearchWithScore("qux", 1);
127
- * for (const [doc, score] of resultsWithScore) {
128
- * console.log(`* [SIM=${score.toFixed(6)}] ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);
129
- * }
130
- * // Output:[SIM=0.000000] qux [{"bar":"baz","baz":"bar"}]
131
- * ```
132
- * </details>
133
- *
134
- * <br />
135
- *
136
- * <details>
137
- * <summary><strong>As a retriever</strong></summary>
138
- *
139
- * ```typescript
140
- * const retriever = vectorStore.asRetriever({
141
- * searchType: "mmr", // Leave blank for standard similarity search
142
- * k: 1,
143
- * });
144
- * const resultAsRetriever = await retriever.invoke("thud");
145
- * console.log(resultAsRetriever);
146
- *
147
- * // Output: [Document({ metadata: { "baz":"bar" }, pageContent: "thud" })]
148
- * ```
149
- * </details>
150
- *
151
- * <br />
152
- */
153
- export class PostgresVectorStore extends VectorStore {
154
- /**
155
- * Initializes a new vector store with embeddings and database configuration.
156
- *
157
- * @param embeddings - Instance of `EmbeddingsInterface` used to embed queries.
158
- * @param dbConfig - Configuration settings for the database or storage system.
159
- */
160
- constructor(embeddings, dbConfig) {
161
- super(embeddings, dbConfig);
162
- Object.defineProperty(this, "engine", {
163
- enumerable: true,
164
- configurable: true,
165
- writable: true,
166
- value: void 0
167
- });
168
- Object.defineProperty(this, "embeddings", {
169
- enumerable: true,
170
- configurable: true,
171
- writable: true,
172
- value: void 0
173
- });
174
- Object.defineProperty(this, "tableName", {
175
- enumerable: true,
176
- configurable: true,
177
- writable: true,
178
- value: void 0
179
- });
180
- Object.defineProperty(this, "schemaName", {
181
- enumerable: true,
182
- configurable: true,
183
- writable: true,
184
- value: void 0
185
- });
186
- Object.defineProperty(this, "contentColumn", {
187
- enumerable: true,
188
- configurable: true,
189
- writable: true,
190
- value: void 0
191
- });
192
- Object.defineProperty(this, "embeddingColumn", {
193
- enumerable: true,
194
- configurable: true,
195
- writable: true,
196
- value: void 0
197
- });
198
- Object.defineProperty(this, "metadataColumns", {
199
- enumerable: true,
200
- configurable: true,
201
- writable: true,
202
- value: void 0
203
- });
204
- Object.defineProperty(this, "idColumn", {
205
- enumerable: true,
206
- configurable: true,
207
- writable: true,
208
- value: void 0
209
- });
210
- Object.defineProperty(this, "metadataJsonColumn", {
211
- enumerable: true,
212
- configurable: true,
213
- writable: true,
214
- value: void 0
215
- });
216
- Object.defineProperty(this, "distanceStrategy", {
217
- enumerable: true,
218
- configurable: true,
219
- writable: true,
220
- value: void 0
221
- });
222
- Object.defineProperty(this, "k", {
223
- enumerable: true,
224
- configurable: true,
225
- writable: true,
226
- value: void 0
227
- });
228
- Object.defineProperty(this, "fetchK", {
229
- enumerable: true,
230
- configurable: true,
231
- writable: true,
232
- value: void 0
233
- });
234
- Object.defineProperty(this, "lambdaMult", {
235
- enumerable: true,
236
- configurable: true,
237
- writable: true,
238
- value: void 0
239
- });
240
- Object.defineProperty(this, "indexQueryOptions", {
241
- enumerable: true,
242
- configurable: true,
243
- writable: true,
244
- value: void 0
245
- });
246
- this.embeddings = embeddings;
247
- this.engine = dbConfig.engine;
248
- this.tableName = dbConfig.tableName;
249
- this.schemaName = dbConfig.schemaName;
250
- this.contentColumn = dbConfig.contentColumn;
251
- this.embeddingColumn = dbConfig.embeddingColumn;
252
- this.metadataColumns = dbConfig.metadataColumns
253
- ? dbConfig.metadataColumns
254
- : [];
255
- this.idColumn = dbConfig.idColumn;
256
- this.metadataJsonColumn = dbConfig.metadataJsonColumn;
257
- this.distanceStrategy = dbConfig.distanceStrategy;
258
- this.k = dbConfig.k;
259
- this.fetchK = dbConfig.fetchK;
260
- this.lambdaMult = dbConfig.lambdaMult;
261
- this.indexQueryOptions = dbConfig.indexQueryOptions;
262
- }
263
- /**
264
- * Create a new PostgresVectorStore instance.
265
- * @param {PostgresEngine} engine Required - Connection pool engine for managing connections to Cloud SQL for PostgreSQL database.
266
- * @param {Embeddings} embeddings Required - Text embedding model to use.
267
- * @param {string} tableName Required - Name of an existing table or table to be created.
268
- * @param {string} schemaName Database schema name of the table. Defaults to "public".
269
- * @param {string} contentColumn Column that represent a Document's page_content. Defaults to "content".
270
- * @param {string} embeddingColumn Column for embedding vectors. The embedding is generated from the document value. Defaults to "embedding".
271
- * @param {Array<string>} metadataColumns Column(s) that represent a document's metadata.
272
- * @param {Array<string>} ignoreMetadataColumns Optional - Column(s) to ignore in pre-existing tables for a document's metadata. Can not be used with metadata_columns.
273
- * @param {string} idColumn Column that represents the Document's id. Defaults to "langchain_id".
274
- * @param {string} metadataJsonColumn Optional - Column to store metadata as JSON. Defaults to "langchain_metadata".
275
- * @param {DistanceStrategy} distanceStrategy Distance strategy to use for vector similarity search. Defaults to COSINE_DISTANCE.
276
- * @param {number} k Number of Documents to return from search. Defaults to 4.
277
- * @param {number} fetchK Number of Documents to fetch to pass to MMR algorithm.
278
- * @param {number} lambdaMult Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5.
279
- * @param {QueryOptions} indexQueryOptions Optional - Index query option.
280
- * @returns PostgresVectorStore instance.
281
- */
282
- static async initialize(engine, embeddings, tableName, { schemaName = "public", contentColumn = "content", embeddingColumn = "embedding", metadataColumns = [], ignoreMetadataColumns, idColumn = "langchain_id", metadataJsonColumn = "langchain_metadata", distanceStrategy = DEFAULT_DISTANCE_STRATEGY, k = 4, fetchK = 20, lambdaMult = 0.5, indexQueryOptions, } = {}) {
283
- if (metadataColumns !== undefined && ignoreMetadataColumns !== undefined) {
284
- throw Error("Can not use both metadata_columns and ignore_metadata_columns.");
285
- }
286
- const { rows } = await engine.pool.raw(`SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '${tableName}' AND table_schema = '${schemaName}'`);
287
- const columns = {};
288
- for (const index in rows) {
289
- if (rows[index]) {
290
- const row = rows[index];
291
- columns[row.column_name] = row.data_type;
292
- }
293
- }
294
- if (!Object.prototype.hasOwnProperty.call(columns, idColumn)) {
295
- throw Error(`Id column: ${idColumn}, does not exist.`);
296
- }
297
- if (!Object.prototype.hasOwnProperty.call(columns, contentColumn)) {
298
- throw Error(`Content column: ${contentColumn}, does not exist.`);
299
- }
300
- const contentType = columns[contentColumn];
301
- if (contentType !== "text" && !contentType.includes("char")) {
302
- throw Error(`Content column: ${contentColumn}, is type: ${contentType}. It must be a type of character string.`);
303
- }
304
- if (!Object.prototype.hasOwnProperty.call(columns, embeddingColumn)) {
305
- throw Error(`Embedding column: ${embeddingColumn}, does not exist.`);
306
- }
307
- if (columns[embeddingColumn] !== "USER-DEFINED") {
308
- throw Error(`Embedding column: ${embeddingColumn} is not of type Vector.`);
309
- }
310
- const jsonColumn = Object.prototype.hasOwnProperty.call(columns, metadataJsonColumn)
311
- ? metadataJsonColumn
312
- : "";
313
- for (const column of metadataColumns) {
314
- if (!Object.prototype.hasOwnProperty.call(columns, column)) {
315
- throw Error(`Metadata column: ${column}, does not exist.`);
316
- }
317
- }
318
- const allColumns = columns;
319
- let allMetadataColumns = [];
320
- if (ignoreMetadataColumns !== undefined &&
321
- ignoreMetadataColumns.length > 0) {
322
- for (const column of ignoreMetadataColumns) {
323
- delete allColumns[column];
324
- }
325
- delete allColumns[idColumn];
326
- delete allColumns[contentColumn];
327
- delete allColumns[embeddingColumn];
328
- allMetadataColumns = Object.keys(allColumns);
329
- }
330
- else {
331
- for (const column of metadataColumns) {
332
- if (Object.prototype.hasOwnProperty.call(allColumns, column)) {
333
- allMetadataColumns.push(column);
334
- }
335
- }
336
- }
337
- return new PostgresVectorStore(embeddings, {
338
- engine,
339
- tableName,
340
- schemaName,
341
- contentColumn,
342
- embeddingColumn,
343
- metadataColumns: allMetadataColumns,
344
- idColumn,
345
- metadataJsonColumn: jsonColumn,
346
- distanceStrategy,
347
- k,
348
- fetchK,
349
- lambdaMult,
350
- indexQueryOptions,
351
- });
352
- }
353
- static async fromTexts(texts, metadatas, embeddings, dbConfig) {
354
- const documents = [];
355
- for (let i = 0; i < texts.length; i += 1) {
356
- const doc = new Document({
357
- pageContent: texts[i],
358
- metadata: Array.isArray(metadatas) ? metadatas[i] : metadatas,
359
- });
360
- documents.push(doc);
361
- }
362
- return PostgresVectorStore.fromDocuments(documents, embeddings, dbConfig);
363
- }
364
- static async fromDocuments(docs, embeddings, dbConfig) {
365
- const { engine } = dbConfig;
366
- const { tableName } = dbConfig;
367
- const config = dbConfig.dbConfig;
368
- const vectorStore = await this.initialize(engine, embeddings, tableName, config);
369
- await vectorStore.addDocuments(docs);
370
- return vectorStore;
371
- }
372
- async addVectors(vectors, documents, options) {
373
- let ids = [];
374
- const metadatas = [];
375
- if (vectors.length !== documents.length) {
376
- throw new Error("The number of vectors must match the number of documents provided.");
377
- }
378
- if (options?.ids) {
379
- ids = options.ids;
380
- }
381
- else {
382
- documents.forEach((document) => {
383
- if (document.id !== undefined) {
384
- ids.push(document.id);
385
- }
386
- else {
387
- ids.push(uuidv4());
388
- }
389
- });
390
- }
391
- if (options && options.ids && options.ids.length !== documents.length) {
392
- throw new Error("The number of ids must match the number of documents provided.");
393
- }
394
- documents.forEach((document) => {
395
- metadatas.push(document.metadata);
396
- });
397
- const tuples = customZip(ids, documents, vectors, metadatas);
398
- // Insert embeddings
399
- for (const [id, document, embedding, metadata] of tuples) {
400
- const metadataColNames = this.metadataColumns.length > 0
401
- ? `, "${this.metadataColumns.join('","')}"`
402
- : "";
403
- let stmt = `INSERT INTO "${this.schemaName}"."${this.tableName}"("${this.idColumn}", "${this.contentColumn}", "${this.embeddingColumn}" ${metadataColNames}`;
404
- const values = {
405
- id,
406
- content: document.pageContent,
407
- embedding: `[${embedding.toString()}]`,
408
- };
409
- let valuesStmt = " VALUES (:id, :content, :embedding";
410
- // Add metadata
411
- const extra = metadata;
412
- for (const metadataColumn of this.metadataColumns) {
413
- if (Object.prototype.hasOwnProperty.call(metadata, metadataColumn)) {
414
- valuesStmt += `, :${metadataColumn}`;
415
- values[metadataColumn] = metadata[metadataColumn];
416
- delete extra[metadataColumn];
417
- }
418
- else {
419
- valuesStmt += " ,null";
420
- }
421
- }
422
- // Add JSON column and/or close statement
423
- stmt += this.metadataJsonColumn ? `, ${this.metadataJsonColumn})` : ")";
424
- if (this.metadataJsonColumn) {
425
- valuesStmt += ", :extra)";
426
- Object.assign(values, { extra: JSON.stringify(extra) });
427
- }
428
- else {
429
- valuesStmt += ")";
430
- }
431
- const query = stmt + valuesStmt;
432
- await this.engine.pool.raw(query, values);
433
- }
434
- return options?.ids;
435
- }
436
- _vectorstoreType() {
437
- return "cloudsqlpostgresql";
438
- }
439
- /**
440
- * Adds documents to the vector store, embedding them first through the
441
- * `embeddings` instance.
442
- *
443
- * @param documents - Array of documents to embed and add.
444
- * @param options - Optional configuration for embedding and storing documents.
445
- * @returns A promise resolving to an array of document IDs or void, based on implementation.
446
- * @abstract
447
- */
448
- async addDocuments(documents, options) {
449
- const texts = [];
450
- for (const doc of documents) {
451
- texts.push(doc.pageContent);
452
- }
453
- const embeddings = await this.embeddings.embedDocuments(texts);
454
- const results = await this.addVectors(embeddings, documents, options);
455
- return results;
456
- }
457
- /**
458
- * Deletes documents from the vector store based on the specified ids.
459
- *
460
- * @param params - Flexible key-value pairs defining conditions for document deletion.
461
- * @param ids - Optional: Property of {params} that contains the array of ids to be deleted
462
- * @returns A promise that resolves once the deletion is complete.
463
- */
464
- async delete(params) {
465
- if (params.ids === undefined)
466
- return;
467
- const idList = params.ids.map((id) => `'${id}'`).join(", ");
468
- const query = `DELETE FROM "${this.schemaName}"."${this.tableName}" WHERE "${this.idColumn}" in (${idList})`;
469
- await this.engine.pool.raw(query);
470
- }
471
- async similaritySearchVectorWithScore(embedding, k, filter) {
472
- const results = await this.queryCollection(embedding, k, filter);
473
- const documentsWithScores = [];
474
- for (const row of results) {
475
- const metadata = this.metadataJsonColumn && row[this.metadataJsonColumn]
476
- ? row[this.metadataJsonColumn]
477
- : {};
478
- for (const col of this.metadataColumns) {
479
- metadata[col] = row[col];
480
- }
481
- documentsWithScores.push([
482
- new Document({ pageContent: row[this.contentColumn], metadata }),
483
- row.distance,
484
- ]);
485
- }
486
- return documentsWithScores;
487
- }
488
- async queryCollection(embedding, k, filter) {
489
- const fetchK = k ?? this.k;
490
- const { operator } = this.distanceStrategy;
491
- const { searchFunction } = this.distanceStrategy;
492
- const _filter = filter !== undefined ? `WHERE ${filter}` : "";
493
- const metadataColNames = this.metadataColumns.length > 0
494
- ? `, "${this.metadataColumns.join('","')}"`
495
- : "";
496
- const metadataJsonColName = this.metadataJsonColumn
497
- ? `, "${this.metadataJsonColumn}"`
498
- : "";
499
- const query = `SELECT "${this.idColumn}", "${this.contentColumn}", "${this.embeddingColumn}" ${metadataColNames} ${metadataJsonColName}, ${searchFunction}("${this.embeddingColumn}", '[${embedding}]') as distance FROM "${this.schemaName}"."${this.tableName}" ${_filter} ORDER BY "${this.embeddingColumn}" ${operator} '[${embedding}]' LIMIT ${fetchK};`;
500
- if (this.indexQueryOptions) {
501
- await this.engine.pool.raw(`SET LOCAL ${this.indexQueryOptions.to_string()}`);
502
- }
503
- const { rows } = await this.engine.pool.raw(query);
504
- return rows;
505
- }
506
- async maxMarginalRelevanceSearch(query, options) {
507
- const vector = await this.embeddings.embedQuery(query);
508
- const results = await this.queryCollection(vector, options?.k, options?.filter);
509
- const k = options?.k ? options.k : this.k;
510
- const documentsWithScores = [];
511
- let docsList = [];
512
- const embeddingList = results.map((row) => JSON.parse(row[this.embeddingColumn]));
513
- const mmrSelected = maximalMarginalRelevance(vector, embeddingList, options?.lambda, k);
514
- for (const row of results) {
515
- const metadata = this.metadataJsonColumn && row[this.metadataJsonColumn]
516
- ? row[this.metadataJsonColumn]
517
- : {};
518
- for (const col of this.metadataColumns) {
519
- metadata[col] = row[col];
520
- }
521
- documentsWithScores.push([
522
- new Document({
523
- pageContent: row[this.contentColumn],
524
- metadata,
525
- }),
526
- row.distance,
527
- ]);
528
- }
529
- docsList = documentsWithScores
530
- .filter((_, i) => mmrSelected.includes(i))
531
- .map(([doc, _]) => doc);
532
- return docsList;
533
- }
534
- /**
535
- * Create an index on the vector store table
536
- * @param {BaseIndex} index
537
- * @param {string} name Optional
538
- * @param {boolean} concurrently Optional
539
- */
540
- async applyVectorIndex(index, name, concurrently = false) {
541
- if (index.constructor.name === "ExactNearestNeighbor") {
542
- await this.dropVectorIndex();
543
- return;
544
- }
545
- const filter = index.partialIndexes && index.partialIndexes?.length > 0
546
- ? `WHERE (${index.partialIndexes})`
547
- : "";
548
- const params = `WITH ${index.indexOptions()}`;
549
- const funct = index.distanceStrategy.indexFunction;
550
- let indexName = name;
551
- if (!indexName) {
552
- if (!index.name) {
553
- indexName = this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
554
- }
555
- else {
556
- indexName = index.name;
557
- }
558
- }
559
- const stmt = `CREATE INDEX ${concurrently ? "CONCURRENTLY" : ""} ${indexName} ON "${this.schemaName}"."${this.tableName}" USING ${index.indexType} (${this.embeddingColumn} ${funct}) ${params} ${filter};`;
560
- await this.engine.pool.raw(stmt);
561
- }
562
- /**
563
- * Check if index exists in the table.
564
- * @param {string} indexName Optional - index name
565
- */
566
- async isValidIndex(indexName) {
567
- const idxName = indexName || this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
568
- const stmt = `SELECT tablename, indexname
10
+ * Google Cloud SQL for PostgreSQL vector store integration.
11
+ *
12
+ * Setup:
13
+ * Install `@langchain/google-cloud-sql-pg`
14
+ *
15
+ * ```bash
16
+ * npm install @langchain/google-cloud-sql-pg
17
+ * ```
18
+ *
19
+ * <details open>
20
+ * <summary><strong>Instantiate</strong></summary>
21
+ *
22
+ * ```typescript
23
+ * import { Column, PostgresEngine, PostgresEngineArgs, PostgresVectorStore, VectorStoreTableArgs } from "@langchain/google-cloud-sql-pg";
24
+ * // Or other embeddings
25
+ * import { OpenAIEmbeddings } from '@langchain/openai';
26
+ *
27
+ *
28
+ * const embeddings = new OpenAIEmbeddings({
29
+ * model: "text-embedding-3-small",
30
+ * });
31
+ *
32
+ * const pgArgs: PostgresEngineArgs = {
33
+ * user: "db-user",
34
+ * password: "password"
35
+ * }
36
+ * // Create a shared connection pool
37
+ * const engine: PostgresEngine = await PostgresEngine.fromInstance(
38
+ * "project-id",
39
+ * "region",
40
+ * "instance-name",
41
+ * "database-name",
42
+ * pgArgs
43
+ * );
44
+ * // (Optional) Specify metadata columns for filtering
45
+ * // All other metadata will be added to JSON
46
+ * const vectorStoreTableArgs: VectorStoreTableArgs = {
47
+ * metadataColumns: [new Column("baz", "TEXT")],
48
+ * };
49
+ * // Create a vector store table
50
+ * await engine.initVectorstoreTable("my-table", 768, vectorStoreTableArgs);
51
+ * // Customize the vector store
52
+ * const pvectorArgs: PostgresVectorStoreArgs = {
53
+ * idColumn: "ID_COLUMN",
54
+ * contentColumn: "CONTENT_COLUMN",
55
+ * embeddingColumn: "EMBEDDING_COLUMN",
56
+ * metadataColumns: ["baz"]
57
+ * }
58
+ *
59
+ * const vectorStore = await PostgresVectorStore.initialize(engine, embeddingService, "my-table", pvectorArgs);
60
+ * ```
61
+ * </details>
62
+ *
63
+ * <br />
64
+ *
65
+ * <details>
66
+ * <summary><strong>Add documents</strong></summary>
67
+ *
68
+ * ```typescript
69
+ * import type { Document } from '@langchain/core/documents';
70
+ *
71
+ * const document1 = { pageContent: "foo", metadata: { baz: "bar" } };
72
+ * const document2 = { pageContent: "thud", metadata: { bar: "baz" } };
73
+ * const document3 = { pageContent: "i will be deleted :(", metadata: {} };
74
+ *
75
+ * const documents: Document[] = [document1, document2, document3];
76
+ * const ids = ["1", "2", "3"];
77
+ * await vectorStore.addDocuments(documents, { ids });
78
+ * ```
79
+ * </details>
80
+ *
81
+ * <br />
82
+ *
83
+ * <details>
84
+ * <summary><strong>Delete documents</strong></summary>
85
+ *
86
+ * ```typescript
87
+ * await vectorStore.delete({ ids: ["3"] });
88
+ * ```
89
+ * </details>
90
+ *
91
+ * <br />
92
+ *
93
+ * <details>
94
+ * <summary><strong>Similarity search</strong></summary>
95
+ *
96
+ * ```typescript
97
+ * const results = await vectorStore.similaritySearch("thud", 1);
98
+ * for (const doc of results) {
99
+ * console.log(`* ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);
100
+ * }
101
+ * // Output:thud [{"baz":"bar"}]
102
+ * ```
103
+ * </details>
104
+ *
105
+ * <br />
106
+ *
107
+ *
108
+ * <details>
109
+ * <summary><strong>Similarity search with filter</strong></summary>
110
+ *
111
+ * ```typescript
112
+ * const resultsWithFilter = await vectorStore.similaritySearch("thud", 1, "baz = 'bar'");
113
+ *
114
+ * for (const doc of resultsWithFilter) {
115
+ * console.log(`* ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);
116
+ * }
117
+ * // Output:foo [{"baz":"bar"}]
118
+ * ```
119
+ * </details>
120
+ *
121
+ * <br />
122
+ *
123
+ *
124
+ * <details>
125
+ * <summary><strong>Similarity search with score</strong></summary>
126
+ *
127
+ * ```typescript
128
+ * const resultsWithScore = await vectorStore.similaritySearchWithScore("qux", 1);
129
+ * for (const [doc, score] of resultsWithScore) {
130
+ * console.log(`* [SIM=${score.toFixed(6)}] ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);
131
+ * }
132
+ * // Output:[SIM=0.000000] qux [{"bar":"baz","baz":"bar"}]
133
+ * ```
134
+ * </details>
135
+ *
136
+ * <br />
137
+ *
138
+ * <details>
139
+ * <summary><strong>As a retriever</strong></summary>
140
+ *
141
+ * ```typescript
142
+ * const retriever = vectorStore.asRetriever({
143
+ * searchType: "mmr", // Leave blank for standard similarity search
144
+ * k: 1,
145
+ * });
146
+ * const resultAsRetriever = await retriever.invoke("thud");
147
+ * console.log(resultAsRetriever);
148
+ *
149
+ * // Output: [Document({ metadata: { "baz":"bar" }, pageContent: "thud" })]
150
+ * ```
151
+ * </details>
152
+ *
153
+ * <br />
154
+ */
155
+ var PostgresVectorStore = class PostgresVectorStore extends VectorStore {
156
+ engine;
157
+ embeddings;
158
+ tableName;
159
+ schemaName;
160
+ contentColumn;
161
+ embeddingColumn;
162
+ metadataColumns;
163
+ idColumn;
164
+ metadataJsonColumn;
165
+ distanceStrategy;
166
+ k;
167
+ fetchK;
168
+ lambdaMult;
169
+ indexQueryOptions;
170
+ /**
171
+ * Initializes a new vector store with embeddings and database configuration.
172
+ *
173
+ * @param embeddings - Instance of `EmbeddingsInterface` used to embed queries.
174
+ * @param dbConfig - Configuration settings for the database or storage system.
175
+ */
176
+ constructor(embeddings, dbConfig) {
177
+ super(embeddings, dbConfig);
178
+ this.embeddings = embeddings;
179
+ this.engine = dbConfig.engine;
180
+ this.tableName = dbConfig.tableName;
181
+ this.schemaName = dbConfig.schemaName;
182
+ this.contentColumn = dbConfig.contentColumn;
183
+ this.embeddingColumn = dbConfig.embeddingColumn;
184
+ this.metadataColumns = dbConfig.metadataColumns ? dbConfig.metadataColumns : [];
185
+ this.idColumn = dbConfig.idColumn;
186
+ this.metadataJsonColumn = dbConfig.metadataJsonColumn;
187
+ this.distanceStrategy = dbConfig.distanceStrategy;
188
+ this.k = dbConfig.k;
189
+ this.fetchK = dbConfig.fetchK;
190
+ this.lambdaMult = dbConfig.lambdaMult;
191
+ this.indexQueryOptions = dbConfig.indexQueryOptions;
192
+ }
193
+ /**
194
+ * Create a new PostgresVectorStore instance.
195
+ * @param {PostgresEngine} engine Required - Connection pool engine for managing connections to Cloud SQL for PostgreSQL database.
196
+ * @param {Embeddings} embeddings Required - Text embedding model to use.
197
+ * @param {string} tableName Required - Name of an existing table or table to be created.
198
+ * @param {string} schemaName Database schema name of the table. Defaults to "public".
199
+ * @param {string} contentColumn Column that represent a Document's page_content. Defaults to "content".
200
+ * @param {string} embeddingColumn Column for embedding vectors. The embedding is generated from the document value. Defaults to "embedding".
201
+ * @param {Array<string>} metadataColumns Column(s) that represent a document's metadata.
202
+ * @param {Array<string>} ignoreMetadataColumns Optional - Column(s) to ignore in pre-existing tables for a document's metadata. Can not be used with metadata_columns.
203
+ * @param {string} idColumn Column that represents the Document's id. Defaults to "langchain_id".
204
+ * @param {string} metadataJsonColumn Optional - Column to store metadata as JSON. Defaults to "langchain_metadata".
205
+ * @param {DistanceStrategy} distanceStrategy Distance strategy to use for vector similarity search. Defaults to COSINE_DISTANCE.
206
+ * @param {number} k Number of Documents to return from search. Defaults to 4.
207
+ * @param {number} fetchK Number of Documents to fetch to pass to MMR algorithm.
208
+ * @param {number} lambdaMult Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5.
209
+ * @param {QueryOptions} indexQueryOptions Optional - Index query option.
210
+ * @returns PostgresVectorStore instance.
211
+ */
212
+ static async initialize(engine, embeddings, tableName, { schemaName = "public", contentColumn = "content", embeddingColumn = "embedding", metadataColumns = [], ignoreMetadataColumns, idColumn = "langchain_id", metadataJsonColumn = "langchain_metadata", distanceStrategy = DEFAULT_DISTANCE_STRATEGY, k = 4, fetchK = 20, lambdaMult = .5, indexQueryOptions } = {}) {
213
+ if (metadataColumns !== void 0 && ignoreMetadataColumns !== void 0) throw Error("Can not use both metadata_columns and ignore_metadata_columns.");
214
+ const { rows } = await engine.pool.raw(`SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '${tableName}' AND table_schema = '${schemaName}'`);
215
+ const columns = {};
216
+ for (const index in rows) if (rows[index]) {
217
+ const row = rows[index];
218
+ columns[row.column_name] = row.data_type;
219
+ }
220
+ if (!Object.prototype.hasOwnProperty.call(columns, idColumn)) throw Error(`Id column: ${idColumn}, does not exist.`);
221
+ if (!Object.prototype.hasOwnProperty.call(columns, contentColumn)) throw Error(`Content column: ${contentColumn}, does not exist.`);
222
+ const contentType = columns[contentColumn];
223
+ if (contentType !== "text" && !contentType.includes("char")) throw Error(`Content column: ${contentColumn}, is type: ${contentType}. It must be a type of character string.`);
224
+ if (!Object.prototype.hasOwnProperty.call(columns, embeddingColumn)) throw Error(`Embedding column: ${embeddingColumn}, does not exist.`);
225
+ if (columns[embeddingColumn] !== "USER-DEFINED") throw Error(`Embedding column: ${embeddingColumn} is not of type Vector.`);
226
+ const jsonColumn = Object.prototype.hasOwnProperty.call(columns, metadataJsonColumn) ? metadataJsonColumn : "";
227
+ for (const column of metadataColumns) if (!Object.prototype.hasOwnProperty.call(columns, column)) throw Error(`Metadata column: ${column}, does not exist.`);
228
+ const allColumns = columns;
229
+ let allMetadataColumns = [];
230
+ if (ignoreMetadataColumns !== void 0 && ignoreMetadataColumns.length > 0) {
231
+ for (const column of ignoreMetadataColumns) delete allColumns[column];
232
+ delete allColumns[idColumn];
233
+ delete allColumns[contentColumn];
234
+ delete allColumns[embeddingColumn];
235
+ allMetadataColumns = Object.keys(allColumns);
236
+ } else for (const column of metadataColumns) if (Object.prototype.hasOwnProperty.call(allColumns, column)) allMetadataColumns.push(column);
237
+ return new PostgresVectorStore(embeddings, {
238
+ engine,
239
+ tableName,
240
+ schemaName,
241
+ contentColumn,
242
+ embeddingColumn,
243
+ metadataColumns: allMetadataColumns,
244
+ idColumn,
245
+ metadataJsonColumn: jsonColumn,
246
+ distanceStrategy,
247
+ k,
248
+ fetchK,
249
+ lambdaMult,
250
+ indexQueryOptions
251
+ });
252
+ }
253
+ static async fromTexts(texts, metadatas, embeddings, dbConfig) {
254
+ const documents = [];
255
+ for (let i = 0; i < texts.length; i += 1) {
256
+ const doc = new Document({
257
+ pageContent: texts[i],
258
+ metadata: Array.isArray(metadatas) ? metadatas[i] : metadatas
259
+ });
260
+ documents.push(doc);
261
+ }
262
+ return PostgresVectorStore.fromDocuments(documents, embeddings, dbConfig);
263
+ }
264
+ static async fromDocuments(docs, embeddings, dbConfig) {
265
+ const { engine } = dbConfig;
266
+ const { tableName } = dbConfig;
267
+ const config = dbConfig.dbConfig;
268
+ const vectorStore = await this.initialize(engine, embeddings, tableName, config);
269
+ await vectorStore.addDocuments(docs);
270
+ return vectorStore;
271
+ }
272
+ async addVectors(vectors, documents, options) {
273
+ let ids = [];
274
+ const metadatas = [];
275
+ if (vectors.length !== documents.length) throw new Error("The number of vectors must match the number of documents provided.");
276
+ if (options?.ids) ids = options.ids;
277
+ else documents.forEach((document) => {
278
+ if (document.id !== void 0) ids.push(document.id);
279
+ else ids.push(v4());
280
+ });
281
+ if (options && options.ids && options.ids.length !== documents.length) throw new Error("The number of ids must match the number of documents provided.");
282
+ documents.forEach((document) => {
283
+ metadatas.push(document.metadata);
284
+ });
285
+ const tuples = customZip(ids, documents, vectors, metadatas);
286
+ for (const [id, document, embedding, metadata] of tuples) {
287
+ const metadataColNames = this.metadataColumns.length > 0 ? `, "${this.metadataColumns.join("\",\"")}"` : "";
288
+ let stmt = `INSERT INTO "${this.schemaName}"."${this.tableName}"("${this.idColumn}", "${this.contentColumn}", "${this.embeddingColumn}" ${metadataColNames}`;
289
+ const values = {
290
+ id,
291
+ content: document.pageContent,
292
+ embedding: `[${embedding.toString()}]`
293
+ };
294
+ let valuesStmt = " VALUES (:id, :content, :embedding";
295
+ const extra = metadata;
296
+ for (const metadataColumn of this.metadataColumns) if (Object.prototype.hasOwnProperty.call(metadata, metadataColumn)) {
297
+ valuesStmt += `, :${metadataColumn}`;
298
+ values[metadataColumn] = metadata[metadataColumn];
299
+ delete extra[metadataColumn];
300
+ } else valuesStmt += " ,null";
301
+ stmt += this.metadataJsonColumn ? `, ${this.metadataJsonColumn})` : ")";
302
+ if (this.metadataJsonColumn) {
303
+ valuesStmt += ", :extra)";
304
+ Object.assign(values, { extra: JSON.stringify(extra) });
305
+ } else valuesStmt += ")";
306
+ const query = stmt + valuesStmt;
307
+ await this.engine.pool.raw(query, values);
308
+ }
309
+ return options?.ids;
310
+ }
311
+ _vectorstoreType() {
312
+ return "cloudsqlpostgresql";
313
+ }
314
+ /**
315
+ * Adds documents to the vector store, embedding them first through the
316
+ * `embeddings` instance.
317
+ *
318
+ * @param documents - Array of documents to embed and add.
319
+ * @param options - Optional configuration for embedding and storing documents.
320
+ * @returns A promise resolving to an array of document IDs or void, based on implementation.
321
+ * @abstract
322
+ */
323
+ async addDocuments(documents, options) {
324
+ const texts = [];
325
+ for (const doc of documents) texts.push(doc.pageContent);
326
+ const embeddings = await this.embeddings.embedDocuments(texts);
327
+ const results = await this.addVectors(embeddings, documents, options);
328
+ return results;
329
+ }
330
+ /**
331
+ * Deletes documents from the vector store based on the specified ids.
332
+ *
333
+ * @param params - Flexible key-value pairs defining conditions for document deletion.
334
+ * @param ids - Optional: Property of {params} that contains the array of ids to be deleted
335
+ * @returns A promise that resolves once the deletion is complete.
336
+ */
337
+ async delete(params) {
338
+ if (params.ids === void 0) return;
339
+ const idList = params.ids.map((id) => `'${id}'`).join(", ");
340
+ const query = `DELETE FROM "${this.schemaName}"."${this.tableName}" WHERE "${this.idColumn}" in (${idList})`;
341
+ await this.engine.pool.raw(query);
342
+ }
343
+ async similaritySearchVectorWithScore(embedding, k, filter) {
344
+ const results = await this.queryCollection(embedding, k, filter);
345
+ const documentsWithScores = [];
346
+ for (const row of results) {
347
+ const metadata = this.metadataJsonColumn && row[this.metadataJsonColumn] ? row[this.metadataJsonColumn] : {};
348
+ for (const col of this.metadataColumns) metadata[col] = row[col];
349
+ documentsWithScores.push([new Document({
350
+ pageContent: row[this.contentColumn],
351
+ metadata
352
+ }), row.distance]);
353
+ }
354
+ return documentsWithScores;
355
+ }
356
+ async queryCollection(embedding, k, filter) {
357
+ const fetchK = k ?? this.k;
358
+ const { operator } = this.distanceStrategy;
359
+ const { searchFunction } = this.distanceStrategy;
360
+ const _filter = filter !== void 0 ? `WHERE ${filter}` : "";
361
+ const metadataColNames = this.metadataColumns.length > 0 ? `, "${this.metadataColumns.join("\",\"")}"` : "";
362
+ const metadataJsonColName = this.metadataJsonColumn ? `, "${this.metadataJsonColumn}"` : "";
363
+ const query = `SELECT "${this.idColumn}", "${this.contentColumn}", "${this.embeddingColumn}" ${metadataColNames} ${metadataJsonColName}, ${searchFunction}("${this.embeddingColumn}", '[${embedding}]') as distance FROM "${this.schemaName}"."${this.tableName}" ${_filter} ORDER BY "${this.embeddingColumn}" ${operator} '[${embedding}]' LIMIT ${fetchK};`;
364
+ if (this.indexQueryOptions) await this.engine.pool.raw(`SET LOCAL ${this.indexQueryOptions.to_string()}`);
365
+ const { rows } = await this.engine.pool.raw(query);
366
+ return rows;
367
+ }
368
+ async maxMarginalRelevanceSearch(query, options) {
369
+ const vector = await this.embeddings.embedQuery(query);
370
+ const results = await this.queryCollection(vector, options?.k, options?.filter);
371
+ const k = options?.k ? options.k : this.k;
372
+ const documentsWithScores = [];
373
+ let docsList = [];
374
+ const embeddingList = results.map((row) => JSON.parse(row[this.embeddingColumn]));
375
+ const mmrSelected = maximalMarginalRelevance(vector, embeddingList, options?.lambda, k);
376
+ for (const row of results) {
377
+ const metadata = this.metadataJsonColumn && row[this.metadataJsonColumn] ? row[this.metadataJsonColumn] : {};
378
+ for (const col of this.metadataColumns) metadata[col] = row[col];
379
+ documentsWithScores.push([new Document({
380
+ pageContent: row[this.contentColumn],
381
+ metadata
382
+ }), row.distance]);
383
+ }
384
+ docsList = documentsWithScores.filter((_, i) => mmrSelected.includes(i)).map(([doc, _]) => doc);
385
+ return docsList;
386
+ }
387
+ /**
388
+ * Create an index on the vector store table
389
+ * @param {BaseIndex} index
390
+ * @param {string} name Optional
391
+ * @param {boolean} concurrently Optional
392
+ */
393
+ async applyVectorIndex(index, name, concurrently = false) {
394
+ if (index.constructor.name === "ExactNearestNeighbor") {
395
+ await this.dropVectorIndex();
396
+ return;
397
+ }
398
+ const filter = index.partialIndexes && index.partialIndexes?.length > 0 ? `WHERE (${index.partialIndexes})` : "";
399
+ const params = `WITH ${index.indexOptions()}`;
400
+ const funct = index.distanceStrategy.indexFunction;
401
+ let indexName = name;
402
+ if (!indexName) if (!index.name) indexName = this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
403
+ else indexName = index.name;
404
+ const stmt = `CREATE INDEX ${concurrently ? "CONCURRENTLY" : ""} ${indexName} ON "${this.schemaName}"."${this.tableName}" USING ${index.indexType} (${this.embeddingColumn} ${funct}) ${params} ${filter};`;
405
+ await this.engine.pool.raw(stmt);
406
+ }
407
+ /**
408
+ * Check if index exists in the table.
409
+ * @param {string} indexName Optional - index name
410
+ */
411
+ async isValidIndex(indexName) {
412
+ const idxName = indexName || this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
413
+ const stmt = `SELECT tablename, indexname
569
414
  FROM pg_indexes
570
415
  WHERE tablename = '${this.tableName}' AND schemaname = '${this.schemaName}' AND indexname = '${idxName}';`;
571
- const { rows } = await this.engine.pool.raw(stmt);
572
- return rows.length === 1;
573
- }
574
- /**
575
- * Drop the vector index
576
- * @param {string} indexName Optional - index name
577
- */
578
- async dropVectorIndex(indexName) {
579
- const idxName = indexName || this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
580
- const query = `DROP INDEX IF EXISTS ${idxName};`;
581
- await this.engine.pool.raw(query);
582
- }
583
- /**
584
- * Re-index the vector store table
585
- * @param {string} indexName Optional - index name
586
- */
587
- async reIndex(indexName) {
588
- const idxName = indexName || this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
589
- const query = `REINDEX INDEX ${idxName};`;
590
- await this.engine.pool.raw(query);
591
- }
592
- }
593
- export default PostgresVectorStore;
416
+ const { rows } = await this.engine.pool.raw(stmt);
417
+ return rows.length === 1;
418
+ }
419
+ /**
420
+ * Drop the vector index
421
+ * @param {string} indexName Optional - index name
422
+ */
423
+ async dropVectorIndex(indexName) {
424
+ const idxName = indexName || this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
425
+ const query = `DROP INDEX IF EXISTS ${idxName};`;
426
+ await this.engine.pool.raw(query);
427
+ }
428
+ /**
429
+ * Re-index the vector store table
430
+ * @param {string} indexName Optional - index name
431
+ */
432
+ async reIndex(indexName) {
433
+ const idxName = indexName || this.tableName + DEFAULT_INDEX_NAME_SUFFIX;
434
+ const query = `REINDEX INDEX ${idxName};`;
435
+ await this.engine.pool.raw(query);
436
+ }
437
+ };
438
+
439
+ //#endregion
440
+ export { PostgresVectorStore };
441
+ //# sourceMappingURL=vectorstore.js.map