atiaomar1978-hub commented on code in PR #25507:
URL: https://github.com/apache/camel/pull/25507#discussion_r3789782387
##########
core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java:
##########
@@ -150,6 +150,7 @@ public abstract class BaseMainSupport extends BaseService {
private static final String PREFIX_TRACE = "camel.trace.";
private static final String PREFIX_ROUTE_CONTROLLER =
"camel.routeController.";
private static final String PREFIX_ERROR_REGISTRY = "camel.errorRegistry.";
+ private static final String PREFIX_AI_OBSERVABILITY =
"camel.ai.observability.";
Review Comment:
_AI-generated on behalf of atiaomar1978-hub_
Fixed in e712116. Renamed the global toggle to
`camel.aiObservability.enabled` (single-level camelCase under `camel.`,
matching `camel.errorRegistry.` / `camel.routeController.`). Dash-style
`camel.ai-observability.enabled` is accepted via Camel Main property
normalization and is also resolved directly in `GenAiObservability.isEnabled`.
Updated `BaseMainSupport`, `PrepareCamelMainMojo`,
`GenAiObservabilityProperties`, generated catalog/metadata, docs, and added
`AiObservabilityConfigurationPropertiesTest` coverage for the dash alias.
##########
components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java:
##########
@@ -965,8 +989,6 @@ private <T> void processStructuredOutputRequest(
// Also set headers
exchange.getMessage().setHeader(SpringAiChatConstants.CHAT_RESPONSE,
responseText);
exchange.getMessage().setHeader(SpringAiChatConstants.STRUCTURED_OUTPUT,
structuredOutput);
Review Comment:
_AI-generated on behalf of atiaomar1978-hub_
Fixed in e712116. Restored `populateTokenUsage(response, exchange)`
immediately after `callWithObservability()` in
`processStructuredOutputRequest`, so structured output routes again populate
`INPUT_TOKEN_COUNT`, `OUTPUT_TOKEN_COUNT`, and `TOTAL_TOKEN_COUNT` exchange
headers.
##########
components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java:
##########
@@ -852,13 +866,24 @@ private Class<?> getEntityClass(Exchange exchange) {
*/
private <T> void processEntityRequest(
ChatClient.ChatClientRequestSpec request, Exchange exchange,
Class<T> entityClass) {
- // Execute the request and convert to entity
- T entity = request.call().entity(entityClass);
-
- // Set the entity as the body
- exchange.getMessage().setBody(entity);
-
- LOG.debug("Converted response to entity of type: {}",
entityClass.getName());
+ GenAiObservationContext observationContext = buildObservationContext();
+ GenAiObservation observation = GenAiObservability.start(exchange,
observationContext);
+ try {
+ org.springframework.ai.chat.client.ResponseEntity<ChatResponse, T>
responseEntity
Review Comment:
_AI-generated on behalf of atiaomar1978-hub_
Fixed in e712116. Added `import
org.springframework.ai.chat.client.ResponseEntity;` and replaced the FQCN with
`ResponseEntity<ChatResponse, T>`.
--
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]