@mastra/core
Version:
43 lines • 2.12 kB
TypeScript
import type { KnowledgeStorage } from '../storage/domains/knowledge/index.js';
import type { KnowledgeSemanticIndex } from './semantic.js';
/** @experimental */
export interface KnowledgeReembedOptions {
/** Only this scope's pages and the notes on them, e.g. `org:acme`. Default: the whole store. */
scope?: string;
/** Pages handled in this call, 1 to 500. A page's notes go with it; in a whole-store run, each scope whose page notes are embedded also counts as one. Default 50. */
limit?: number;
/** `nextCursor` from the previous call. Omit to start. */
cursor?: string;
}
/** @experimental */
export interface KnowledgeReembedResult {
/** What this call embedded. */
embedded: {
pages: number;
notes: number;
};
/** Pages and notes whose embed still failed after Knowledge's own retries (other than rate limiting); the rest of the batch went on. A later run retries them. */
failed: Array<{
kind: 'page' | 'note';
id: string;
error: string;
}>;
/** Pages longer than the chunk cap: embedded up to it, the rest is found by keyword search only. */
overChunkCap: Array<{
pageId: string;
chunks: number;
}>;
/** The embedder kept rate limiting, so the call stopped early. Wait before passing `nextCursor`, which resumes where it stopped, mid-page if need be. `embedded` and `failed` still count what this call got done. */
rateLimited?: true;
/** Pass it to the next call to go on. Absent when everything has been handled. */
nextCursor?: string;
}
/**
* Embeds existing pages and notes in batches, without changing them. Each call handles up to
* `limit` pages with their notes and returns a cursor to go on from, so a run over a large store
* can stop and resume. Vector ids are fixed per page chunk and note, so handling a page again
* overwrites its vectors.
* @internal
*/
export declare function reembedKnowledge(storage: KnowledgeStorage, index: KnowledgeSemanticIndex, options?: KnowledgeReembedOptions): Promise<KnowledgeReembedResult>;
//# sourceMappingURL=reembed.d.ts.map