From d1969515d386a948051a68604a55a229011ee613 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 25 Jan 2025 16:29:18 +0800 Subject: [PATCH] Add conversation history to naive_query prompt --- lightrag/operate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index 75bb2c25..74ffa462 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -1534,9 +1534,16 @@ async def naive_query( if query_param.only_need_context: return section + # Process conversation history + history_context = "" + if query_param.conversation_history: + history_context = get_conversation_turns( + query_param.conversation_history, query_param.history_turns + ) + sys_prompt_temp = PROMPTS["naive_rag_response"] sys_prompt = sys_prompt_temp.format( - content_data=section, response_type=query_param.response_type + content_data=section, response_type=query_param.response_type, history=history_context ) if query_param.only_need_prompt: