query eval scaffolding
All checks were successful
studiorailgun/trpg/pipeline/head This commit looks good

This commit is contained in:
austin 2024-12-29 14:38:30 -05:00
parent 67360681c9
commit a48c21f1f5
13 changed files with 49 additions and 15 deletions

View File

@ -8,6 +8,8 @@ sitting in a tavern by a fireplace
Respond to "What color is your hat?" Respond to "What color is your hat?"
- determine sentence function
- determine what is being queried for

View File

@ -1 +1 @@
▄╘з▓┌кЪДЖЬ▄йЩ▄сЩлЖ╔в╔▓ИКЙG ▄шЁЗаБ÷Т╒(▀лЙ▀Рэ║Р 2 ╪МёКУ╘ТВэТН▒║Х∙╫√=╔в╔▓ИКЙG ▄шЁЗаБ÷Т╒(фБЕ╨≥┘юШ2

Binary file not shown.

View File

@ -2,3 +2,4 @@
1,0,0,0,"Hello" 1,0,0,0,"Hello"
1,0,0,0,"Hi" 1,0,0,0,"Hi"
1,0,0,0,"Howdy" 1,0,0,0,"Howdy"
0,0,1,0,"What color is your hat?"
1 utility transfer query imperative sentence
2 1 0 0 0 Hello
3 1 0 0 0 Hi
4 1 0 0 0 Howdy
5 0 0 1 0 What color is your hat?

View File

@ -2,3 +2,4 @@
1,0,0,0,"Hello" 1,0,0,0,"Hello"
1,0,0,0,"Hi" 1,0,0,0,"Hi"
1,0,0,0,"Howdy" 1,0,0,0,"Howdy"
0,0,1,0,"What color is your hat?"
1 utility transfer query imperative sentence
2 1 0 0 0 Hello
3 1 0 0 0 Hi
4 1 0 0 0 Howdy
5 0 0 1 0 What color is your hat?

View File

@ -27,6 +27,8 @@ public class AgentLoop {
try (Scanner scan = new Scanner(System.in)) { try (Scanner scan = new Scanner(System.in)) {
String prompt = ""; String prompt = "";
System.out.println("Agent is ready..");
//actual main loop //actual main loop
while(running){ while(running){

View File

@ -3,6 +3,7 @@ package org.studiorailgun.conversation.evaluators;
import org.studiorailgun.conversation.categorization.SentenceFunctionCategorizor; import org.studiorailgun.conversation.categorization.SentenceFunctionCategorizor;
import org.studiorailgun.conversation.evaluators.goal.GoalEval; import org.studiorailgun.conversation.evaluators.goal.GoalEval;
import org.studiorailgun.conversation.evaluators.greet.GreetingEval; import org.studiorailgun.conversation.evaluators.greet.GreetingEval;
import org.studiorailgun.conversation.evaluators.query.QueryEval;
import org.studiorailgun.conversation.evaluators.synthesis.ResponseEval; import org.studiorailgun.conversation.evaluators.synthesis.ResponseEval;
import org.studiorailgun.conversation.tracking.Conversation; import org.studiorailgun.conversation.tracking.Conversation;
import org.studiorailgun.conversation.tracking.Quote; import org.studiorailgun.conversation.tracking.Quote;
@ -25,9 +26,12 @@ public class EvaluationTree {
case UTILITY: { case UTILITY: {
GreetingEval.evaluate(conversation, quote); GreetingEval.evaluate(conversation, quote);
} break; } break;
default: { case QUERY: {
QueryEval.evaluate(conversation, quote);
} break; } break;
default: {
throw new UnsupportedOperationException("Unsupported quote function: " + quote.getFunction());
}
} }
//evaluate the AI's current goal in the conversation //evaluate the AI's current goal in the conversation

View File

@ -0,0 +1,20 @@
package org.studiorailgun.conversation.evaluators.query;
import org.studiorailgun.conversation.tracking.Conversation;
import org.studiorailgun.conversation.tracking.Quote;
/**
* Evaluates queries
*/
public class QueryEval {
/**
* Evaluates a quote
* @param conversation The conversation
* @param quote The quote
*/
public static void evaluate(Conversation conversation, Quote quote){
System.out.println("Is a query!");
}
}

View File

@ -19,7 +19,11 @@ public class ResponseEval {
switch(conversation.getGoalData().getGoal()){ switch(conversation.getGoalData().getGoal()){
case GREET: { case GREET: {
response = GreetingEval.constructGreeting(conversation); response = GreetingEval.constructGreeting(conversation);
conversation.getGreetingData().getHaveGreeted().add(conversation.getSelf());
} break; } break;
default: {
throw new UnsupportedOperationException("Unsupported conversation goal! " + conversation.getGoalData().getGoal());
}
} }
return response; return response;
} }

View File

@ -150,15 +150,15 @@ model.evaluate(npTestData,npTestLabel)
# predict # predict
predictTargetRaw: Tensor = tf.constant(['Hello']) # predictTargetRaw: Tensor = tf.constant(['Hello'])
npPredict: npt.NDArray = np.array(predictTargetRaw, dtype=object) # npPredict: npt.NDArray = np.array(predictTargetRaw, dtype=object)
print("Prediction test..") # print("Prediction test..")
result: list[int] = model.predict(predictTargetRaw) # result: list[int] = model.predict(predictTargetRaw)
print("predict result:") # print("predict result:")
print(predictTargetRaw) # print(predictTargetRaw)
print(result) # print(result)
print(train_data) # print(train_data)
print(train_labels) # print(train_labels)

View File

@ -18,7 +18,7 @@ public class GreetingTests {
ConvAI.simFrame("Hello"); ConvAI.simFrame("Hello");
assertEquals(Globals.conversation.getGreetingData().getHaveGreeted().size(), 1); assertNotEquals(Globals.conversation.getGreetingData().getHaveGreeted().size(), 0);
} }
@Test @Test