@dudousxd/nestjs-agent-rag 0.10.3 → 0.11.0

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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Passage, Retriever, EmbeddingProvider, RetrieveOptions, Reranker, ToolSpec, ToolHandler } from '@dudousxd/nestjs-agent-core';
1
+ import { Passage, Retriever, EmbeddingProvider, RetrieveOptions, Reranker, ToolSpec, ToolHandler, RerankOptions } from '@dudousxd/nestjs-agent-core';
2
2
 
3
3
  interface ChunkOptions {
4
4
  /** Target max characters per chunk. Default 800. */
@@ -433,56 +433,178 @@ declare class MemoryVectorStore implements VectorStore {
433
433
  }
434
434
 
435
435
  /**
436
- * The minimal Postgres surface {@link PgVectorStore} needs — adapt your own `pg` / `postgres.js`
437
- * client to it, so this package pulls in NO driver (bring your own, like the store adapters take an
438
- * ORM handle and the Redis transport takes a client). `query` runs parameterized SQL (`$1,$2,…`) and
439
- * resolves the result rows.
436
+ * The minimal Postgres surface {@link import('./pg-vector-store.js').PgVectorStore} needs — adapt your
437
+ * own `pg` / `postgres.js` client to it, so this package pulls in NO driver (bring your own, like the
438
+ * store adapters take an ORM handle and the Redis transport takes a client). `query` runs
439
+ * parameterized SQL (`$1,$2,…`) and resolves the result rows.
440
+ *
441
+ * `transaction` is optional. When present, the store uses it for the few reads that must share one
442
+ * connection with a `SET LOCAL` (pgvector's iterative index scan); without it those settings are
443
+ * simply not applied. You rarely write either by hand: pass a `pg` `Pool`, a Drizzle database or a
444
+ * `postgres.js` `sql` and {@link toPgClient} builds both.
440
445
  */
441
446
  interface PgClient {
442
447
  query<Row = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<Row[]>;
448
+ /** Run `work` inside one transaction on one connection; commit on success, roll back on throw. */
449
+ transaction?<T>(work: (tx: PgClient) => Promise<T>): Promise<T>;
450
+ }
451
+ /**
452
+ * A node-postgres `Pool`, `PoolClient` or `Client` — anything whose `query(text, values)` resolves a
453
+ * result with `rows`. Typed structurally so this package needs no `pg` import.
454
+ */
455
+ interface NodePgQueryable {
456
+ query(text: string, values?: any[]): Promise<unknown>;
457
+ }
458
+ /** A `postgres.js` `sql` instance (or a transaction handle from `sql.begin`). */
459
+ interface PostgresJsSql {
460
+ unsafe(query: string, params?: any[]): PromiseLike<unknown>;
461
+ begin?(...args: any[]): PromiseLike<unknown>;
462
+ }
463
+ /**
464
+ * A Drizzle database — `drizzle(pool)` for node-postgres or `drizzle(sql)` for postgres.js. Drizzle
465
+ * exposes the driver it wraps as `$client`, which is what the store talks to; this saves the
466
+ * `(db as unknown as { $client: Pool }).$client` cast at every call site.
467
+ */
468
+ interface DrizzleLike {
469
+ $client: NodePgQueryable | PostgresJsSql;
470
+ }
471
+ /** Everything {@link toPgClient} (and so the `PgVectorStore` constructor) accepts. */
472
+ type PgClientSource = PgClient | NodePgQueryable | PostgresJsSql | DrizzleLike;
473
+ /**
474
+ * Normalize a Postgres handle into a {@link PgClient}:
475
+ *
476
+ * - a Drizzle database → its `$client`, then one of the below;
477
+ * - a `postgres.js` `sql` → `sql.unsafe(text, params)`, transactions via `sql.begin`;
478
+ * - a node-postgres `Pool` → `pool.query(...).rows`, transactions on a checked-out client
479
+ * (`BEGIN`/`COMMIT`/`ROLLBACK`, then `release()`); a single `Client`/`PoolClient` runs its
480
+ * transaction in place;
481
+ * - a hand-written {@link PgClient} (`query` resolving the rows array) passes through unchanged.
482
+ *
483
+ * Detection is structural and happens per call result for `query` (an array is taken as the rows, an
484
+ * object's `rows` otherwise), so a hand-written adapter keeps working exactly as before.
485
+ */
486
+ declare function toPgClient(source: PgClientSource): PgClient;
487
+
488
+ /** Where the lexical leg of a {@link PgLexicalVectorStore} reads its `tsvector` from. */
489
+ interface PgFullTextOptions {
490
+ /**
491
+ * Text-search configuration (`simple`, `english`, `portuguese`, …). Default `simple` — no stemming
492
+ * or stop words, so it works for any language and matches exact terms, which is what the lexical
493
+ * leg of a hybrid search is for. Must be the same configuration the index was built with, or
494
+ * Postgres cannot use the index and scans the table (still correct, just slow).
495
+ */
496
+ config?: string;
497
+ /**
498
+ * A `tsvector` column you maintain yourself (typically `GENERATED ALWAYS AS (…) STORED` in a
499
+ * migration, e.g. weighting a title above the body), with its own GIN index. When omitted the
500
+ * store searches the expression `to_tsvector(config, text)`, and `ensureSchema` creates a GIN
501
+ * expression index over exactly that.
502
+ */
503
+ column?: string;
504
+ /**
505
+ * When the question matches nothing as a whole (`websearch_to_tsquery`: every word must appear),
506
+ * retry with any word (`w1 | w2 | …`, at most 24 distinct words) so a long natural-language
507
+ * question still finds the chunks sharing its rare terms. Default `true`.
508
+ */
509
+ anyTermFallback?: boolean;
443
510
  }
444
511
  interface PgVectorStoreOptions {
445
512
  /** Table name. Default `agent_rag_chunks`. */
446
513
  table?: string;
447
- /** Embedding width — must match your model (e.g. 1536 for text-embedding-3-small). Default 1536. */
448
- dimensions?: number;
514
+ /**
515
+ * Embedding width — must match your model (e.g. 1536 for text-embedding-3-small). Default 1536.
516
+ *
517
+ * Pass a **list** to let several models' vectors share one table (mixed dimensions, e.g. while
518
+ * migrating from a 768-wide local model to a 1536-wide hosted one): the column becomes an untyped
519
+ * `vector`, `ensureSchema` creates one *partial* HNSW index per listed width
520
+ * (`((embedding::vector(n))) … WHERE vector_dims(embedding) = n`), and `search` only compares the
521
+ * query against vectors of its own width, through that width's index. A query whose width is not
522
+ * listed is still answered — exactly, by a sequential scan. Filter on the model as well (put it in
523
+ * the chunk metadata) when two models share a width.
524
+ */
525
+ dimensions?: number | readonly number[];
526
+ /**
527
+ * Allow chunks with no embedding (`embedding: []` on upsert is stored as `NULL`): index text first
528
+ * and embed later, or keep full-text-only chunks when there is no embedding model at all. The
529
+ * vector leg skips them; the lexical leg of {@link PgLexicalVectorStore} still finds them. Default
530
+ * `false` — the column stays `NOT NULL`. Only affects the DDL `ensureSchema` emits for a new table.
531
+ */
532
+ nullableEmbeddings?: boolean;
533
+ /**
534
+ * pgvector ≥ 0.8 iterative index scans for `search`: keep walking the HNSW graph until enough rows
535
+ * pass the metadata filter, instead of returning fewer than `topK` when a selective filter (one
536
+ * tenant of many) rejects most of the candidates the index produced. Applied with `SET LOCAL`, so
537
+ * it needs a client with a `transaction` (a `pg` Pool, Drizzle or postgres.js all have one); it is
538
+ * silently skipped on an older pgvector or a client without transactions. Default off.
539
+ */
540
+ iterativeScan?: 'strict_order' | 'relaxed_order';
541
+ /** `hnsw.ef_search` for `search` (candidate list size; pgvector's default is 40). Needs a `transaction`. */
542
+ efSearch?: number;
543
+ /**
544
+ * Rows per multi-row `INSERT … ON CONFLICT` statement in `upsert`. Default 100. Duplicate ids in
545
+ * one `upsert` call collapse to the last occurrence (as the old row-by-row loop left them).
546
+ */
547
+ upsertBatchSize?: number;
449
548
  }
450
549
  /**
451
550
  * A pgvector-backed {@link VectorStore} — the production reference adapter. Cosine distance via the
452
551
  * `<=>` operator over an HNSW index; metadata in a `jsonb` column filtered with `@>`. Call
453
- * {@link PgVectorStore.ensureSchema} once at boot to create the extension, table, and index.
552
+ * {@link PgVectorStore.ensureSchema} once at boot to create the extension, table, and index — or copy
553
+ * {@link PgVectorStore.schemaStatements} into a migration.
554
+ *
555
+ * The constructor takes a `pg` `Pool`, a Drizzle database, a `postgres.js` `sql`, or a hand-written
556
+ * {@link PgClient} (see {@link toPgClient}).
454
557
  *
455
- * This store does **not** implement the optional
456
- * {@link import('./vector-store.js').LexicalVectorStore} capability, unlike
457
- * {@link import('./redis-vector-store.js').RedisVectorStore}. That is a deliberate omission, not an
458
- * oversight: RediSearch already indexes the chunk text (the schema declares it `TEXT`), so BM25 is
459
- * free there, whereas the table below indexes nothing lexically — `text` is a plain column with no
460
- * `tsvector` and no GIN index. Adding one is not a transparent upgrade:
558
+ * This class does **not** implement the optional
559
+ * {@link import('./vector-store.js').LexicalVectorStore} capability; {@link PgLexicalVectorStore}
560
+ * (below) does. The split is deliberate: lexical search over Postgres needs a GIN index, and a
561
+ * store that silently gained `searchText` on upgrade would be picked up by every
562
+ * `isLexicalVectorStore(store)` check and start sequentially scanning an unindexed chunks table:
461
563
  *
462
- * - it is new DDL in `ensureSchema`, and `CREATE INDEX` (non-concurrently, as this method must, since
564
+ * - it is new DDL, and `CREATE INDEX` (non-concurrently, as `ensureSchema` must, since
463
565
  * `CONCURRENTLY` cannot run in a transaction) takes a write lock on an already-populated chunks
464
566
  * table — a boot-time stall proportional to corpus size for every existing deployment;
465
567
  * - it forces a text-search-configuration choice (`english` vs `simple` vs …) that must match between
466
568
  * the index expression and every query, or Postgres silently ignores the index and sequentially
467
569
  * scans the corpus — a failure mode that stays *correct* while quietly getting slower with scale.
468
570
  *
469
- * Both want a migration a consumer runs and observes, not a side effect of upgrading the library. The
470
- * capability interface is open, so a `PgLexicalVectorStore` (or an option here, gated on an
471
- * explicitly-created index) can be added later without changing anything else.
571
+ * So lexical search is something you opt into by constructing the subclass, with the index created
572
+ * by a migration you run and watch (or by `ensureSchema`, on a table small enough not to care).
472
573
  *
473
574
  * The enumeration and bulk-deletion methods {@link VectorStore} requires need nothing new here,
474
575
  * unlike the lexical capability above: enumeration and bulk deletion are `DISTINCT`, `= ANY($1)`, `DELETE … WHERE`
475
576
  * and `count(*)` over the table and index that already exist. No DDL, no boot-time lock, no migration.
577
+ *
578
+ * Subclassing: every statement filters through {@link PgVectorStore.whereConditions}, so a subclass
579
+ * can map an opaque filter onto its own columns (a tenant id, an ACL) in one place.
476
580
  */
477
581
  declare class PgVectorStore implements VectorStore {
478
- private readonly client;
479
- private readonly table;
582
+ protected readonly client: PgClient;
583
+ protected readonly table: string;
584
+ /** The single width (fixed-dimension table), or `undefined` for a mixed-dimension table. */
480
585
  private readonly dimensions;
481
- constructor(client: PgClient, options?: PgVectorStoreOptions);
586
+ /** The widths with a partial HNSW index, for a mixed-dimension table. */
587
+ private readonly indexedDimensions;
588
+ private readonly nullableEmbeddings;
589
+ private readonly iterativeScan;
590
+ private readonly efSearch;
591
+ private readonly upsertBatchSize;
592
+ private iterativeScanSupport;
593
+ constructor(client: PgClientSource, options?: PgVectorStoreOptions);
482
594
  /** Telemetry self-description — the table is the namespace a retrieval was served from. */
483
595
  describeRetrieval(): RetrievalDescriptor;
484
- /** Idempotent DDL: the `vector` extension, the chunks table, and the cosine HNSW index. */
596
+ /**
597
+ * The idempotent DDL {@link PgVectorStore.ensureSchema} runs, in order — for a migration instead
598
+ * of a boot-time side effect. On a populated table, run the index statements `CONCURRENTLY` there.
599
+ */
600
+ schemaStatements(): string[];
601
+ /** Idempotent DDL: the `vector` extension, the chunks table, and the cosine HNSW index(es). */
485
602
  ensureSchema(): Promise<void>;
603
+ /**
604
+ * Multi-row `INSERT … ON CONFLICT (id) DO UPDATE`, {@link PgVectorStoreOptions.upsertBatchSize}
605
+ * rows per statement. An empty `embedding` is written as `NULL` (see
606
+ * {@link PgVectorStoreOptions.nullableEmbeddings}).
607
+ */
486
608
  upsert(records: VectorRecord[]): Promise<void>;
487
609
  remove(documentId: string): Promise<void>;
488
610
  /**
@@ -523,7 +645,51 @@ declare class PgVectorStore implements VectorStore {
523
645
  */
524
646
  removeWhere(filter: Record<string, unknown>): Promise<number>;
525
647
  countChunks(filter?: Record<string, unknown>): Promise<number>;
648
+ /**
649
+ * Cosine similarity, nearest first. On a mixed-dimension table only vectors as wide as the query
650
+ * are compared (through that width's partial index when it has one); chunks without an embedding
651
+ * are never returned.
652
+ */
526
653
  search(embedding: number[], options: VectorSearchOptions): Promise<Passage[]>;
654
+ /**
655
+ * The SQL conditions (ANDed) a metadata `filter` compiles to, appending their bindings to `params`
656
+ * (placeholders are numbered after what `params` already holds). Every statement that takes a
657
+ * filter goes through here, so a subclass that maps the filter onto its own columns — a tenant id,
658
+ * an access list — overrides this one method. Return `['false']` to deny.
659
+ */
660
+ protected whereConditions(filter: Record<string, unknown> | undefined, params: unknown[]): string[];
661
+ private where;
662
+ /** Run a read with the configured HNSW settings `SET LOCAL` in one transaction, when possible. */
663
+ private withSearchSettings;
664
+ /** `hnsw.iterative_scan` exists from pgvector 0.8.0; setting it on an older one is an error. */
665
+ private supportsIterativeScan;
666
+ }
667
+ /**
668
+ * {@link PgVectorStore} plus Postgres full-text search: a {@link LexicalVectorStore}, so
669
+ * `LexicalRetriever` and `HybridRetriever` work on Postgres exactly as on RediSearch — the dense leg
670
+ * over pgvector, the lexical leg over a `tsvector`, both on the same rows and ids.
671
+ *
672
+ * Ranking is `ts_rank_cd` (cover density). The query is parsed with `websearch_to_tsquery` (quoted
673
+ * phrases, `-exclusions`, `or`), which requires every word; when that matches nothing it retries
674
+ * with any word (see {@link PgFullTextOptions.anyTermFallback}).
675
+ *
676
+ * The `tsvector` is either a column you own ({@link PgFullTextOptions.column}) or the expression
677
+ * `to_tsvector(config, text)`, for which {@link PgVectorStore.schemaStatements} adds a GIN
678
+ * expression index. See {@link PgVectorStore} for why that index belongs in a migration on a
679
+ * populated table.
680
+ */
681
+ declare class PgLexicalVectorStore extends PgVectorStore implements LexicalVectorStore {
682
+ private readonly tsConfig;
683
+ private readonly tsColumn;
684
+ private readonly anyTermFallback;
685
+ constructor(client: PgClientSource, options?: PgVectorStoreOptions & {
686
+ fullText?: PgFullTextOptions;
687
+ });
688
+ schemaStatements(): string[];
689
+ searchText(query: string, options: VectorSearchOptions): Promise<Passage[]>;
690
+ private runTextSearch;
691
+ /** Must be character-for-character the index expression, or the planner won't use the index. */
692
+ private tsvector;
527
693
  }
528
694
 
529
695
  /**
@@ -1212,4 +1378,102 @@ interface RetrievalTool {
1212
1378
  */
1213
1379
  declare function createRetrievalTool(retriever: Retriever, options?: RetrievalToolOptions): RetrievalTool;
1214
1380
 
1215
- export { type ChunkOptions, type ChunkRecord, type DescribesRetrieval, EmbeddingRetriever, type EmbeddingRetrieverOptions, FilteredRetriever, HybridRetriever, type HybridRetrieverOptions, type IndexedDocument, type IngestChunksOptions, type IngestDocument, type IngestOptions, type InstrumentRetrieverOptions, KeywordRetriever, type KeywordRetrieverOptions, LexicalRetriever, type LexicalVectorStore, type ListChunksOptions, MemoryVectorStore, type MetadataPatch, type PgClient, PgVectorStore, type PgVectorStoreOptions, RAG_DIAGNOSTIC_LIB, RAG_RETRIEVAL_CHANNEL, RAG_RETRIEVAL_EVENT, type RagRetrievalEvent, type RedisSearchClient, RedisVectorSchemaMismatchError, RedisVectorStore, type RedisVectorStoreOptions, RerankingRetriever, type RerankingRetrieverOptions, type RetrievalDescriptor, type RetrievalTool, type RetrievalToolOptions, type RetrieverKind, type StoredChunk, UnsafeRemovalError, type VectorRecord, type VectorSearchOptions, type VectorStore, type VectorStoreKind, applyMetadataPatch, chunkDocuments, chunkIndexOf, chunkText, createRetrievalTool, describeRetrieval, describeSharedSource, describeSource, describesRetrieval, documentIdOf, emitRagRetrieval, ingestChunks, ingestDocuments, instrumentRetriever, isLexicalVectorStore };
1381
+ /** A non-2xx answer (or a malformed one) from an embeddings or rerank endpoint. */
1382
+ declare class HttpModelError extends Error {
1383
+ /** HTTP status; `502` when the endpoint answered 2xx with a body that doesn't fit the contract. */
1384
+ readonly status: number;
1385
+ constructor(
1386
+ /** HTTP status; `502` when the endpoint answered 2xx with a body that doesn't fit the contract. */
1387
+ status: number, message: string);
1388
+ }
1389
+ interface OpenAiEmbeddingsOptions {
1390
+ /** The embedding model id, sent as `model`. */
1391
+ model: string;
1392
+ /**
1393
+ * Base URL up to and including `/v1` — the client posts to `<baseUrl>/embeddings`. Default
1394
+ * `https://api.openai.com/v1`. Point it at any OpenAI-compatible server: Azure/OpenRouter/an LLM
1395
+ * gateway, Ollama (`http://localhost:11434/v1`), Hugging Face TEI, vLLM, LocalAI, LM Studio…
1396
+ */
1397
+ baseUrl?: string;
1398
+ /** Sent as `Authorization: Bearer <apiKey>` when set. Local servers usually need none. */
1399
+ apiKey?: string;
1400
+ /** Output width for models that support shortening (`text-embedding-3-*`), sent as `dimensions`. */
1401
+ dimensions?: number;
1402
+ /** Inputs per request. Default 64. */
1403
+ batchSize?: number;
1404
+ /**
1405
+ * Inputs longer than this many characters are truncated before sending, so one oversized chunk
1406
+ * doesn't fail a whole batch on the model's context limit. Default 24 000 (≈ 6–8k tokens); set
1407
+ * `Infinity` to send inputs as they are.
1408
+ */
1409
+ maxInputChars?: number;
1410
+ /** Extra request headers (an org/project id, a gateway's attribution header). */
1411
+ headers?: Record<string, string>;
1412
+ /** Per-request timeout. Default 120 000 ms. */
1413
+ timeoutMs?: number;
1414
+ /** Called with the provider-reported token count of every request — for cost accounting. */
1415
+ onUsage?: (tokens: number) => void;
1416
+ /** `fetch` to use. Default the global one. */
1417
+ fetch?: typeof fetch;
1418
+ }
1419
+ /**
1420
+ * An {@link EmbeddingProvider} over any OpenAI-compatible `POST /v1/embeddings` endpoint, with no SDK
1421
+ * dependency: OpenAI itself, or a gateway/local server speaking the same protocol (TEI, Ollama,
1422
+ * vLLM, LocalAI…). For a Vercel AI SDK model use `aiSdkEmbedding` from `-ai-sdk` instead.
1423
+ *
1424
+ * Batches by {@link OpenAiEmbeddingsOptions.batchSize}, restores input order from each item's
1425
+ * `index`, and fails loudly (an {@link HttpModelError}) on a non-2xx answer or a vector count that
1426
+ * doesn't match the inputs. Empty strings are sent as a single space, since OpenAI rejects them.
1427
+ *
1428
+ * ```ts
1429
+ * const embedder = openAiEmbeddings({ model: 'text-embedding-3-small', apiKey: process.env.OPENAI_API_KEY });
1430
+ * const local = openAiEmbeddings({ baseUrl: 'http://tei:8080/v1', model: 'BAAI/bge-m3' });
1431
+ * ```
1432
+ */
1433
+ declare function openAiEmbeddings(options: OpenAiEmbeddingsOptions): EmbeddingProvider;
1434
+
1435
+ interface HttpRerankerOptions {
1436
+ /**
1437
+ * The full rerank endpoint: `https://api.cohere.com/v2/rerank`, `https://api.jina.ai/v1/rerank`,
1438
+ * `https://api.voyageai.com/v1/rerank`, or a Hugging Face TEI / Infinity / vLLM server's `/rerank`.
1439
+ */
1440
+ url: string;
1441
+ /** Model id, sent as `model` (hosted APIs require it; TEI serves one model and ignores it). */
1442
+ model?: string;
1443
+ /** Sent as `Authorization: Bearer <apiKey>` when set. */
1444
+ apiKey?: string;
1445
+ /**
1446
+ * Request body dialect. `cohere` (Cohere, Jina, Voyage, Infinity, vLLM): `{ query, documents,
1447
+ * top_n }`. `tei`: `{ query, texts }`. Default `auto`, which sends `documents` **and** `texts` so
1448
+ * one config works against both families. Responses are read in every dialect regardless.
1449
+ */
1450
+ format?: 'auto' | 'cohere' | 'tei';
1451
+ /** Extra request headers. */
1452
+ headers?: Record<string, string>;
1453
+ /** Per-request timeout. Default 30 000 ms. */
1454
+ timeoutMs?: number;
1455
+ /** `fetch` to use. Default the global one. */
1456
+ fetch?: typeof fetch;
1457
+ }
1458
+ /**
1459
+ * A cross-encoder {@link Reranker} behind an HTTP `/rerank` endpoint — the Cohere-style contract
1460
+ * most providers and self-hosted servers share. Compose it with `RerankingRetriever`:
1461
+ *
1462
+ * ```ts
1463
+ * const reranker = new HttpReranker({ url: 'https://api.cohere.com/v2/rerank', model: 'rerank-v3.5', apiKey });
1464
+ * const retriever = new RerankingRetriever(hybrid, reranker, { fetchTopK: 30 });
1465
+ * ```
1466
+ *
1467
+ * Reads `results: [{ index, relevance_score }]` (Cohere, Jina), `data: [{ index, relevance_score }]`
1468
+ * (Voyage) and a bare `[{ index, score }]` (TEI). Each passage keeps its fields and takes the new
1469
+ * score; the list is re-sorted and cut to `topK`. Indices the server invents are ignored.
1470
+ */
1471
+ declare class HttpReranker implements Reranker {
1472
+ private readonly options;
1473
+ private readonly format;
1474
+ private readonly doFetch;
1475
+ constructor(options: HttpRerankerOptions);
1476
+ rerank(query: string, passages: Passage[], options?: RerankOptions): Promise<Passage[]>;
1477
+ }
1478
+
1479
+ export { type ChunkOptions, type ChunkRecord, type DescribesRetrieval, type DrizzleLike, EmbeddingRetriever, type EmbeddingRetrieverOptions, FilteredRetriever, HttpModelError, HttpReranker, type HttpRerankerOptions, HybridRetriever, type HybridRetrieverOptions, type IndexedDocument, type IngestChunksOptions, type IngestDocument, type IngestOptions, type InstrumentRetrieverOptions, KeywordRetriever, type KeywordRetrieverOptions, LexicalRetriever, type LexicalVectorStore, type ListChunksOptions, MemoryVectorStore, type MetadataPatch, type NodePgQueryable, type OpenAiEmbeddingsOptions, type PgClient, type PgClientSource, type PgFullTextOptions, PgLexicalVectorStore, PgVectorStore, type PgVectorStoreOptions, type PostgresJsSql, RAG_DIAGNOSTIC_LIB, RAG_RETRIEVAL_CHANNEL, RAG_RETRIEVAL_EVENT, type RagRetrievalEvent, type RedisSearchClient, RedisVectorSchemaMismatchError, RedisVectorStore, type RedisVectorStoreOptions, RerankingRetriever, type RerankingRetrieverOptions, type RetrievalDescriptor, type RetrievalTool, type RetrievalToolOptions, type RetrieverKind, type StoredChunk, UnsafeRemovalError, type VectorRecord, type VectorSearchOptions, type VectorStore, type VectorStoreKind, applyMetadataPatch, chunkDocuments, chunkIndexOf, chunkText, createRetrievalTool, describeRetrieval, describeSharedSource, describeSource, describesRetrieval, documentIdOf, emitRagRetrieval, ingestChunks, ingestDocuments, instrumentRetriever, isLexicalVectorStore, openAiEmbeddings, toPgClient };