This commit is contained in:
parent
c2ddc5818d
commit
524c37895b
@ -7,13 +7,7 @@ sitting in a tavern by a fireplace
|
||||
|
||||
|
||||
|
||||
Respond to "Hello" with "Hello. What is your name?"
|
||||
- Multiple sentences in synthesizer
|
||||
- Progressive goals while synthesizing (update goals after each synthesis)
|
||||
- Multiple sentences per quote
|
||||
- Move eval to being evaluation-per-sentence
|
||||
- "Small Talk" conversation goal
|
||||
- Bank of questions to ask in small talk evaluator
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -21,6 +21,11 @@ public class GoalData {
|
||||
* Answer a question
|
||||
*/
|
||||
ANSWER,
|
||||
|
||||
/**
|
||||
* Prompt a conversation-opening question
|
||||
*/
|
||||
OPENER,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -22,13 +22,19 @@ public class GoalEval {
|
||||
|
||||
//evaluate if goal should be to greet
|
||||
if(!greetingData.getHaveGreeted().contains(conversation.getSelf())){
|
||||
conversation.getGoalData().setGoal(ConversationGoal.GREET);
|
||||
goalData.setGoal(ConversationGoal.GREET);
|
||||
return;
|
||||
}
|
||||
|
||||
//evaluate if goal should be to answer a question
|
||||
if(queryData.getRecentQueries().size() > 0){
|
||||
conversation.getGoalData().setGoal(ConversationGoal.ANSWER);
|
||||
goalData.setGoal(ConversationGoal.ANSWER);
|
||||
return;
|
||||
}
|
||||
|
||||
//try to open a conversation with a question
|
||||
if(SmallTalkEval.shouldPursueSmalltalk(goalData)){
|
||||
goalData.setGoal(ConversationGoal.OPENER);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package org.studiorailgun.conversation.evaluators.goal;
|
||||
|
||||
import org.studiorailgun.conversation.evaluators.goal.GoalData.ConversationGoal;
|
||||
|
||||
/**
|
||||
* "Small talk" evaluation
|
||||
*/
|
||||
public class SmallTalkEval {
|
||||
|
||||
/**
|
||||
* Checks if the agent should try to produce conversation openers
|
||||
* @return true if should, false otherwise
|
||||
*/
|
||||
public static boolean shouldPursueSmalltalk(GoalData goalData){
|
||||
return goalData.getGoal() != ConversationGoal.OPENER;
|
||||
}
|
||||
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class GreetingEval {
|
||||
* @return The greeting
|
||||
*/
|
||||
public static Sentence constructGreeting(Conversation conversation){
|
||||
Sentence response = new Sentence("Hello");
|
||||
Sentence response = new Sentence("Hello.");
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package org.studiorailgun.conversation.evaluators.opener;
|
||||
|
||||
import org.studiorailgun.conversation.evaluators.goal.GoalData;
|
||||
import org.studiorailgun.conversation.tracking.Conversation;
|
||||
import org.studiorailgun.conversation.tracking.Sentence;
|
||||
|
||||
/**
|
||||
* Conversation opener synthesis evaluation
|
||||
*/
|
||||
public class OpenerSynthesis {
|
||||
|
||||
/**
|
||||
* Synthesizes a conversation opener question
|
||||
* @param conversation The conversation
|
||||
* @return The quote
|
||||
*/
|
||||
public static Sentence synthesize(Conversation conversation){
|
||||
Sentence response = null;
|
||||
GoalData goalData = conversation.getGoalData();
|
||||
switch(goalData.getGoal()){
|
||||
case OPENER: {
|
||||
response = new Sentence("What is your name?");
|
||||
} break;
|
||||
case ANSWER:
|
||||
case GREET: {
|
||||
throw new Error("Unsupported goal type for information transfer! " + goalData.getGoal());
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package org.studiorailgun.conversation.evaluators.synthesis;
|
||||
|
||||
import org.studiorailgun.conversation.evaluators.greet.GreetingEval;
|
||||
import org.studiorailgun.conversation.evaluators.opener.OpenerSynthesis;
|
||||
import org.studiorailgun.conversation.evaluators.transfer.TransferEval;
|
||||
import org.studiorailgun.conversation.tracking.Conversation;
|
||||
import org.studiorailgun.conversation.tracking.Sentence;
|
||||
@ -25,6 +26,9 @@ public class ResponseEval {
|
||||
case ANSWER: {
|
||||
response = TransferEval.synthesize(conversation);
|
||||
} break;
|
||||
case OPENER: {
|
||||
response = OpenerSynthesis.synthesize(conversation);
|
||||
} break;
|
||||
default: {
|
||||
throw new UnsupportedOperationException("Unsupported conversation goal! " + conversation.getGoalData().getGoal());
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ public class TransferEval {
|
||||
Sentence questionToAnswer = goalData.getQueryData().getRecentQueries().remove(0);
|
||||
response = AnswerSynthesis.evaluate(conversation, questionToAnswer.getParent(), questionToAnswer);
|
||||
} break;
|
||||
case OPENER:
|
||||
case GREET: {
|
||||
throw new Error("Unsupported goal type for information transfer! " + goalData.getGoal());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user