query_data
Retrieve raw entities, relationships, and text chunks relevant to a query for custom answer generation. Get evidence with references to compose your own response.
Instructions
Retrieve the raw entities, relationships and text chunks relevant to
a question, WITHOUT having LightRAG's LLM compose an answer. Use this
instead of query when the caller (e.g. Hermes) wants to compose its
own answer from the retrieved evidence. Always includes references.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Retrieval mode. 'mix' (default) combines knowledge-graph and vector retrieval and is the best general-purpose choice. 'local' favors entities near the query, 'global' favors relationships, 'hybrid' combines local+global, 'naive' is plain vector search, and 'bypass' skips retrieval entirely and sends the query straight to the LLM. | mix |
| query | Yes | The question or instruction to answer using the knowledge base. Must not be empty. | |
| top_k | No | Number of top items to retrieve: entities in 'local' mode, relationships in 'global' mode. | |
| chunk_top_k | No | Number of text chunks to retrieve and keep after reranking. | |
| hl_keywords | No | High-level keywords to prioritize in retrieval. Leave empty to let LightRAG derive them. | |
| ll_keywords | No | Low-level keywords to refine retrieval focus. Leave empty to let LightRAG derive them. | |
| user_prompt | No | Extra instructions for the answering LLM. Does not affect retrieval. | |
| enable_rerank | No | Enable reranking of retrieved text chunks, if a rerank model is configured. | |
| response_type | No | Desired response format, e.g. 'Multiple Paragraphs', 'Single Paragraph', 'Bullet Points'. | |
| max_total_tokens | No | Maximum total token budget for the whole query context (entities + relations + chunks + system prompt). | |
| max_entity_tokens | No | Maximum tokens allocated to entity context. | |
| max_relation_tokens | No | Maximum tokens allocated to relationship context. | |
| conversation_history | No | Prior turns for context only (not used for retrieval), as [{'role': 'user'|'assistant', 'content': '...'}, ...]. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||