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

Implementation:1Panel dev MaxKB BaseSearchKnowledgeNode

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

Overview

Concrete workflow node for knowledge base search within the flow execution engine, provided by MaxKB.

Description

The BaseSearchKnowledgeNode class implements the ISearchKnowledgeStepNode interface for the flow (workflow) engine. It executes a vector similarity search against configured knowledge bases, retrieves matching paragraphs, and returns them as a NodeResult containing `paragraph_list`, `data` (formatted text), and `directly_return` (paragraphs meeting direct-return thresholds). The node supports scope filtering by referenced knowledge or documents from previous nodes, applies workspace-level authorization, and cleans up orphaned vector records.

Usage

Import this class when you need to:

  • Execute knowledge base search as a step in the workflow (flow) engine
  • Retrieve and format paragraph results for downstream AI chat nodes
  • Apply knowledge search with authorization and scope filtering

Code Reference

Source Location

  • Repository: MaxKB
  • File: apps/application/flow/step_node/search_knowledge_node/impl/base_search_knowledge_node.py

Signature

class BaseSearchKnowledgeNode(ISearchKnowledgeStepNode):
    def execute(
        self,
        knowledge_id_list: list,
        knowledge_setting: dict,
        question: str,
        show_knowledge: bool,
        search_scope_type: str,
        search_scope_source: str,
        search_scope_reference: list,
        exclude_paragraph_id_list: list = None,
        **kwargs,
    ) -> NodeResult:
        """Execute knowledge search and return paragraph results."""

Import

from application.flow.step_node.search_knowledge_node.impl.base_search_knowledge_node import BaseSearchKnowledgeNode
# Accessed via factory:
from application.flow.step_node import get_node
node_class = get_node('search-dataset-node', workflow_mode)

I/O Contract

Inputs

Name Type Required Description
knowledge_id_list list[str] Yes Knowledge base IDs to search
knowledge_setting dict Yes Settings: top_n, similarity, search_mode, max_paragraph_char_number
question str Yes User question to search for
show_knowledge bool Yes Whether to display knowledge source info
search_scope_type str Yes Scope type: 'referencing' or direct
search_scope_source str Yes Scope source: 'knowledge' or 'document'
search_scope_reference list No Reference field path for scoped search
exclude_paragraph_id_list list No Paragraph IDs to exclude

Outputs

Name Type Description
returns NodeResult Contains paragraph_list, is_hit_handling_method_list, data, directly_return, question
node_variable['paragraph_list'] List[Dict] Matching paragraphs with similarity scores
node_variable['data'] str Formatted paragraph text (truncated to max_paragraph_char_number)

Usage Examples

Executing Knowledge Search in a Workflow

# Node is instantiated by the workflow engine via get_node factory
from application.flow.step_node import get_node

# Get the node class for the application workflow mode
node_class = get_node('search-dataset-node', 'application')

# The workflow engine calls execute() with params from node config:
result = node.execute(
    knowledge_id_list=["kb-uuid-1", "kb-uuid-2"],
    knowledge_setting={
        "top_n": 5,
        "similarity": 0.6,
        "search_mode": "embedding",
        "max_paragraph_char_number": 5000,
    },
    question="How does RAG work?",
    show_knowledge=True,
    search_scope_type="directly",
    search_scope_source="knowledge",
    search_scope_reference=None,
)
# result.node_variable contains paragraph_list, data, directly_return

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

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