This is an automated email from the ASF dual-hosted git repository.

sxnan pushed a commit to branch release-0.1
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/release-0.1 by this push:
     new fcaf14e  [hotfix] Fix ollama4j can't deserialize tool call message 
from Ollama v0.12.10 and above. (#333)
fcaf14e is described below

commit fcaf14e5823dd2af076b2c6f8cc3a68b71209a33
Author: Wenjin Xie <[email protected]>
AuthorDate: Fri Nov 21 09:55:06 2025 +0800

    [hotfix] Fix ollama4j can't deserialize tool call message from Ollama 
v0.12.10 and above. (#333)
---
 .../integrations/chatmodels/ollama/OllamaChatModelConnection.java      | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/integrations/chat-models/ollama/src/main/java/org/apache/flink/agents/integrations/chatmodels/ollama/OllamaChatModelConnection.java
 
b/integrations/chat-models/ollama/src/main/java/org/apache/flink/agents/integrations/chatmodels/ollama/OllamaChatModelConnection.java
index 72b291c..02a78d1 100644
--- 
a/integrations/chat-models/ollama/src/main/java/org/apache/flink/agents/integrations/chatmodels/ollama/OllamaChatModelConnection.java
+++ 
b/integrations/chat-models/ollama/src/main/java/org/apache/flink/agents/integrations/chatmodels/ollama/OllamaChatModelConnection.java
@@ -19,6 +19,7 @@
 package org.apache.flink.agents.integrations.chatmodels.ollama;
 
 import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import io.github.ollama4j.OllamaAPI;
 import io.github.ollama4j.exceptions.RoleNotFoundException;
@@ -26,6 +27,7 @@ import io.github.ollama4j.models.chat.OllamaChatMessage;
 import io.github.ollama4j.models.chat.OllamaChatMessageRole;
 import io.github.ollama4j.models.chat.OllamaChatResult;
 import io.github.ollama4j.tools.Tools;
+import io.github.ollama4j.utils.Utils;
 import org.apache.flink.agents.api.chat.messages.ChatMessage;
 import org.apache.flink.agents.api.chat.messages.MessageRole;
 import org.apache.flink.agents.api.chat.model.BaseChatModelConnection;
@@ -79,6 +81,7 @@ public class OllamaChatModelConnection extends 
BaseChatModelConnection {
     public OllamaChatModelConnection(
             ResourceDescriptor descriptor, BiFunction<String, ResourceType, 
Resource> getResource) {
         super(descriptor, getResource);
+        
Utils.getObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         String endpoint = descriptor.getArgument("endpoint");
         if (endpoint == null || endpoint.isEmpty()) {
             throw new IllegalArgumentException("endpoint should not be null or 
empty.");

Reply via email to