Deprecated Client#completion and removed redundant question parameter

This commit is contained in:
extio-de
2025-06-27 17:35:48 +02:00
parent 5b5f56fa15
commit bef3ef1468
9 changed files with 29 additions and 86 deletions

View File

@@ -3,17 +3,21 @@ package de.extio.lmlib.grader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.extio.lmlib.client.Client;
import de.extio.lmlib.client.ClientService;
import de.extio.lmlib.profile.ModelCategory;
public class Grader {
private static final Logger LOGGER = LoggerFactory.getLogger(Grader.class);
private static final Logger LOGGER = LoggerFactory.getLogger(Grader.class);
public static boolean assessScoreBinary(final String question, final String text, final ClientService clientService) {
LOGGER.info(question);
final var client = clientService.getClient(ModelCategory.MEDIUM);
return assessScoreBinary(question, text, client);
}
public static boolean assessScoreBinary(final String question, final String text, final Client client) {
LOGGER.info(question);
var score = 0;
while (Math.abs(score) < 3) {
@@ -24,8 +28,8 @@ public class Grader {
Please provide a binary response 'true' or 'false' for the following text.
'true' means that the text provides a truthful answer to the question, while 'false' means that it does not.
Only provide the response as a single word and no preamble and no explanation.""",
"Here is the text:\n" + text,
"\nHere is the user question: " + question);
"Here is the text:\n" + text + "\n\n" +
"Here is the user question: " + question);
LOGGER.info(completion.response());
score += Boolean.parseBoolean(completion.response().strip()) ? 1 : -1;
if (Math.abs(score) == 2) {