mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-18 05:37:24 +08:00
### Summary Agentic search <img width="1149" height="1575" alt="image" src="https://github.com/user-attachments/assets/bce9a3e7-0517-4fb2-80a2-5d2a81a4da78" /> --------- Co-authored-by: Yingfeng Zhang <yingfeng.zhang@gmail.com>
47 lines
3.1 KiB
Python
47 lines
3.1 KiB
Python
"""Tool system: register all tools with the registry on import."""
|
|
|
|
from rag.advanced_rag.harness.tools.registry import register_tool, _search_schema, _navigate_schema, _inspector_schema
|
|
|
|
# Register tools
|
|
|
|
# Search tools
|
|
from rag.advanced_rag.harness.tools.search import hybrid_search, vector_search, bm25_search, web_search, structured_query
|
|
|
|
register_tool("hybrid_search", _search_schema("hybrid_search", "Embedding + Keywords search"), hybrid_search)
|
|
register_tool("vector_search", _search_schema("vector_search", "Embedding search"), vector_search)
|
|
register_tool("bm25_search", _search_schema("bm25_search", "Keywords search"), bm25_search)
|
|
register_tool("web_search", _search_schema("web_search", "Internet search"), web_search)
|
|
register_tool("structured_query", _search_schema("structured_query", "SQL search"), structured_query)
|
|
|
|
# Navigation tools (require compilation)
|
|
from rag.advanced_rag.harness.tools.navigation import toc_navigate, page_index_navigate, mindmap_navigate
|
|
|
|
register_tool("toc_navigate", _navigate_schema("toc_navigate", "Navigation with table of content"), toc_navigate, requires_compilation=True, compilation_type="toc")
|
|
register_tool("page_index_navigate", _navigate_schema("page_index_navigate", "Navigation with extracted titles"), page_index_navigate, requires_compilation=True, compilation_type="page_index")
|
|
register_tool("mindmap_navigate", _navigate_schema("mindmap_navigate", "Navigate by mindmap"), mindmap_navigate, requires_compilation=True, compilation_type="mindmap")
|
|
|
|
# Exploration tools (require compilation)
|
|
from rag.advanced_rag.harness.tools.exploration import graph_explore, wiki_query
|
|
|
|
register_tool("graph_explore", _search_schema("graph_explore", "Knowledge graph exploration"), graph_explore, requires_compilation=True, compilation_type="knowledge_graph")
|
|
register_tool("wiki_query", _search_schema("wiki_query", "Wiki search"), wiki_query, requires_compilation=True, compilation_type="wiki")
|
|
|
|
# Inspector tools
|
|
from rag.advanced_rag.harness.tools.inspector import open_context, compare_sources, grep_within, request_adjacent
|
|
|
|
register_tool(
|
|
"inspector_open_context",
|
|
_inspector_schema("open_context", "Expand the original context around a chunk", {"chunk_id": {"type": "string"}, "width": {"type": "integer", "description": "Number of characters to expand"}}),
|
|
open_context,
|
|
)
|
|
register_tool("inspector_compare", _inspector_schema("compare_sources", "Compare multiple chunks to find common points and contradictions", {"chunk_ids": {"type": "array", "items": {"type": "string"}}}), compare_sources)
|
|
register_tool("inspector_grep_within", _inspector_schema("grep_within", "Search for an exact keyword or pattern within a document", {"doc_id": {"type": "string"}, "pattern": {"type": "string"}}), grep_within)
|
|
register_tool(
|
|
"inspector_request_adjacent",
|
|
_inspector_schema("request_adjacent", "Get adjacent entries before or after a chunk", {"chunk_id": {"type": "string"}, "direction": {"type": "string", "enum": ["prev", "next"]}, "count": {"type": "integer"}}),
|
|
request_adjacent,
|
|
)
|
|
|
|
# Built-in agent tools
|
|
# (generate_report and think_tool are handled by the agent loop itself, not by Pipeline)
|