From 5ef1ea906da69e11edc33052ab4b4bf4377bfbf7 Mon Sep 17 00:00:00 2001 From: Amith Koujalgi Date: Sat, 20 Sep 2025 17:48:21 +0530 Subject: [PATCH] Remove modelKeepAliveTime property and related code Eliminated the modelKeepAliveTime field from OllamaAPI and OllamaChatRequest, along with its usage in integration tests and configuration. This streamlines configuration and request handling by removing an unused or deprecated parameter. --- src/main/java/io/github/ollama4j/OllamaAPI.java | 4 ---- .../io/github/ollama4j/models/chat/OllamaChatRequest.java | 4 ---- .../ollama4j/integrationtests/OllamaAPIIntegrationTest.java | 3 --- .../unittests/jackson/TestChatRequestSerialization.java | 4 ++-- src/test/resources/test-config.properties | 3 +-- 5 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/main/java/io/github/ollama4j/OllamaAPI.java b/src/main/java/io/github/ollama4j/OllamaAPI.java index 985eaf06..beed9b48 100644 --- a/src/main/java/io/github/ollama4j/OllamaAPI.java +++ b/src/main/java/io/github/ollama4j/OllamaAPI.java @@ -92,10 +92,6 @@ public class OllamaAPI { @SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"}) private int numberOfRetriesForModelPull = 0; - @Setter - @SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"}) - private int modelKeepAliveTime = 0; - /** * Instantiates the Ollama API with default Ollama host: http://localhost:11434 diff --git a/src/main/java/io/github/ollama4j/models/chat/OllamaChatRequest.java b/src/main/java/io/github/ollama4j/models/chat/OllamaChatRequest.java index a208ecba..38ec0b3b 100644 --- a/src/main/java/io/github/ollama4j/models/chat/OllamaChatRequest.java +++ b/src/main/java/io/github/ollama4j/models/chat/OllamaChatRequest.java @@ -8,7 +8,6 @@ */ package io.github.ollama4j.models.chat; -import com.fasterxml.jackson.annotation.JsonProperty; import io.github.ollama4j.models.request.OllamaCommonRequest; import io.github.ollama4j.tools.Tools; import io.github.ollama4j.utils.OllamaRequestBody; @@ -33,9 +32,6 @@ public class OllamaChatRequest extends OllamaCommonRequest implements OllamaRequ private boolean think; - @JsonProperty("keep_alive") - private int modelKeepAliveTime; - /** * Controls whether tools are automatically executed. *

diff --git a/src/test/java/io/github/ollama4j/integrationtests/OllamaAPIIntegrationTest.java b/src/test/java/io/github/ollama4j/integrationtests/OllamaAPIIntegrationTest.java index 8eaf3fb9..e0d66b1d 100644 --- a/src/test/java/io/github/ollama4j/integrationtests/OllamaAPIIntegrationTest.java +++ b/src/test/java/io/github/ollama4j/integrationtests/OllamaAPIIntegrationTest.java @@ -71,7 +71,6 @@ class OllamaAPIIntegrationTest { // ... (no javadoc needed for private setup logic) int requestTimeoutSeconds = 60; int numberOfRetriesForModelPull = 5; - int modelKeepAliveTime = 0; try { String useExternalOllamaHostEnv = System.getenv("USE_EXTERNAL_OLLAMA_HOST"); @@ -99,7 +98,6 @@ class OllamaAPIIntegrationTest { Integer.parseInt(props.getProperty("REQUEST_TIMEOUT_SECONDS")); numberOfRetriesForModelPull = Integer.parseInt(props.getProperty("NUMBER_RETRIES_FOR_MODEL_PULL")); - modelKeepAliveTime = Integer.parseInt(props.getProperty("MODEL_KEEP_ALIVE_TIME")); } else { useExternalOllamaHost = Boolean.parseBoolean(useExternalOllamaHostEnv); ollamaHost = ollamaHostEnv; @@ -136,7 +134,6 @@ class OllamaAPIIntegrationTest { } api.setRequestTimeoutSeconds(requestTimeoutSeconds); api.setNumberOfRetriesForModelPull(numberOfRetriesForModelPull); - api.setModelKeepAliveTime(modelKeepAliveTime); } /** diff --git a/src/test/java/io/github/ollama4j/unittests/jackson/TestChatRequestSerialization.java b/src/test/java/io/github/ollama4j/unittests/jackson/TestChatRequestSerialization.java index e5330906..1b1ad9ad 100644 --- a/src/test/java/io/github/ollama4j/unittests/jackson/TestChatRequestSerialization.java +++ b/src/test/java/io/github/ollama4j/unittests/jackson/TestChatRequestSerialization.java @@ -146,7 +146,7 @@ public class TestChatRequestSerialization extends AbstractSerializationTest