This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 41b304db7e17 CAMEL-23947: Remove unwired langchain4j-chat model
builder helpers
41b304db7e17 is described below
commit 41b304db7e17ac35eb55f59b24c2888f5f403bd7
Author: Omar Atie <[email protected]>
AuthorDate: Sun Jul 19 23:45:37 2026 -0700
CAMEL-23947: Remove unwired langchain4j-chat model builder helpers
Remove OpenAiChatLanguageModelBuilder and HugginFaceChatLanguageModelBuilder
which were never wired into the component (chatModel is autowired directly)
and contained bugs. Document the removal in the 4.22 upgrade guide.
---
.../HugginFaceChatLanguageModelBuilder.java | 73 --------------------
.../openai/OpenAiChatLanguageModelBuilder.java | 80 ----------------------
.../ROOT/pages/camel-4x-upgrade-guide-4_22.adoc | 7 ++
3 files changed, 7 insertions(+), 153 deletions(-)
diff --git
a/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/huggingface/HugginFaceChatLanguageModelBuilder.java
b/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/huggingface/HugginFaceChatLanguageModelBuilder.java
deleted file mode 100644
index f5c883d63749..000000000000
---
a/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/huggingface/HugginFaceChatLanguageModelBuilder.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.langchain4j.chat.huggingface;
-
-import dev.langchain4j.model.huggingface.HuggingFaceLanguageModel;
-
-import static java.time.Duration.ofSeconds;
-
-public final class HugginFaceChatLanguageModelBuilder {
- private String accessToken;
- private String modelId;
- private boolean waitForModel;
- private int timeout;
-
- private int maxNewTokens;
-
- private double temperature;
-
- public HugginFaceChatLanguageModelBuilder accessToken(String accessToken) {
- this.accessToken = accessToken;
- return this;
- }
-
- public HugginFaceChatLanguageModelBuilder modelId(String modelId) {
- this.modelId = modelId;
- return this;
- }
-
- public HugginFaceChatLanguageModelBuilder timeout(int timeout) {
- this.timeout = timeout;
- return this;
- }
-
- public HugginFaceChatLanguageModelBuilder waitForModel(boolean
waitForModel) {
- this.waitForModel = waitForModel;
- return this;
- }
-
- public HugginFaceChatLanguageModelBuilder temperature(double temperature) {
- this.temperature = temperature;
- return this;
- }
-
- public HugginFaceChatLanguageModelBuilder maxNewTokens(int maxNewTokens) {
- this.maxNewTokens = maxNewTokens;
- return this;
- }
-
- public HuggingFaceLanguageModel build() {
- return HuggingFaceLanguageModel.builder()
- .accessToken(accessToken)
- .modelId(modelId)
- .waitForModel(waitForModel)
- .timeout(ofSeconds(timeout))
- .temperature(temperature)
- .maxNewTokens(maxNewTokens)
- .build();
- }
-}
diff --git
a/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/openai/OpenAiChatLanguageModelBuilder.java
b/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/openai/OpenAiChatLanguageModelBuilder.java
deleted file mode 100644
index a9483434258d..000000000000
---
a/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/openai/OpenAiChatLanguageModelBuilder.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.langchain4j.chat.openai;
-
-import dev.langchain4j.model.chat.ChatModel;
-import dev.langchain4j.model.openai.OpenAiChatModel;
-
-import static java.time.Duration.ofSeconds;
-
-public final class OpenAiChatLanguageModelBuilder {
- private String apiKey;
- private String modelName;
- private long timeout;
- private int maxRetries;
- private boolean logRequests;
- private boolean logResponses;
-
- private Double temperature;
-
- public OpenAiChatLanguageModelBuilder apiKey(String apiKey) {
- this.apiKey = apiKey;
- return this;
- }
-
- public OpenAiChatLanguageModelBuilder modelName(String modelName) {
- this.modelName = modelName;
- return this;
- }
-
- public OpenAiChatLanguageModelBuilder timeout(long timeout) {
- this.timeout = timeout;
- return this;
- }
-
- public OpenAiChatLanguageModelBuilder maxRetries(int maxRetries) {
- this.maxRetries = maxRetries;
- return this;
- }
-
- public OpenAiChatLanguageModelBuilder logRequests(boolean logRequests) {
- this.logRequests = logRequests;
- return this;
- }
-
- public OpenAiChatLanguageModelBuilder logResponses(boolean logResponses) {
- this.logResponses = logResponses;
- return this;
- }
-
- public OpenAiChatLanguageModelBuilder temperature(Double temperature) {
- this.temperature = temperature;
- return this;
- }
-
- public ChatModel build() {
- return OpenAiChatModel.builder()
- .apiKey(apiKey)
- .modelName(modelName)
- .timeout(ofSeconds(timeout))
- .maxRetries(maxRetries)
- .logRequests(logRequests)
- .logRequests(logResponses)
- .temperature(temperature)
- .build();
- }
-}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
index 6e30097124b9..1fb3f0dadfe7 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
@@ -177,6 +177,13 @@ String chat(AiAgentBody<?> aiAgentBody, ToolProvider
toolProvider);
Result<String> chat(AiAgentBody<?> aiAgentBody, ToolProvider toolProvider);
----
+=== camel-langchain4j-chat
+
+The helper classes `OpenAiChatLanguageModelBuilder` and
`HugginFaceChatLanguageModelBuilder` have been removed.
+They were not wired into the component; the `chatModel` is autowired instead.
+
+If you used these helpers directly, configure your `ChatModel` with
LangChain4j's own builders or Spring Boot starters
+and inject it into the component.
=== camel-openai
The `conversationMemory` feature on the `chat-completion` operation has two
behavior fixes: