CAMEL-24566: Auto-discover GenAI dependencies in Camel CLI - #26055
Conversation
Add GenAiDependencyDiscovery to scan route URIs and LangChain4j provider classes for camel-jbang run, export, dependency list and dependency update. - Add camel:ai-observability when GenAI routes are detected (unless disabled) - Add LangChain4j provider JAR mappings to known-dependencies.properties - Integrate discovery into Run and ExportBaseCommand.resolveDependencies Co-authored-by: Cursor Agent <cursoragent@cursor.com>
- Make ai-observability opt-in via --observe or camel.aiObservability.enabled=true - Load LangChain4j provider mappings from known-dependencies (package keys) - Scope URI extraction by file type and ignore YAML comments/false positives - Fix settings file scanning for export dependency resolution Co-authored-by: Cursor Agent <cursoragent@cursor.com>
aedcb7f to
023e9c6
Compare
davsclaus
left a comment
There was a problem hiding this comment.
No we should not scan the code, we need to find another way that is more similar to what we already do
…ncy resolution Remove GenAiDependencyDiscovery regex scanning of YAML/XML/Java routes. GenAI components and LangChain4j providers are resolved through the existing silent-run download pipeline (DependencyDownloaderComponentResolver and KnownDependenciesResolver), matching OpenTelemetry and LRA handling. - Add GenAiDependencyHelper to conditionally add camel:ai-observability from settings/profile when GenAI artifacts are already present - Map GenAiObservabilityImpl in camel-main-known-dependencies.properties - Replace unit tests with GenAiDependencyHelperTest Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed review feedback in New approach (aligned with existing JBang patterns):
Removed Cursor Agent on behalf of atiaomar1978-hub |
atiaomar1978-hub
left a comment
There was a problem hiding this comment.
Thanks @davsclaus — agreed, route source scanning is removed in 04413ce. GenAI dependencies now use the same silent-run + catalog + known-deps pipeline as other components. Only camel-ai-observability uses a small settings helper (OpenTelemetry/LRA style).
Cursor Agent on behalf of atiaomar1978-hub
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
✅ Generated files are up to dateAn earlier CI run reported uncommitted generated changes; the latest run no longer does. |
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 8 tested, 8 compile-only — current: 6 all testedMaveniverse Scalpel detected 16 affected modules (current approach: 6).
|
gnodet
left a comment
There was a problem hiding this comment.
Reviewed the current diff (after the 04413ce rework that removed route source scanning). The approach now correctly relies on the existing silent-run + catalog + KnownDependenciesResolver pipeline for GenAI components/providers, with GenAiDependencyHelper only handling the camel-ai-observability opt-in — consistent with how OpenTelemetry and LRA are handled. A few observations below.
This review was generated by an AI agent, Hermès, on behalf of @gnodet.
Use catalog modelFromMavenGAV for mvn: GenAI detection instead of artifact-id heuristics, exclude camel-ai-observability from triggering duplicate observability deps, narrow AI_OBSERVABILITY_ENABLED visibility, and document camel.aiObservability known-deps entry. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed all @gnodet review comments in
All 9 Cursor Agent on behalf of atiaomar1978-hub |
Summary
Auto-generated by Cursor Agent on behalf of atiaomar1978-hub
Implements CAMEL-24566: Camel JBang auto-discovers GenAI-related dependencies when running or exporting routes.
Approach
GenAI component and LangChain4j provider JARs are resolved by the existing silent-run pipeline (
DependencyDownloaderComponentResolver,KnownDependenciesResolver) — not by scanning route source.GenAiDependencyHelperonly adds optionalcamel:ai-observabilityusing the same settings-driven approach as OpenTelemetry and LRA.Changes
GenAiDependencyHelper— addscamel:ai-observabilitywhen GenAI artifacts are already in the dependency set and--observeorcamel.aiObservability.enabled=trueRun.java/ExportBaseCommand— call helper after silent-run dependency resolutioncamel-main-known-dependencies.properties— LangChain4j provider mappings +GenAiObservabilityImpl/camel.aiObservabilityentries for runtime downloadBehavior
camel:<scheme>mvn:dev.langchain4j:langchain4j-*:…--observeorcamel.aiObservability.enabled=truecamel:ai-observability(catalog ≥ 4.23)camel.aiObservability.enabled=falseopts out. Observability is not added without--observeor an explicit property.Review fixes (054c4fd)
mvn:GenAI detection — usesCamelCatalog.modelFromMavenGAV()+ catalogailabel instead of artifact-id string heuristicscamel-ai-observabilityexclusion — explicit observability dep no longer counts as a GenAI route dependency or gets duplicated inRun.java'sArrayListAI_OBSERVABILITY_ENABLED— narrowed to package-privatecamel.aiObservabilityknown-deps entry — documented (same pattern ascamel.opentelemetry)DefaultCamelCataloginstead of Mockito; duplicate-guard coverage addedTests
GenAiDependencyHelperTest— 9 unit testsExportTest.shouldExportGenAiRouteWithObservability— export integration with--observeRelated