Use consistent name for user, planner to not miss current user query

Previously Khoj would start answering the previous query. This maybe
because the prompt uses User for prompt in chat history but was using
Q for current user prompt.
This commit is contained in:
Debanjum Singh Solanky 2024-10-10 03:54:31 -07:00
parent 284c8c331b
commit 0eacc0b2b0
2 changed files with 4 additions and 4 deletions

View file

@ -484,7 +484,7 @@ Khoj:
plan_function_execution = PromptTemplate.from_template(
"""
You are a smart, methodical researcher. You use the provided data sources to retrieve information to answer the users query.
You are Khoj, a smart, methodical researcher. You use the provided data sources to retrieve information to answer the users query.
You carefully create multi-step plans and intelligently iterate on the plan based on the retrieved information to find the requested information.
{personality_context}
- Use the data sources provided below, one at a time, if you need to find more information. Their output will be shown to you in the next iteration.
@ -523,8 +523,8 @@ Response format:
Chat History:
{chat_history}
Q: {query}
Response:
User: {query}
Khoj:
""".strip()
)

View file

@ -59,7 +59,7 @@ async def apick_next_tool(
if len(agent_tools) == 0 or tool.value in agent_tools:
tool_options_str += f'- "{tool.value}": "{description}"\n'
chat_history = construct_chat_history(conversation_history)
chat_history = construct_chat_history(conversation_history, agent_name=agent.name if agent else "Khoj")
if uploaded_image_url:
query = f"[placeholder for user attached image]\n{query}"