diff --git a/lightrag/api/routers/query_routes.py b/lightrag/api/routers/query_routes.py
index c9648356..81603487 100644
--- a/lightrag/api/routers/query_routes.py
+++ b/lightrag/api/routers/query_routes.py
@@ -22,7 +22,7 @@ class QueryRequest(BaseModel):
description="The query text",
)
- mode: Literal["local", "global", "hybrid", "naive", "mix"] = Field(
+ mode: Literal["local", "global", "hybrid", "naive", "mix", "bypass"] = Field(
default="hybrid",
description="Query mode",
)
diff --git a/lightrag/base.py b/lightrag/base.py
index 5cf5ab61..e2b0fd32 100644
--- a/lightrag/base.py
+++ b/lightrag/base.py
@@ -36,7 +36,7 @@ T = TypeVar("T")
class QueryParam:
"""Configuration parameters for query execution in LightRAG."""
- mode: Literal["local", "global", "hybrid", "naive", "mix"] = "global"
+ mode: Literal["local", "global", "hybrid", "naive", "mix", "bypass"] = "global"
"""Specifies the retrieval mode:
- "local": Focuses on context-dependent information.
- "global": Utilizes global knowledge.
diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py
index 0933a4d1..386ea814 100644
--- a/lightrag/lightrag.py
+++ b/lightrag/lightrag.py
@@ -1381,6 +1381,14 @@ class LightRAG:
hashing_kv=self.llm_response_cache, # Directly use llm_response_cache
system_prompt=system_prompt,
)
+ elif param.mode == "bypass":
+ # Bypass mode: directly use LLM without knowledge retrieval
+ use_llm_func = param.model_func or global_config["llm_model_func"]
+ response = await use_llm_func(
+ query.strip(),
+ system_prompt=system_prompt,
+ history_messages=param.conversation_history,
+ )
else:
raise ValueError(f"Unknown mode {param.mode}")
await self._query_done()
diff --git a/lightrag_webui/src/api/lightrag.ts b/lightrag_webui/src/api/lightrag.ts
index bd49f7dc..98ac703f 100644
--- a/lightrag_webui/src/api/lightrag.ts
+++ b/lightrag_webui/src/api/lightrag.ts
@@ -65,8 +65,9 @@ export type LightragDocumentsScanProgress = {
* - "global": Utilizes global knowledge.
* - "hybrid": Combines local and global retrieval methods.
* - "mix": Integrates knowledge graph and vector retrieval.
+ * - "bypass": Bypasses knowledge retrieval and directly uses the LLM.
*/
-export type QueryMode = 'naive' | 'local' | 'global' | 'hybrid' | 'mix'
+export type QueryMode = 'naive' | 'local' | 'global' | 'hybrid' | 'mix' | 'bypass'
export type Message = {
role: 'user' | 'assistant' | 'system'
diff --git a/lightrag_webui/src/components/retrieval/QuerySettings.tsx b/lightrag_webui/src/components/retrieval/QuerySettings.tsx
index 9fca1782..f5e17cc1 100644
--- a/lightrag_webui/src/components/retrieval/QuerySettings.tsx
+++ b/lightrag_webui/src/components/retrieval/QuerySettings.tsx
@@ -55,6 +55,7 @@ export default function QuerySettings() {
{t('retrievePanel.querySettings.queryModeOptions.global')}
{t('retrievePanel.querySettings.queryModeOptions.hybrid')}
{t('retrievePanel.querySettings.queryModeOptions.mix')}
+ {t('retrievePanel.querySettings.queryModeOptions.bypass')}
diff --git a/lightrag_webui/src/locales/ar.json b/lightrag_webui/src/locales/ar.json
index 36f31e92..42d9d527 100644
--- a/lightrag_webui/src/locales/ar.json
+++ b/lightrag_webui/src/locales/ar.json
@@ -302,7 +302,8 @@
"local": "محلي",
"global": "عالمي",
"hybrid": "مختلط",
- "mix": "مزيج"
+ "mix": "مزيج",
+ "bypass": "تجاوز"
},
"responseFormat": "تنسيق الرد",
"responseFormatTooltip": "يحدد تنسيق الرد. أمثلة:\n• فقرات متعددة\n• فقرة واحدة\n• نقاط نقطية",
diff --git a/lightrag_webui/src/locales/en.json b/lightrag_webui/src/locales/en.json
index 13b6e5a5..96e1dd19 100644
--- a/lightrag_webui/src/locales/en.json
+++ b/lightrag_webui/src/locales/en.json
@@ -301,7 +301,8 @@
"local": "Local",
"global": "Global",
"hybrid": "Hybrid",
- "mix": "Mix"
+ "mix": "Mix",
+ "bypass": "Bypass"
},
"responseFormat": "Response Format",
"responseFormatTooltip": "Defines the response format. Examples:\n• Multiple Paragraphs\n• Single Paragraph\n• Bullet Points",
diff --git a/lightrag_webui/src/locales/fr.json b/lightrag_webui/src/locales/fr.json
index dbba9480..20012f58 100644
--- a/lightrag_webui/src/locales/fr.json
+++ b/lightrag_webui/src/locales/fr.json
@@ -302,7 +302,8 @@
"local": "Local",
"global": "Global",
"hybrid": "Hybride",
- "mix": "Mixte"
+ "mix": "Mixte",
+ "bypass": "Bypass"
},
"responseFormat": "Format de réponse",
"responseFormatTooltip": "Définit le format de la réponse. Exemples :\n• Plusieurs paragraphes\n• Paragraphe unique\n• Points à puces",
diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json
index df4c33c3..c1f58e4b 100644
--- a/lightrag_webui/src/locales/zh.json
+++ b/lightrag_webui/src/locales/zh.json
@@ -302,7 +302,8 @@
"local": "Local",
"global": "Global",
"hybrid": "Hybrid",
- "mix": "Mix"
+ "mix": "Mix",
+ "bypass": "Bypass"
},
"responseFormat": "响应格式",
"responseFormatTooltip": "定义响应格式。例如:\n• 多段落\n• 单段落\n• 要点",