Extends chat with image integration test to use history

This commit is contained in:
Markus Klenke 2024-02-13 10:20:37 +00:00
parent b4eaf0cfb5
commit 9aff3ec5d9

View File

@ -166,7 +166,7 @@ class TestRealAPIs {
@Test @Test
@Order(3) @Order(3)
void testChatWithImageFromFile() { void testChatWithImageFromFileWithHistoryRecognition() {
testEndpointReachability(); testEndpointReachability();
try { try {
OllamaChatRequestBuilder builder = OllamaChatRequestBuilder builder =
@ -177,6 +177,19 @@ class TestRealAPIs {
OllamaChatResult chatResult = ollamaAPI.chat(requestModel); OllamaChatResult chatResult = ollamaAPI.chat(requestModel);
assertNotNull(chatResult); assertNotNull(chatResult);
assertNotNull(chatResult.getResponse());
builder.reset();
requestModel =
builder.withMessages(chatResult.getChatHistory())
.withMessage(OllamaChatMessageRole.USER, "What's the dogs breed?").build();
chatResult = ollamaAPI.chat(requestModel);
assertNotNull(chatResult);
assertNotNull(chatResult.getResponse());
} catch (IOException | OllamaBaseException | InterruptedException e) { } catch (IOException | OllamaBaseException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }