gnodet-bot commented on code in PR #26718:
URL: https://github.com/apache/camel/pull/26718#discussion_r4068305567


##########
test-infra/camel-test-infra-ollama/src/main/java/org/apache/camel/test/infra/ollama/services/OllamaLocalContainerInfraService.java:
##########
@@ -165,27 +166,44 @@ public void initialize() {
         LOG.info("Trying to start the Ollama container");
         container.start();
 
-        LOG.info("Pulling the model {}", getModel());
-        try {
-            container.execInContainer("ollama", "pull", getModel());
-        } catch (IOException | InterruptedException e) {
-            throw new RuntimeException(e);
-        }
+        pullModel(getModel());
 
         String embeddingModel = embeddingModelName();
         if (embeddingModel != null && !embeddingModel.isEmpty()) {
-            LOG.info("Pulling the embedding model {}", embeddingModel);
-            try {
-                container.execInContainer("ollama", "pull", embeddingModel);
-            } catch (IOException | InterruptedException e) {
-                throw new RuntimeException(e);
-            }
+            pullModel(embeddingModel);
         }
 
         registerProperties();
         LOG.info("Ollama instance running at {}", getEndpoint());
     }
 
+    private void pullModel(String model) {
+        LOG.info("Pulling the model {}", model);

Review Comment:
   💡 **Nit — log message unification loses context**
   
   The original code had two distinct messages: `"Pulling the model {}"` for 
the primary model and `"Pulling the embedding model {}"` for the embedding 
model. After the refactoring both calls go through `pullModel()` and log the 
same message, so operators reading logs can no longer distinguish which pull 
failed when only the second one fails.
   
   The fix is simple — thread the context through or check whether the caller 
was the embedding path:
   
   ```suggestion
           LOG.info("Pulling the {} model {}", "primary", model);
   ```
   
   Or accept a label:
   ```java
   private void pullModel(String model, String kind) {
       LOG.info("Pulling the {} model {}", kind, model);
       ...
   }
   // callers:
   pullModel(getModel(), "primary");
   pullModel(embeddingModel, "embedding");
   ```
   
   The single-line suggestion above is a minimal inline fix; the two-argument 
overload is cleaner if you prefer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to