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 09b360012d54 camel-huggingface: the chat task reads
CamelChatClearHistory from a string literal, so it is documented nowhere
(#30049)
09b360012d54 is described below
commit 09b360012d549b8d046a6dd8fc59de63bfcab139
Author: dhairya05 <[email protected]>
AuthorDate: Mon Nov 16 01:41:06 2026 +0530
camel-huggingface: the chat task reads CamelChatClearHistory from a string
literal, so it is documented nowhere (#30049)
---
.../org/apache/camel/catalog/components/huggingface.json | 3 ++-
.../apache/camel/component/huggingface/huggingface.json | 3 ++-
.../camel/component/huggingface/HuggingFaceConstants.java | 7 +++++++
.../camel/component/huggingface/tasks/ChatPredictor.java | 5 +++--
.../endpoint/dsl/HuggingFaceEndpointBuilderFactory.java | 14 ++++++++++++++
5 files changed, 28 insertions(+), 4 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/huggingface.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/huggingface.json
index 3f85684258a4..1076d1add3a8 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/huggingface.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/huggingface.json
@@ -51,7 +51,8 @@
"oauthProfile": { "index": 24, "kind": "property", "displayName": "Oauth
Profile", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.huggingface.HuggingFaceConfiguration",
"configurationField": "configuration", "description": "OAuth profile name for
obtaining an access token via the OAuth 2.0 Client Credentials grant. [...]
},
"headers": {
- "CamelHuggingFaceOutput": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
output from the model", "constantName":
"org.apache.camel.component.huggingface.HuggingFaceConstants#OUTPUT" }
+ "CamelHuggingFaceOutput": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
output from the model", "constantName":
"org.apache.camel.component.huggingface.HuggingFaceConstants#OUTPUT" },
+ "CamelChatClearHistory": { "index": 1, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"Boolean", "deprecated": false, "autowired": false, "secret": false,
"description": "For the chat task, clears the stored conversation history of
the current memory id before the request is built. The memory id is read from
the header named by the memoryIdHeader option.", "constantName":
"org.apache.camel.component.huggingface.HuggingFac [...]
},
"bodyTypes": {
"producerIn": { "carriers": [ "text" ], "dependsOn": [ "predictorBean" ],
"byOption": [ { "option": "task", "value": "QUESTION_ANSWERING", "carriers": [
"pojo" ], "javaType": "ai.djl.modality.nlp.qa.QAInput" }, { "option": "task",
"value": "ZERO_SHOT_CLASSIFICATION", "carriers": [ "list" ] }, { "option":
"task", "value": "SENTENCE_EMBEDDINGS", "carriers": [ "text", "list" ] }, {
"option": "task", "value": "AUTOMATIC_SPEECH_RECOGNITION", "carriers": [ "pojo"
], "javaType": "ai.djl.mod [...]
diff --git
a/components/camel-ai/camel-huggingface/src/generated/resources/META-INF/org/apache/camel/component/huggingface/huggingface.json
b/components/camel-ai/camel-huggingface/src/generated/resources/META-INF/org/apache/camel/component/huggingface/huggingface.json
index 3f85684258a4..1076d1add3a8 100644
---
a/components/camel-ai/camel-huggingface/src/generated/resources/META-INF/org/apache/camel/component/huggingface/huggingface.json
+++
b/components/camel-ai/camel-huggingface/src/generated/resources/META-INF/org/apache/camel/component/huggingface/huggingface.json
@@ -51,7 +51,8 @@
"oauthProfile": { "index": 24, "kind": "property", "displayName": "Oauth
Profile", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.huggingface.HuggingFaceConfiguration",
"configurationField": "configuration", "description": "OAuth profile name for
obtaining an access token via the OAuth 2.0 Client Credentials grant. [...]
},
"headers": {
- "CamelHuggingFaceOutput": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
output from the model", "constantName":
"org.apache.camel.component.huggingface.HuggingFaceConstants#OUTPUT" }
+ "CamelHuggingFaceOutput": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
output from the model", "constantName":
"org.apache.camel.component.huggingface.HuggingFaceConstants#OUTPUT" },
+ "CamelChatClearHistory": { "index": 1, "kind": "header", "displayName":
"", "group": "producer", "label": "producer", "required": false, "javaType":
"Boolean", "deprecated": false, "autowired": false, "secret": false,
"description": "For the chat task, clears the stored conversation history of
the current memory id before the request is built. The memory id is read from
the header named by the memoryIdHeader option.", "constantName":
"org.apache.camel.component.huggingface.HuggingFac [...]
},
"bodyTypes": {
"producerIn": { "carriers": [ "text" ], "dependsOn": [ "predictorBean" ],
"byOption": [ { "option": "task", "value": "QUESTION_ANSWERING", "carriers": [
"pojo" ], "javaType": "ai.djl.modality.nlp.qa.QAInput" }, { "option": "task",
"value": "ZERO_SHOT_CLASSIFICATION", "carriers": [ "list" ] }, { "option":
"task", "value": "SENTENCE_EMBEDDINGS", "carriers": [ "text", "list" ] }, {
"option": "task", "value": "AUTOMATIC_SPEECH_RECOGNITION", "carriers": [ "pojo"
], "javaType": "ai.djl.mod [...]
diff --git
a/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceConstants.java
b/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceConstants.java
index 16cfb9c5920c..9326a1bf7522 100644
---
a/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceConstants.java
+++
b/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/HuggingFaceConstants.java
@@ -23,4 +23,11 @@ public interface HuggingFaceConstants {
@Metadata(description = "The output from the model", javaType = "String")
String OUTPUT = "CamelHuggingFaceOutput";
+ @Metadata(label = "producer",
+ description = "For the chat task, clears the stored conversation
history of the current memory id before"
+ + " the request is built. The memory id is read
from the header named by the"
+ + " memoryIdHeader option.",
+ javaType = "Boolean")
+ String CLEAR_HISTORY = "CamelChatClearHistory";
+
}
diff --git
a/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/tasks/ChatPredictor.java
b/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/tasks/ChatPredictor.java
index 3252ed5d711d..a37d1c15f26d 100644
---
a/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/tasks/ChatPredictor.java
+++
b/components/camel-ai/camel-huggingface/src/main/java/org/apache/camel/component/huggingface/tasks/ChatPredictor.java
@@ -70,7 +70,8 @@ import tools.jackson.databind.node.ArrayNode;
* <ul>
* <li>{@code CamelChatMemoryId} (optional, default "default"): String key for
conversation history (e.g., user session
* ID).</li>
- * <li>{@code CamelChatClearHistory} (optional): Boolean to clear the history
for the current memory ID.</li>
+ * <li>{@code HuggingFaceConstants.CLEAR_HISTORY} (optional): Boolean to clear
the history for the current memory
+ * ID.</li>
* <li>{@code HuggingFaceConstants.OUTPUT}: The same generated response string
(for convenience).</li>
* </ul>
*
@@ -174,7 +175,7 @@ public class ChatPredictor extends AbstractTaskPredictor {
String memoryId = memoryId(exchange);
// Clear if requested
- Boolean clear = exchange.getIn().getHeader("CamelChatClearHistory",
Boolean.class);
+ Boolean clear =
exchange.getIn().getHeader(HuggingFaceConstants.CLEAR_HISTORY, Boolean.class);
if (Boolean.TRUE.equals(clear)) {
chatHistories.remove(memoryId);
LOG.debug("Cleared chat history for ID: {}", memoryId);
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HuggingFaceEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HuggingFaceEndpointBuilderFactory.java
index d6ab0c22c62a..f21876899156 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HuggingFaceEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HuggingFaceEndpointBuilderFactory.java
@@ -673,6 +673,20 @@ public interface HuggingFaceEndpointBuilderFactory {
public String huggingFaceOutput() {
return "CamelHuggingFaceOutput";
}
+ /**
+ * For the chat task, clears the stored conversation history of the
+ * current memory id before the request is built. The memory id is read
+ * from the header named by the memoryIdHeader option.
+ *
+ * The option is a: {@code Boolean} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code ChatClearHistory}.
+ */
+ public String chatClearHistory() {
+ return "CamelChatClearHistory";
+ }
}
static HuggingFaceEndpointBuilder endpointBuilder(String componentName,
String path) {
class HuggingFaceEndpointBuilderImpl extends AbstractEndpointBuilder
implements HuggingFaceEndpointBuilder, AdvancedHuggingFaceEndpointBuilder {