Update Chat Actor test to not incept with prior world knowledge

This commit is contained in:
Debanjum Singh Solanky 2023-10-15 17:22:44 -07:00
parent df1d74a879
commit 1a9023d396

View file

@ -145,7 +145,7 @@ def test_extract_multiple_implicit_questions_from_message(loaded_model):
def test_generate_search_query_using_question_from_chat_history(loaded_model): def test_generate_search_query_using_question_from_chat_history(loaded_model):
# Arrange # Arrange
message_list = [ message_list = [
("What is the name of Mr. Vader's daughter?", "Princess Leia", []), ("What is the name of Mr. Anderson's daughter?", "Miss Barbara", []),
] ]
# Act # Act
@ -156,17 +156,22 @@ def test_generate_search_query_using_question_from_chat_history(loaded_model):
use_history=True, use_history=True,
) )
expected_responses = [ all_expected_in_response = [
"Vader", "Anderson",
"sons", ]
any_expected_in_response = [
"son", "son",
"Darth", "sons",
"children", "children",
] ]
# Assert # Assert
assert len(response) >= 1 assert len(response) >= 1
assert any([expected_response in response[0] for expected_response in expected_responses]), ( assert all([expected_response in response[0] for expected_response in all_expected_in_response]), (
"Expected chat actor to ask for clarification in response, but got: " + response[0]
)
assert any([expected_response in response[0] for expected_response in any_expected_in_response]), (
"Expected chat actor to ask for clarification in response, but got: " + response[0] "Expected chat actor to ask for clarification in response, but got: " + response[0]
) )
@ -176,20 +181,20 @@ def test_generate_search_query_using_question_from_chat_history(loaded_model):
def test_generate_search_query_using_answer_from_chat_history(loaded_model): def test_generate_search_query_using_answer_from_chat_history(loaded_model):
# Arrange # Arrange
message_list = [ message_list = [
("What is the name of Mr. Vader's daughter?", "Princess Leia", []), ("What is the name of Mr. Anderson's daughter?", "Miss Barbara", []),
] ]
# Act # Act
response = extract_questions_offline( response = extract_questions_offline(
"Is she a Jedi?", "Is she a Doctor?",
conversation_log=populate_chat_history(message_list), conversation_log=populate_chat_history(message_list),
loaded_model=loaded_model, loaded_model=loaded_model,
use_history=True, use_history=True,
) )
expected_responses = [ expected_responses = [
"Leia", "Barbara",
"Vader", "Robert",
"daughter", "daughter",
] ]