From 14d2474ee97682e439875bfb1b8501b9b64bd988 Mon Sep 17 00:00:00 2001 From: Markus Klenke Date: Mon, 12 Feb 2024 21:35:43 +0000 Subject: [PATCH] Adds integrationtestcase for chat message with image content --- .../ollama4j/integrationtests/TestRealAPIs.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/io/github/amithkoujalgi/ollama4j/integrationtests/TestRealAPIs.java b/src/test/java/io/github/amithkoujalgi/ollama4j/integrationtests/TestRealAPIs.java index 284a52d..4680410 100644 --- a/src/test/java/io/github/amithkoujalgi/ollama4j/integrationtests/TestRealAPIs.java +++ b/src/test/java/io/github/amithkoujalgi/ollama4j/integrationtests/TestRealAPIs.java @@ -162,6 +162,22 @@ class TestRealAPIs { } } + @Test + @Order(3) + void testChatWithImage() { + testEndpointReachability(); + try { + OllamaChatRequestBuilder builder = OllamaChatRequestBuilder.getInstance(config.getImageModel()); + OllamaChatRequestModel requestModel = builder.withMessage(OllamaChatMessageRole.USER, "What's in the picture?",getImageFileFromClasspath("dog-on-a-boat.jpg")) + .build(); + + OllamaChatResult chatResult = ollamaAPI.chat(requestModel); + assertNotNull(chatResult); + } catch (IOException | OllamaBaseException | InterruptedException e) { + throw new RuntimeException(e); + } + } + @Test @Order(3) void testAskModelWithOptionsAndImageFiles() {