From 1766cddd6c76f5bef1f1dd0e313b6e4385e453b5 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 27 Sep 2025 15:11:51 +0800 Subject: [PATCH] Fix mode parameter serialization error in Ollama chat API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Use mode.value for API requests • Add debug logging in aquery_llm --- lightrag/api/routers/ollama_api.py | 2 +- lightrag/lightrag.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lightrag/api/routers/ollama_api.py b/lightrag/api/routers/ollama_api.py index c8cf94a2..426583f8 100644 --- a/lightrag/api/routers/ollama_api.py +++ b/lightrag/api/routers/ollama_api.py @@ -499,7 +499,7 @@ class OllamaAPI: prompt_tokens = estimate_tokens(cleaned_query) param_dict = { - "mode": mode, + "mode": mode.value, "stream": request.stream, "only_need_context": only_need_context, "conversation_history": conversation_history, diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 6e4e3b04..60c296ac 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -2322,6 +2322,8 @@ class LightRAG: Returns: dict[str, Any]: Complete response with structured data and LLM response. """ + logger.debug(f"[aquery_llm] Query param: {param}") + global_config = asdict(self) try: