Skip to content

CAMEL-24540: camel-huggingface - honour model revision for sentence-embeddings/text-to-image and set the text-to-image OUTPUT header - #25933

Merged
Croway merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-24540
Aug 31, 2026
Merged

Conversation

@oscerd

@oscerd oscerd commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Issue

CAMEL-24540

Two small correctness gaps in the Hugging Face task predictors, both incomplete ports of the pattern
the other predictors follow.

1. Model revision ignored for two tasks

SentenceEmbeddingsPredictor and TextToImagePredictor did not pass config.getRevision() into their
generated Python script, so pinning a model revision/branch silently had no effect for these two tasks
(the other eight pass it). The revision is now threaded into:

  • sentence_embeddings.pySentenceTransformer(model, device=..., revision=...)
  • text_to_image.pyStableDiffusionPipeline.from_pretrained(model, revision=..., ...)

2. Text-to-image never set the OUTPUT header

TextToImagePredictor.processOutput set the image bytes as the message body but never set the
OUTPUT header, even though its Javadoc documents that header. It now sets
HuggingFaceConstants.OUTPUT to the image bytes alongside the body.

Testing

  • New RevisionAndOutputHeaderTest asserts both scripts pin the configured revision and that
    text-to-image publishes the image on the OUTPUT header.
  • mvn -Psourcecheck validate green.

Claude Code on behalf of oscerd

@oscerd oscerd added the bug Something isn't working label Aug 31, 2026
@oscerd oscerd added this to the 4.23.0 milestone Aug 31, 2026
@oscerd
oscerd requested review from Croway and davsclaus August 31, 2026 07:51
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

…ce-embeddings and text-to-image, and set the text-to-image OUTPUT header

Two small correctness gaps in the task predictors:

- The configured model revision was dropped by SentenceEmbeddingsPredictor and
  TextToImagePredictor; the other eight tasks pass config.getRevision() into their
  Python script, so pinning a revision silently had no effect for these two. Pass
  the revision into sentence_embeddings.py (SentenceTransformer) and
  text_to_image.py (StableDiffusionPipeline.from_pretrained).

- TextToImagePredictor set the image bytes as the body but never set the OUTPUT
  header, although its Javadoc documents it. Set HuggingFaceConstants.OUTPUT to the
  image bytes alongside the body.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-ai/camel-huggingface

🔬 Scalpel shadow comparison — Scalpel: 9 tested, 27 compile-only — current: 9 all tested

Maveniverse Scalpel detected 36 affected modules (current approach: 9).

⚠️ Modules only in Scalpel (27)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 9 modules (1 direct + 8 downstream), skip tests for 27 (generated code, meta-modules)

Modules Scalpel would test (9)
  • camel-huggingface
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (27)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (36 modules)
  • Camel :: AI :: Hugging Face
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@Croway
Croway merged commit 674c0e0 into apache:main Aug 31, 2026
5 checks passed

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, correct bug fix that adds the missing config.getRevision() parameter to the only two predictors that omitted it (SentenceEmbeddingsPredictor and TextToImagePredictor), and adds the missing OUTPUT header to TextToImagePredictor, bringing both in line with the other eight predictors.

Verified:

  • %s placeholder ordering in both Python scripts matches the Java argument order
  • The revision field defaults to "main" (never null), so the Python substitution is safe
  • The OUTPUT header addition is consistent with all other 9 predictors

🔀 Backport Status

⚠️ The camel-huggingface component was introduced in 4.19.0 and this bug has existed since inception. Consider backporting to camel-4.22.x (component does not exist in camel-4.18.x).

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working components components-ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants