feat(ollama): upgrade to 0.5.1 and improve code quality

- Upgrade Ollama version used for IT from 0.3.14 to 0.5.1
- Fix string comparison pattern in OllamaModelManager
- Re-enable stream function calling test
- Improve multimodal test assertions
This commit is contained in:
Christian Tzolov
2024-12-09 10:07:51 +01:00
parent a2d9ddd27a
commit 9f775ab2c2
7 changed files with 7 additions and 7 deletions

View File

@@ -117,7 +117,8 @@ public class OllamaModelManager {
logger.info("Pulling the '{}' model - Status: {}", modelName, progressResponses.get(progressResponses.size() - 1).status());
}
})
.takeUntil(progressResponses -> progressResponses.get(0) != null && progressResponses.get(0).status().equals("success"))
.takeUntil(progressResponses ->
progressResponses.get(0) != null && "success".equals(progressResponses.get(0).status()))
.timeout(this.options.timeout())
.retryWhen(Retry.backoff(this.options.maxRetries(), Duration.ofSeconds(5)))
.blockLast();

View File

@@ -79,7 +79,6 @@ class OllamaChatModelFunctionCallingIT extends BaseOllamaIT {
}
@Test
@Disabled("https://github.com/spring-projects/spring-ai/issues/1891")
void streamFunctionCallTest() {
UserMessage userMessage = new UserMessage(
"What are the weather conditions in San Francisco, Tokyo, and Paris? Find the temperature in Celsius for each of the three locations.");

View File

@@ -68,7 +68,7 @@ class OllamaChatModelMultimodalIT extends BaseOllamaIT {
var response = this.chatModel.call(new Prompt(List.of(userMessage)));
logger.info(response.getResult().getOutput().getContent());
assertThat(response.getResult().getOutput().getContent()).contains("bananas", "apple");
assertThat(response.getResult().getOutput().getContent()).containsAnyOf("bananas", "apple");
}
@SpringBootConfiguration

View File

@@ -23,7 +23,7 @@ import org.testcontainers.utility.DockerImageName;
*/
public final class OllamaImage {
public static final DockerImageName DEFAULT_IMAGE = DockerImageName.parse("ollama/ollama:0.3.14");
public static final DockerImageName DEFAULT_IMAGE = DockerImageName.parse("ollama/ollama:0.5.1");
private OllamaImage() {

View File

@@ -77,7 +77,7 @@ class OllamaWithOpenAiChatModelIT {
private static final String DEFAULT_OLLAMA_MODEL = "mistral";
@Container
static OllamaContainer ollamaContainer = new OllamaContainer("ollama/ollama:0.3.14");
static OllamaContainer ollamaContainer = new OllamaContainer("ollama/ollama:0.5.1");
static String baseUrl = "http://localhost:11434";

View File

@@ -18,7 +18,7 @@ package org.springframework.ai.autoconfigure.ollama;
public final class OllamaImage {
public static final String DEFAULT_IMAGE = "ollama/ollama:0.3.14";
public static final String DEFAULT_IMAGE = "ollama/ollama:0.5.1";
private OllamaImage() {

View File

@@ -23,7 +23,7 @@ import org.testcontainers.utility.DockerImageName;
*/
public final class OllamaImage {
public static final DockerImageName DEFAULT_IMAGE = DockerImageName.parse("ollama/ollama:0.3.14");
public static final DockerImageName DEFAULT_IMAGE = DockerImageName.parse("ollama/ollama:0.5.1");
private OllamaImage() {