Fix paragraphToContextualPrompt response post-processing;
This commit is contained in:
@@ -102,9 +102,13 @@ public class Text2Jsonl2WithContextualPrompts implements Consumer<String[]> {
|
|||||||
|
|
||||||
String prompt = completion.response();
|
String prompt = completion.response();
|
||||||
final int colon = prompt.indexOf(':');
|
final int colon = prompt.indexOf(':');
|
||||||
if (colon > -1 && colon > prompt.length() + 1) {
|
if (colon > -1 && colon < prompt.length() + 1) {
|
||||||
prompt = prompt.substring(colon + 1);
|
prompt = prompt.substring(colon + 1);
|
||||||
}
|
}
|
||||||
|
final int preamble = prompt.indexOf("\n\n");
|
||||||
|
if (preamble > -1 && preamble < prompt.length() + 2) {
|
||||||
|
prompt = prompt.substring(preamble + 2);
|
||||||
|
}
|
||||||
prompt = prompt.trim();
|
prompt = prompt.trim();
|
||||||
|
|
||||||
final var qaLine = new QaLine(prompt, paragraph);
|
final var qaLine = new QaLine(prompt, paragraph);
|
||||||
|
|||||||
Reference in New Issue
Block a user