agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
69 lines • 3.31 kB
TypeScript
import { type MemoryFormatFlavor } from '../stages/formatDefault.js';
import type { RetrievalStrategy } from '../retrieval/types.js';
import type { MemoryStore } from '../store/index.js';
import type { MemoryPipeline } from './types.js';
import type { Embedder } from '../embedding/types.js';
export interface SemanticPipelineConfig {
/** Vector-capable store. Must implement `search()`. */
readonly store: MemoryStore;
/**
* Embedder used for both write-side indexing and read-side query.
*
* Optional since 9.3.0 for stores that declare `ranksBy: 'server-text'`:
* they take the query as words, so nothing here embeds. **Without one there
* is no WRITE half** — this library cannot embed a turn it has no embedder
* for, and a write subflow that stored vectorless entries into a backend
* that never reads them would be a no-op wearing a stage's name. The
* returned pipeline then carries `read` only (`defineMemory` refuses the
* combination unless the memory is `readOnly`, so the missing half is never
* a surprise).
*/
readonly embedder?: Embedder;
/**
* Stable id for the embedder — attached to written entries and used
* as a filter at read time so a later embedder swap doesn't produce
* cross-model similarity pollution. Example: `"openai-text-embedding-3-small"`.
*/
readonly embedderId?: string;
/** Top-k entries to consider per turn. Default 20; picker narrows further. */
readonly k?: number;
/** Cosine threshold below which matches are dropped. Default none. */
readonly minScore?: number;
/**
* Character budget for the admitted passages, spent in rank order
* (8.19.0). Default none — `k` stays the only bound, as before.
*/
readonly maxChars?: number;
/** Tier filter for retrieval. */
readonly tiers?: ReadonlyArray<'hot' | 'warm' | 'cold'>;
/** Tier to tag writes with. */
readonly writeTier?: 'hot' | 'warm' | 'cold';
/** TTL for written entries (ms from write time). */
readonly writeTtlMs?: number;
/** Forwarded to `pickByBudget`. */
readonly reserveTokens?: number;
readonly minimumTokens?: number;
readonly maxEntries?: number;
/** Forwarded to `formatDefault`. */
readonly formatHeader?: string;
readonly formatFooter?: string;
/**
* The retrieval rule (8.8.0). Replaces `k` + `minScore` above; see
* {@link RetrievalStrategy}. When absent, `topK({ k, threshold: minScore })`
* is built from those two — the same rule, spelled the old way.
*/
readonly retrieval?: RetrievalStrategy;
/**
* Which claim the injected block makes (8.8.0). `'rag'` renders each
* entry as a citable `<source>` with its document, page and score;
* `'memory'` (default) keeps the conversation-recall `<memory>` shape
* byte for byte.
*/
readonly flavor?: MemoryFormatFlavor;
}
/**
* Build the semantic read + write pipelines sharing a single store.
* Returns `{ read, write }` ready to pass to `Agent.memory()` via the appropriate `defineMemory` config (or used directly via `mountMemoryRead`/`mountMemoryWrite`).
*/
export declare function semanticPipeline(config: SemanticPipelineConfig): MemoryPipeline;
//# sourceMappingURL=semantic.d.ts.map