@squidcloud/client
    Preparing search index...

    Interface AiKnowledgeBaseSearchOptions

    Specific options for the AI knowledgebase search method.

    interface AiKnowledgeBaseSearchOptions {
        chatModel?: AiChatModelSelection;
        chunkLimit?: number;
        graphFilter?: AiKnowledgeBaseGraphFilter;
        graphOptions?: AiKnowledgeBaseGraphSearchOptions;
        hybridWeights?: AiHybridSearchWeights;
        limit?: number;
        prompt: string;
        rerankProvider?: "cohere" | "none";
        searchMode?: AiKnowledgeBaseSearchMode;
    }
    Index

    Properties

    Which chat model to use when asking the question

    chunkLimit?: number

    How many chunks to look over. Defaults to 100

    Scopes the search to the documents under one concept of the KB's graph (Layered KB Graph). Composes with every searchMode and with contextMetadataFilter. Requires graphRag.enabled.

    Tuning for searchMode:'graph' (GraphRAG). Ignored for other search modes.

    hybridWeights?: AiHybridSearchWeights

    Per-pipeline weights for native hybrid fusion (Mongo $rankFusion.combination.weights). Only applies when searchMode is 'hybrid' on a backend with native fusion; ignored otherwise. Each value must be a finite non-negative number; an omitted key defaults to 1 (the MongoDB default). Useful for A/B evaluating dense-vs-keyword weighting on the same backend.

    limit?: number

    The maximum number of results to return

    prompt: string

    The prompt to search for

    rerankProvider?: "cohere" | "none"

    Which provider's reranker to use for reranking the context. Defaults to 'cohere'.

    Selects how the underlying vector store generates candidates:

    • 'hybrid' (default): fuses dense vector and keyword candidates when the backend supports it (Mongo Atlas uses $rankFusion; backends without native fusion fall back to dense-only with the legacy app-side keyword fallback).
    • 'vector': dense-only — skips native fusion even on backends that support it.
    • 'keyword': embedding-free lexical retrieval; the mechanism is backend-specific. On Mongo Atlas it is native Lucene BM25 ($search): results are ranked by relevance and term-optional — a partial-term query still returns its best matches. On Postgres it is a boolean substring filter (ILIKE ALL): every whitespace-separated term must appear in a chunk as a literal, case-insensitive substring, matched independently (order, adjacency and relevance are NOT considered), so results are unranked and for broad terms the returned top-k is arbitrary. Both skip embedding, dense, reranking and the app-side keyword fallback. Lets an agent (or an eval) target exact tokens — identifiers, names, codes — that dense retrieval tends to miss.

    Intended to let A/B evaluations compare dense-only, hybrid and boolean-keyword candidate generation on the same backend.

    When omitted, the default is 'graph' (RRF-fused GraphRAG) on a graphRag.enabled KB and 'hybrid' otherwise. See AiKnowledgeBaseSearchMode.