Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1Panel dev MaxKB Knowledge Search

From Leeroopedia
Knowledge Sources
Domains RAG, Search
Last Updated 2026-10-10 00:00 GMT

Overview

A retrieval process that finds relevant knowledge base paragraphs by comparing the user's query against stored embeddings, returning ranked results with similarity scores.

Description

Knowledge search is the retrieval step in RAG. Given a user question, the system embeds the query, searches across configured knowledge bases using vector similarity (and optionally keyword matching), and returns the top-N matching paragraphs. The results include similarity scores and metadata (document name, knowledge base, hit-handling method). Two implementations exist in MaxKB: BaseSearchKnowledgeNode for the flow engine and BaseSearchDatasetStep for the legacy pipeline. Both support the "directly return" optimization where high-similarity paragraphs bypass the LLM entirely.

Usage

Use this principle when designing:

  • RAG retrieval pipelines for chat applications
  • Knowledge base search with multiple search modes (embedding, keywords, blend)
  • Authorization-filtered knowledge search in multi-tenant systems

Theoretical Basis

The retrieval process follows these steps:

# Abstract algorithm description (NOT real implementation)
query_vec = embedding_model.embed(question)
results = vector_store.query(
    query_embedding=query_vec,
    knowledge_filter=knowledge_id_list,
    top_n=top_n,
    similarity_threshold=similarity,
    search_mode=search_mode,  # embedding | keywords | blend
)
# Post-process: fetch paragraph content, check directly-return threshold
for result in results:
    if result.similarity >= paragraph.directly_return_similarity:
        return paragraph  # Bypass LLM

The directly return optimization is a key design decision: when a paragraph's similarity exceeds a configurable threshold AND its `hit_handling_method` is `directly_return`, the paragraph is returned directly to the user without LLM processing, reducing latency and token cost.

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment