Query
AI-generatedSummary
Execute a semantic search query against a LightRAG knowledge graph stored in a specified MongoDB database, combining vector similarity, full-text search, and knowledge graph traversal to retrieve relevant entities, relations, and text chunks.
Inputs
- Database Name or ID (required) — MongoDB database containing the LightRAG collections to query.
- Vector Search Query — Semantic query string used for embedding-based retrieval and entity vector search.
- Full-Text Search Query — Keyword-based query string used for MongoDB full-text search on text chunks.
- Retrieval Mode (required) — Determines the search approach combining vector, full-text, entity, and graph traversal methods. Options include 'hybridKG' (default), 'hybrid', 'mix', 'naive', and 'entity'.
- Top K Entities (required) — Number of top entities to retrieve by vector similarity when using modes involving entities and graph traversal.
- Top K Chunks (required) — Number of top text chunks to return after merging search results using Reciprocal Rank Fusion.
- Retrieve Only (No LLM) (required) — If true, returns only the raw retrieved entities, relations, and chunks without invoking the language model for answer generation.
- Include References in Output (required) — When not in retrieve-only mode, controls whether the output includes matched entities, relations, and source chunks alongside the generated response.
- Workspace Override — Optional workspace name override to select a different knowledge base than the default from credentials.
Output shape
a single JSON object per item containing the generated answer or raw retrieval results, plus metadata about the query and workspace.
If 'Retrieve Only' is true, returns raw retrieval results without any generated text. Otherwise, runs an LLM prompt with the retrieved context to generate a concise answer. If 'Include References in Output' is enabled (and not in retrieve-only mode), matched entities, relations, and chunks are included in the output JSON for transparency and debugging.
Examples
Example 1: Using 'Hybrid KG' mode to query the knowledge graph combining vector, full-text, and graph traversal; generating a concise answer plus optional references.
Database name chosen; vector and/or full-text query provided; topKEntities and topKChunks set; retrieveOnly false; includeReferences optionally true.