UNPKG

socraticode

Version:

SocratiCode — MCP server for local codebase indexing, semantic search, and code dependency graphs. All private, all local via Docker.

39 lines • 2.16 kB
/** * Generate embeddings for a batch of texts, handling batching automatically. * Texts are pre-truncated to the model's context window inside the provider. * * Takes the texts as given: task prefixes are the caller's business, added by * {@link prepareDocumentText} before the texts get here. */ export declare function generateEmbeddings(texts: string[], onBatchComplete?: (processed: number, total: number) => void): Promise<number[][]>; /** * Generate a single query embedding, prefixed with the configured query task * prefix (`EMBEDDING_QUERY_PREFIX`; see `queryPrefix` in embedding-config.ts). */ export declare function generateQueryEmbedding(query: string, effectiveQueryPrefix?: string): Promise<number[]>; /** * Prepare text for embedding: the document task prefix, then the file path, then * the content. The prefix is configurable through `EMBEDDING_DOCUMENT_PREFIX`; * see `documentPrefix` in embedding-config.ts for what each model expects. * * The path is included unless `EMBEDDING_DOCUMENT_INCLUDE_PATH` turns it off * (see `documentIncludesPath` in embedding-config.ts). With the path off the * content follows the prefix directly, and nothing separates the two but the * prefix itself: the default ends in a space, so the text still reads as a * prefixed passage, while a prefix configured without one runs straight into * the content. * * Callers hand the result to the vector store as the text to embed, so it drives * the dense vector and the BM25 sparse vector derived from that same string. * It is not what gets stored for display: the payload keeps the raw chunk * content, unprefixed. Dropping the path therefore removes path-derived tokens * from lexical search as well as from the dense vector, and for context * artifacts — whose `filePath` is a `context:<name>:<path>` identifier — it * drops the artifact name along with the path. */ export interface DocumentTextProfile { documentPrefix: string; documentIncludesPath: boolean; } export declare function prepareDocumentText(content: string, filePath: string, profile?: DocumentTextProfile): string; //# sourceMappingURL=embeddings.d.ts.map