Improve context formatting in QuestionAnswerAdvisor

- Add line breaks and clarify context boundaries in user text advice.
   This improve the performance of a Llama3.x
 - Update corresponding test to reflect new formatting
This commit is contained in:
Christian Tzolov
2024-10-10 14:39:50 +02:00
parent 4c83fe8302
commit 0c5455e4cd
2 changed files with 7 additions and 2 deletions

View File

@@ -52,10 +52,13 @@ import reactor.core.scheduler.Schedulers;
public class QuestionAnswerAdvisor implements CallAroundAdvisor, StreamAroundAdvisor {
private static final String DEFAULT_USER_TEXT_ADVISE = """
Context information is below.
Context information is below, surrounded by ---------------------
---------------------
{question_answer_context}
---------------------
Given the context and provided history information and not prior knowledge,
reply to the user comment. If the answer is not in the context, inform
the user that you can't answer the question.

View File

@@ -97,11 +97,13 @@ public class QuestionAnswerAdvisorTests {
assertThat(userMessage.getContent()).isEqualToIgnoringWhitespace("""
Please answer my question XYZ
Context information is below.
Context information is below, surrounded by ---------------------
---------------------
doc1
doc2
---------------------
Given the context and provided history information and not prior knowledge,
reply to the user comment. If the answer is not in the context, inform
the user that you can't answer the question.