Project Files
src / utils / embeddingPrefixes.ts
/**
* Prompt prefixes required by nomic-embed-text-v1.5.
*
* The model is trained to produce better asymmetric retrieval when documents
* and queries are prefixed with their role. Without these prefixes, relevance
* scoring degrades measurably — a well-documented footgun for this model.
*
* See: https://huggingface.co/nomic-ai/nomic-embed-text-v1.5
*
* IMPORTANT: Changing these prefixes invalidates any previously-built vector
* store. Users must re-index after a change.
*/
export function asDocumentEmbeddingInput(text: string): string {
return `search_document: ${text}`;
}
export function asQueryEmbeddingInput(text: string): string {
return `search_query: ${text}`;
}