Federico Mariani created CAMEL-27143:
----------------------------------------
Summary: camel-ai-observability - resolve the model name, provider
and error status without reflection
Key: CAMEL-27143
URL: https://issues.apache.org/jira/browse/CAMEL-27143
Project: Camel
Issue Type: Sub-task
Components: camel-ai
Reporter: Federico Mariani
{{GenAiModelResolver}} and {{GenAiErrorSupport}}
({{camel-ai-observability-api}}) do not depend on the AI libraries, so they
call methods by name: {{modelName}}, {{provider}}, {{defaultRequestParameters}}
and {{getMetadata}} to read the model name and provider of LangChain4j and
Spring AI models and responses, and {{statusCode}} and {{headers}} to read the
status and the retry-after headers of LangChain4j and openai-java exceptions.
When a lookup fails, the span gets {{unknown}} as model or provider, and the
error gets no category from its status.
In a native image these methods have to be registered for reflection, for every
model class a route may use. The components already depend on their library
({{camel-langchain4j-*}} on LangChain4j, {{camel-spring-ai-*}} on Spring AI,
{{camel-openai}} on openai-java), so they could read these values with typed
calls and pass them to the observation context, keeping the lookup by name only
as a fallback.
Related: apache/camel-quarkus#9518, where the lookup of the implementation
itself is moving from reflection to a service lookup.
_Claude Code on behalf of Croway_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)