add new conversation goal type
All checks were successful
studiorailgun/trpg/pipeline/head This commit looks good

This commit is contained in:
austin 2024-12-31 19:55:52 -05:00
parent 16e8e666d4
commit ee73ebc3b3
5 changed files with 24 additions and 5 deletions

View File

@ -20,7 +20,12 @@ public class GoalData {
/** /**
* Answer a question * Answer a question
*/ */
ANSWER, TRANSMIT_INFO,
/**
* Queries for a piece of information
*/
QUERY_INFO,
/** /**
* Prompt a conversation-opening question * Prompt a conversation-opening question
@ -45,14 +50,26 @@ public class GoalData {
this.queryData = new QueryData(); this.queryData = new QueryData();
} }
/**
* Gets the current goal
* @return The goal
*/
public ConversationGoal getGoal() { public ConversationGoal getGoal() {
return goal; return goal;
} }
/**
* Sets the current goal
* @param goal The goal
*/
public void setGoal(ConversationGoal goal) { public void setGoal(ConversationGoal goal) {
this.goal = goal; this.goal = goal;
} }
/**
* Gets the query data
* @return The query data
*/
public QueryData getQueryData() { public QueryData getQueryData() {
return queryData; return queryData;
} }

View File

@ -28,7 +28,7 @@ public class GoalEval {
//evaluate if goal should be to answer a question //evaluate if goal should be to answer a question
if(queryData.getRecentQueries().size() > 0){ if(queryData.getRecentQueries().size() > 0){
goalData.setGoal(ConversationGoal.ANSWER); goalData.setGoal(ConversationGoal.TRANSMIT_INFO);
return; return;
} }

View File

@ -25,7 +25,8 @@ public class OpenerSynthesis {
throw new Error("Unhandled opener state"); throw new Error("Unhandled opener state");
} }
} break; } break;
case ANSWER: case QUERY_INFO:
case TRANSMIT_INFO:
case GREET: { case GREET: {
throw new Error("Unsupported goal type for information transfer! " + goalData.getGoal()); throw new Error("Unsupported goal type for information transfer! " + goalData.getGoal());
} }

View File

@ -23,7 +23,7 @@ public class ResponseEval {
response = GreetingEval.constructGreeting(conversation); response = GreetingEval.constructGreeting(conversation);
conversation.getGreetingData().getHaveGreeted().add(conversation.getSelf()); conversation.getGreetingData().getHaveGreeted().add(conversation.getSelf());
} break; } break;
case ANSWER: { case TRANSMIT_INFO: {
response = TransferSynthesis.synthesize(conversation); response = TransferSynthesis.synthesize(conversation);
} break; } break;
case OPENER: { case OPENER: {

View File

@ -19,10 +19,11 @@ public class TransferSynthesis {
Sentence response = null; Sentence response = null;
GoalData goalData = conversation.getGoalData(); GoalData goalData = conversation.getGoalData();
switch(goalData.getGoal()){ switch(goalData.getGoal()){
case ANSWER: { case TRANSMIT_INFO: {
Sentence questionToAnswer = goalData.getQueryData().getRecentQueries().remove(0); Sentence questionToAnswer = goalData.getQueryData().getRecentQueries().remove(0);
response = AnswerSynthesis.evaluate(conversation, questionToAnswer.getParent(), questionToAnswer); response = AnswerSynthesis.evaluate(conversation, questionToAnswer.getParent(), questionToAnswer);
} break; } break;
case QUERY_INFO:
case OPENER: case OPENER:
case GREET: { case GREET: {
throw new Error("Unsupported goal type for information transfer! " + goalData.getGoal()); throw new Error("Unsupported goal type for information transfer! " + goalData.getGoal());