gnodet opened a new pull request, #30326: URL: https://github.com/apache/camel/pull/30326
## Summary Records the detailed and full observability data for the Responses API operation (`openai:responses`), mirroring the enhancements added to the chat-completion operation by CAMEL-27131. ## Root Cause `OpenAIResponsesProducer.observedCall()` only recorded basic-level data (model, token counts, finish reason). The richer data introduced by CAMEL-27131 — the `invoke_agent` span that wraps the tool loop, request parameters, conversation id, cached tokens, input messages, system instructions, and tool definitions — was never ported to the Responses API path. ## Fix **`OpenAIResponsesGenAiMessages`** (new utility class): converts `ResponseCreateParams` and `Response` objects to the `GenAiMessages`/`GenAiToolDefinitions` types expected by the GenAI observability API. Handles plain text input, `EasyInputMessage` items (user/assistant/system/developer roles), function call inputs and outputs, and response output messages and function calls. **`OpenAIResponsesProducer`**: - `processObservedToolLoop()` — new method that wraps `processToolLoop()` in an `invoke_agent` span (named after the route id), records input messages, makes the span current so nested model and tool spans appear under it, and records the final output on completion. - `observedCall()` — enhanced to record conversation id, temperature/top_p/max_tokens request parameters, `tracedByFramework` flag, cached input tokens (via `_inputTokensDetails().asKnown()` — necessary because `ResponseUsage.inputTokensDetails()` is non-Optional in the Responses SDK, unlike the chat-completion equivalent), input messages, system instructions, tool definitions, and output messages. - Level guard in `processInternal()` — calls `processObservedToolLoop()` only at `detailed` level or higher; falls back to the existing `processToolLoop()` at basic level (no behaviour change for the default level). ## Tests `OpenAIResponsesObservabilityLevelTest` verifies the full observability path end-to-end against the OpenAI mock: - one `invoke_agent` span with the route id as agent name and input messages recorded - two nested `chat` spans (tool request + final answer), the first carrying tool definitions - one `execute_tool` span with tool name and result All 423 existing tests in `camel-openai` continue to pass. Fixes https://issues.apache.org/jira/browse/CAMEL-27142 _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_ -- 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]
