Improve stream advisor processing

* Fixes an issue with advisor name resolution
* Streamlines repeating code
* Add a new advisor strategy for ON_FINISH_REASON streaming responses, which is used by the Q&A advisor
* Improve observable instrumentation by passing the parent observation to the advisor observation
This commit is contained in:
Christian Tzolov
2024-08-29 15:07:48 +02:00
committed by Mark Pollack
parent 37c34507cf
commit bf8dabfb11
12 changed files with 309 additions and 329 deletions

View File

@@ -471,16 +471,11 @@ public class ChatClientTest {
assertThat(response).isEqualTo("response");
assertThat(promptCaptor.getValue().getInstructions()).hasSize(2);
assertThat(promptCaptor.getValue().getInstructions()).hasSize(1);
Message systemMessage = promptCaptor.getValue().getInstructions().get(0);
assertThat(systemMessage.getContent()).isEqualTo("System prompt");
assertThat(systemMessage.getMessageType()).isEqualTo(MessageType.SYSTEM);
// Is this expected?
Message userMessage = promptCaptor.getValue().getInstructions().get(1);
assertThat(userMessage.getContent()).isEqualTo("");
assertThat(userMessage.getMessageType()).isEqualTo(MessageType.USER);
}
@Test