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

zbendhiba pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 82a8b9e726bd CAMEL-23695: Remove chatRequestTransformer workaround for 
structured output (#23906)
82a8b9e726bd is described below

commit 82a8b9e726bd922cd88f8fb5324459c1c4382686
Author: Zineb BENDHIBA <[email protected]>
AuthorDate: Wed Jun 10 14:22:42 2026 +0200

    CAMEL-23695: Remove chatRequestTransformer workaround for structured output 
(#23906)
---
 .../component/langchain4j/agent/api/AbstractAgent.java      | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git 
a/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/AbstractAgent.java
 
b/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/AbstractAgent.java
index 657fca943bb4..24ddd3c51887 100644
--- 
a/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/AbstractAgent.java
+++ 
b/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/AbstractAgent.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import dev.langchain4j.mcp.McpToolProvider;
-import dev.langchain4j.model.chat.request.ChatRequestParameters;
-import dev.langchain4j.model.chat.request.DefaultChatRequestParameters;
 import dev.langchain4j.model.chat.request.ResponseFormat;
 import dev.langchain4j.service.AiServices;
 import dev.langchain4j.service.tool.ToolProvider;
@@ -149,17 +147,8 @@ public abstract class AbstractAgent<S> implements Agent {
         }
 
         // Response Format (structured output / JSON schema)
-        // Temporary fix: see https://issues.apache.org/jira/browse/CAMEL-23695
         if (responseFormat != null) {
-            ResponseFormat format = responseFormat;
-            builder.chatRequestTransformer(req -> {
-                ChatRequestParameters existing = req.parameters();
-                ChatRequestParameters withFormat = existing != null
-                        ? existing.overrideWith(
-                                
DefaultChatRequestParameters.builder().responseFormat(format).build())
-                        : 
DefaultChatRequestParameters.builder().responseFormat(format).build();
-                return req.toBuilder().parameters(withFormat).build();
-            });
+            builder.chatRequestTransformer(chatRequest -> 
chatRequest.toBuilder().responseFormat(responseFormat).build());
         }
     }
 }

Reply via email to