davsclaus commented on code in PR #27714:
URL: https://github.com/apache/camel/pull/27714#discussion_r4249464843
##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -27,3 +27,33 @@ A `hashicorp:` property with a field of a secret that does
not exist, such as `{
now resolves to no value, as it already did without a field, so its default
value or an optional placeholder
(`{{?hashicorp:secret:missing#field}}`) applies. Before, without a default
value, it failed with a
`NullPointerException`.
+
+=== camel-openai, camel-ai-tool - AI events now use CamelEvent.Type.Ai
+
+The events fired by the AI components now share a common contract,
`org.apache.camel.ai.AiEvent` (a
+`CamelEvent` of the new `CamelEvent.Type.Ai`), instead of each being a
component-specific
+`CamelEvent.Type.Custom` event. Events that relate to a single exchange
implement the exchange-backed subtype
+`AiEvent.ExchangeAiEvent` (the root `AiEvent` itself is not an
`ExchangeEvent`). This lets an `EventNotifier` recognise AI activity — and
route it to metrics or
+tracing — by type and by the `AiEvent` sub-interfaces, without depending on an
AI component.
+
+The events shipped in 4.23.0 are affected:
+
+* `camel-ai-tool`: `AiToolAuthorizationDeniedEvent` now implements
`AiEvent.ToolCallDeniedEvent`;
+* `camel-openai`: `OpenAIAgenticLoopStartedEvent`,
`OpenAIAgenticToolCallExecutedEvent` and
+ `OpenAIAgenticLoopCompletedEvent` now implement
`AiEvent.AgentLoopStartedEvent`, `AiEvent.ToolCallExecutedEvent`
+ and `AiEvent.AgentLoopCompletedEvent`.
+
+Their `getType()` now returns `CamelEvent.Type.Ai` rather than
`CamelEvent.Type.Custom`, and they are now
+`CamelEvent.ExchangeEvent`s (via `AiEvent.ExchangeAiEvent`). An
`EventNotifier` that recognised these events by
+`event.getType() == CamelEvent.Type.Custom` must match on `CamelEvent.Type.Ai`
instead, or — preferably —
+on `event instanceof org.apache.camel.ai.AiEvent` (or one of its
sub-interfaces), which no longer requires a
+dependency on the AI component. The concrete event classes and all their
accessors are unchanged, so code that
+references them directly is not affected.
+
+Because the shipped AI events are now `ExchangeEvent`s (via
`AiEvent.ExchangeAiEvent`), a notifier that filters on
+`instanceof ExchangeEvent` now also receives them. AI events are their own
category: a new `ignoreAiEvents` flag
+(`EventNotifier.setIgnoreAiEvents(boolean)`, default `false`) opts a notifier
out, and `ignoreExchangeEvents` does
+**not** drop AI events (so an AI-observability notifier can keep
`ignoreExchangeEvents=true` for performance). Camel's
+own exchange-oriented notifiers (the debugger, the dev-console event ring, the
micrometer exchange notifier) set
+`ignoreAiEvents=true` so AI events do not reach them; a custom
exchange-focused notifier that should not see AI events
Review Comment:
The last commit also opts out `OpenTelemetryExchangeEventNotifier`, so it
belongs in this list:
```suggestion
own exchange-oriented notifiers (the debugger, the dev-console event ring,
the micrometer and OpenTelemetry metrics
exchange notifiers) set `ignoreAiEvents=true` so AI events do not reach
them; a custom exchange-focused notifier that
should not see AI events
```
##########
components/camel-event/src/main/java/org/apache/camel/component/camelevent/CamelEventConsumer.java:
##########
@@ -309,6 +310,10 @@ private void configureEventNotifier() {
// Custom events are CamelContextEvents, so we need to
enable context events
eventNotifier.setIgnoreCamelContextEvents(false);
break;
+ case Ai:
Review Comment:
`event:Ai` works now, but `event-component.adoc` ("The following event types
are available") doesn't list `Ai` yet. Could you add it there, perhaps in a
short "AI Events" group, and regenerate the catalog copy?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]