This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 8b9a2917 Fix CI: map Beverage.kind field in BeerMapper and update
semantic-agent-routing for Camel 4.24 (#305)
8b9a2917 is described below
commit 8b9a2917a3bcebbe0acb4c32c3e4af754d40c1f9
Author: Guillaume Nodet <[email protected]>
AuthorDate: Sat Nov 14 01:09:41 2026 +0100
Fix CI: map Beverage.kind field in BeerMapper and update
semantic-agent-routing for Camel 4.24 (#305)
* Fix CI: map Beverage.kind field in BeerMapper
MapStruct treats unmapped target properties as errors (not warnings)
when the annotation processor detects them. The Beverage model has a
'kind' field (generated from beverage.json via jsonschema2pojo) that
was left unmapped in BeerMapper, causing the main build CI to fail.
Add @Mapping(target = "kind", constant = "beer") since the beverage.json
already hard-codes kind="beer" for this Beer-to-Beverage mapping.
* Fix CI: update semantic YAML syntax from 'question' to 'evaluation'
The semantic YAML DSL syntax changed during Camel 4.23 development:
'question:' was renamed to 'evaluation:'. The SemanticDefinitionDeserializer
only accepts 'evaluation', 'state', and 'audit' as top-level keys in a
semantic block; 'question' throws 'Unknown property' at startup.
Update coordinator.yaml in the semantic-agent-routing example to use
the current 'evaluation:' key.
* Fix CI: update semantic-agent-routing for Camel 4.24 semantic API changes
Three changes required by the camel-semantic API update in 4.24:
1. pom.xml: replace camel-typesafe-ai with camel-semantic-typesafe-ai
The TypeSafe AI semantic adapter was split into a dedicated artifact
(camel-semantic-typesafe-ai) in 4.24. The old camel-typesafe-ai no
longer includes SemanticAdapter support.
2. application.properties: register the TypeSafe AI semantic adapter bean
The adapter must be explicitly registered in the Camel registry as
'decisions' via camel.beans.decisions for the expert reference in YAML
evaluations to resolve at startup.
3. coordinator.yaml: update semantic evaluation syntax for 4.24
- Rename 'question:' to 'evaluation:' (syntax renamed during 4.23 dev)
- Add 'expert: decisions' to all six evaluations (now required)
Build verified locally: 20 tests pass.
---
.../src/main/java/org/apache/camel/example/mapper/BeerMapper.java | 1 +
semantic-agent-routing/pom.xml | 2 +-
semantic-agent-routing/src/main/resources/application.properties | 2 ++
semantic-agent-routing/src/main/resources/routes/coordinator.yaml | 8 +++++++-
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git
a/mapstruct/src/main/java/org/apache/camel/example/mapper/BeerMapper.java
b/mapstruct/src/main/java/org/apache/camel/example/mapper/BeerMapper.java
index 4105df26..64827205 100644
--- a/mapstruct/src/main/java/org/apache/camel/example/mapper/BeerMapper.java
+++ b/mapstruct/src/main/java/org/apache/camel/example/mapper/BeerMapper.java
@@ -26,6 +26,7 @@ public interface BeerMapper {
@Mapping(source = "style", target = "category")
@Mapping(source = "alcohol", target = "strength")
+ @Mapping(target = "kind", constant = "beer")
Beverage toBeverage(Beer beer);
}
diff --git a/semantic-agent-routing/pom.xml b/semantic-agent-routing/pom.xml
index 8b5200d6..bffd6c75 100644
--- a/semantic-agent-routing/pom.xml
+++ b/semantic-agent-routing/pom.xml
@@ -71,7 +71,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-typesafe-ai</artifactId>
+ <artifactId>camel-semantic-typesafe-ai</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/semantic-agent-routing/src/main/resources/application.properties
b/semantic-agent-routing/src/main/resources/application.properties
index fbf2779d..c6ecf54f 100644
--- a/semantic-agent-routing/src/main/resources/application.properties
+++ b/semantic-agent-routing/src/main/resources/application.properties
@@ -14,6 +14,8 @@
# limitations under the License.
camel.main.name=trip-{{role}}
+# TypeSafe AI semantic expert - registered as 'decisions' bean for use in
evaluations
+camel.beans.decisions=#class:org.apache.camel.component.typesafeai.TypeSafeAiSemanticAdapter
camel.main.shutdown-timeout=5
camel.server.enabled=true
camel.server.host=127.0.0.1
diff --git a/semantic-agent-routing/src/main/resources/routes/coordinator.yaml
b/semantic-agent-routing/src/main/resources/routes/coordinator.yaml
index 1811007b..897bd2cd 100644
--- a/semantic-agent-routing/src/main/resources/routes/coordinator.yaml
+++ b/semantic-agent-routing/src/main/resources/routes/coordinator.yaml
@@ -18,8 +18,9 @@
type: org.apache.camel.example.routing.TripSupport
- semantic:
- question:
+ evaluation:
specialist:
+ expert: decisions
type: choice
instructions: Which car rental specialist should handle the customer's
request?
criteria:
@@ -28,18 +29,22 @@
cost: Rental prices, total cost, budget, fees or price comparison
general: Greetings, service information or other questions
needsReservation:
+ expert: decisions
type: boolean
instructions: Does answering this customer request fully require input
about booking details, reservation lookup, changes or cancellation?
threshold: "{{routing.fan-out-threshold}}"
needsWeather:
+ expert: decisions
type: boolean
instructions: Does answering this customer request fully require input
about weather, rain, forecasts or driving conditions at the destination?
threshold: "{{routing.fan-out-threshold}}"
needsCost:
+ expert: decisions
type: boolean
instructions: Does answering this customer request fully require input
about rental prices, total cost, budget or fees?
threshold: "{{routing.fan-out-threshold}}"
relevant:
+ expert: decisions
type: boolean
instructions: >-
Does the drafted reply address every requested part within the named
specialist's
@@ -51,6 +56,7 @@
uncertainty: 0.1
uncertaintyPolicy: non-match
complete:
+ expert: decisions
type: boolean
instructions: >-
Does the final reply address every part of the customer's original
request,