mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Make Khoj ask clarifying questions when answer not in provided context
Previously it would just refuse ask for clarification. This improves the chat quality score for the existing director tests
This commit is contained in:
parent
75c1016ec0
commit
edffbad837
2 changed files with 8 additions and 7 deletions
|
@ -4,7 +4,7 @@ from langchain.prompts import PromptTemplate
|
|||
|
||||
## Personality
|
||||
## --
|
||||
personality = PromptTemplate.from_template("You are Khoj, a friendly, smart and helpful personal assistant.")
|
||||
personality = PromptTemplate.from_template("You are Khoj, a smart, inquisitive and helpful personal assistant.")
|
||||
|
||||
|
||||
## General Conversation
|
||||
|
@ -77,7 +77,9 @@ conversation_llamav2 = PromptTemplate.from_template(
|
|||
## --
|
||||
notes_conversation = PromptTemplate.from_template(
|
||||
"""
|
||||
Using the notes and our past conversations as context, answer the following question.
|
||||
Using my personal notes and our past conversations as context, answer the following question.
|
||||
Ask crisp follow-up questions to get additional context, when the answer cannot be inferred from the provided notes or past conversations.
|
||||
These questions should end with a question mark.
|
||||
Current Date: {current_date}
|
||||
|
||||
Notes:
|
||||
|
|
|
@ -280,7 +280,6 @@ def test_answer_general_question_not_in_chat_history_or_retrieved_content(chat_c
|
|||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
@pytest.mark.xfail(reason="Chat director not consistently capable of asking for clarification yet.")
|
||||
@pytest.mark.chatquality
|
||||
def test_ask_for_clarification_if_not_enough_context_in_question(chat_client):
|
||||
# Act
|
||||
|
@ -289,10 +288,10 @@ def test_ask_for_clarification_if_not_enough_context_in_question(chat_client):
|
|||
|
||||
# Assert
|
||||
expected_responses = [
|
||||
"which of them is the older",
|
||||
"which one is older",
|
||||
"which of them is older",
|
||||
"which one is the older",
|
||||
"which of them",
|
||||
"which one is",
|
||||
"which of namita's sons",
|
||||
"the birth order",
|
||||
]
|
||||
assert response.status_code == 200
|
||||
assert any([expected_response in response_message.lower() for expected_response in expected_responses]), (
|
||||
|
|
Loading…
Reference in a new issue