yangdx commited on
Commit
3cfa955
·
1 Parent(s): abe3725

Add conversation history to naive_query prompt

Browse files
Files changed (1) hide show
  1. lightrag/operate.py +8 -1
lightrag/operate.py CHANGED
@@ -1534,9 +1534,16 @@ async def naive_query(
1534
  if query_param.only_need_context:
1535
  return section
1536
 
 
 
 
 
 
 
 
1537
  sys_prompt_temp = PROMPTS["naive_rag_response"]
1538
  sys_prompt = sys_prompt_temp.format(
1539
- content_data=section, response_type=query_param.response_type
1540
  )
1541
 
1542
  if query_param.only_need_prompt:
 
1534
  if query_param.only_need_context:
1535
  return section
1536
 
1537
+ # Process conversation history
1538
+ history_context = ""
1539
+ if query_param.conversation_history:
1540
+ history_context = get_conversation_turns(
1541
+ query_param.conversation_history, query_param.history_turns
1542
+ )
1543
+
1544
  sys_prompt_temp = PROMPTS["naive_rag_response"]
1545
  sys_prompt = sys_prompt_temp.format(
1546
+ content_data=section, response_type=query_param.response_type, history=history_context
1547
  )
1548
 
1549
  if query_param.only_need_prompt: