diff --git a/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallbackWrapper.java b/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallbackWrapper.java index dbf28dd8b..d065a5fe4 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallbackWrapper.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallbackWrapper.java @@ -19,6 +19,8 @@ import java.util.function.Function; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.springframework.ai.model.ModelOptionsUtils; import org.springframework.util.Assert; @@ -35,9 +37,8 @@ public class FunctionCallbackWrapper extends AbstractFunctionCallback function; private FunctionCallbackWrapper(String name, String description, String inputTypeSchema, Class inputType, - Function responseConverter, Function function) { - super(name, description, inputTypeSchema, inputType, responseConverter, - new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)); + Function responseConverter, ObjectMapper objectMapper, Function function) { + super(name, description, inputTypeSchema, inputType, responseConverter, objectMapper); Assert.notNull(function, "Function must not be null"); this.function = function; } @@ -85,7 +86,9 @@ public class FunctionCallbackWrapper extends AbstractFunctionCallback withName(String name) { Assert.hasText(name, "Name must not be empty"); @@ -133,7 +136,6 @@ public class FunctionCallbackWrapper extends AbstractFunctionCallback extends AbstractFunctionCallback(this.name, this.description, this.inputTypeSchema, this.inputType, - this.responseConverter, this.function); + this.responseConverter, this.objectMapper, this.function); } }