Add test for #1317

add integration test for https://github.com/spring-projects/spring-ai/pull/1317
This commit is contained in:
Christian Tzolov
2024-09-10 11:23:17 +02:00
parent 26c5674acb
commit b5c7975fac

View File

@@ -69,6 +69,19 @@ class VertexAiGeminiChatModelIT {
assertThat(response.getResult().getOutput().getContent()).containsAnyOf("Blackbeard", "Bartholomew");
}
@Test
void testMessageHistory() {
Prompt prompt = createPrompt(VertexAiGeminiChatOptions.builder().build());
ChatResponse response = chatModel.call(prompt);
assertThat(response.getResult().getOutput().getContent()).containsAnyOf("Blackbeard", "Bartholomew");
var promptWithMessageHistory = new Prompt(List.of(prompt.getInstructions().get(0),
response.getResult().getOutput(), new UserMessage("What was the answer from the previous question?")));
response = chatModel.call(promptWithMessageHistory);
assertThat(response.getResult().getOutput().getContent()).containsAnyOf("Blackbeard", "Bartholomew");
}
@Test
void googleSearchTool() {
Prompt prompt = createPrompt(VertexAiGeminiChatOptions.builder().withGoogleSearchRetrieval(true).build());