Add user_prompt the QueryParam

This commit is contained in:
yangdx
2025-05-08 03:38:47 +08:00
parent 08e532eaf3
commit ae1c9f8d10
3 changed files with 22 additions and 2 deletions

View File

@@ -925,11 +925,14 @@ async def kg_query(
query_param.conversation_history, query_param.history_turns
)
# Build system prompt
user_prompt = query_param.user_prompt if query_param.user_prompt else PROMPTS["DEFAULT_USER_PROMPT"]
sys_prompt_temp = system_prompt if system_prompt else PROMPTS["rag_response"]
sys_prompt = sys_prompt_temp.format(
context_data=context,
response_type=query_param.response_type,
history=history_context,
user_prompt=user_prompt,
)
if query_param.only_need_prompt:
@@ -1907,11 +1910,14 @@ async def naive_query(
query_param.conversation_history, query_param.history_turns
)
# Build system prompt
user_prompt = query_param.user_prompt if query_param.user_prompt else PROMPTS["DEFAULT_USER_PROMPT"]
sys_prompt_temp = system_prompt if system_prompt else PROMPTS["naive_rag_response"]
sys_prompt = sys_prompt_temp.format(
content_data=text_units_str,
response_type=query_param.response_type,
history=history_context,
user_prompt=user_prompt,
)
if query_param.only_need_prompt:
@@ -1957,6 +1963,7 @@ async def naive_query(
return response
# TODO: Deprecated, use user_prompt in QueryParam instead
async def kg_query_with_keywords(
query: str,
knowledge_graph_inst: BaseGraphStorage,
@@ -2079,6 +2086,7 @@ async def kg_query_with_keywords(
return response
# TODO: Deprecated, use user_prompt in QueryParam instead
async def query_with_keywords(
query: str,
prompt: str,