@squidcloud/client
    Preparing search index...

    Interface AiKnowledgeBaseChatOptions

    The options for the AI knowledgebase search method.

    interface AiKnowledgeBaseChatOptions {
        chatModel?: AiChatModelSelection;
        chunkLimit?: number;
        contextMetadataFilter?: MetadataFilter;
        hybridWeights?: AiHybridSearchWeights;
        includeMetadata?: boolean;
        includeReference?: boolean;
        limit?: number;
        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

    contextMetadataFilter?: MetadataFilter

    A set of filters that will limit the context the AI can access.

    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.

    includeMetadata?: boolean

    Include metadata in the context

    includeReference?: boolean

    Whether to include references from the source context in the response. Default to false.

    limit?: number

    The maximum number of results to return. Defaults to 30

    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.