def test_empty_response_removal(): response_results = [ ResponseSelectionEvaluationResult(None, None, "What's the weather", 0.65432), ResponseSelectionEvaluationResult("chitchat/ask_name", "chitchat/ask_name", "What's your name?", 0.98765), # This happens if response selection test data is present but no response # selector is part of the model ResponseSelectionEvaluationResult("chitchat/ask_name", None, "What's your name?", None), ] response_results = remove_empty_response_examples(response_results) assert len(response_results) == 2 assert response_results[ 0].intent_response_key_target == "chitchat/ask_name" assert response_results[ 0].intent_response_key_prediction == "chitchat/ask_name" assert response_results[0].confidence == 0.98765 assert response_results[0].message == "What's your name?" assert response_results[ 1].intent_response_key_target == "chitchat/ask_name" assert response_results[1].intent_response_key_prediction == "" assert response_results[1].confidence == 0.0 assert response_results[1].message == "What's your name?"
def test_empty_response_removal(): response_results = [ ResponseSelectionEvaluationResult(None, None, "What's the weather", 0.65432), ResponseSelectionEvaluationResult( "chitchat/ask_name", "chitchat/ask_name", "What's your name?", 0.98765 ), ] response_results = remove_empty_response_examples(response_results) assert len(response_results) == 1 assert response_results[0].intent_response_key_target == "chitchat/ask_name" assert response_results[0].intent_response_key_prediction == "chitchat/ask_name" assert response_results[0].confidence == 0.98765 assert response_results[0].message == "What's your name?"
def test_empty_response_removal(): response_results = [ ResponseSelectionEvaluationResult("chitchat", None, "It's sunny in Berlin", "What's the weather", 0.65432), ResponseSelectionEvaluationResult( "chitchat", "My name is Mr.bot", "My name is Mr.bot", "What's your name?", 0.98765, ), ] response_results = remove_empty_response_examples(response_results) assert len(response_results) == 1 assert response_results[0].intent_target == "chitchat" assert response_results[0].response_target == "My name is Mr.bot" assert response_results[0].response_prediction == "My name is Mr.bot" assert response_results[0].confidence == 0.98765 assert response_results[0].message == "What's your name?"