Expose pure chunks retrieval as an OpenAPI surface so external systems
(e.g. DeepAgents-style agents bringing their own LLM) can use BiSheng
knowledge bases as a retrieval tool without engaging the SSE RAG path.
- POST /api/v2/filelib/retrieve, authenticated as default_operator
- Supports multiple knowledge bases in one call with per-KB tag filters
(ANY mode; ALL reserved for future use)
- Each returned chunk is tagged with knowledge_id for source attribution
- Reuses _build_folder_search_kwargs + KnowledgeRetrieverTool (RRF +
primary-version filter) from KnowledgeSpaceChatService
- 13 unit tests covering input validation, multi-KB merge, top_k
truncation, tag-name resolution, and KB-not-found
- API reference at docs/api/filelib-retrieve.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>