CAMEL-24559: Extend GenAI observability to OpenAI embeddings, moderation, and responses - #26106
Conversation
|
Links CAMEL-24559 — first follow-up slice for extending GenAI observability beyond chat/streaming. Review status: Bugbot (no bugs) and Grok review feedback addressed in commit AI-generated comment on behalf of @atiaomar1978-hub |
|
Links CAMEL-24559 — first follow-up slice. Bugbot + Grok review feedback addressed in 38b10e2. |
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 73 tested, 25 compile-only — current: 71 all testedMaveniverse Scalpel detected 98 affected modules (current approach: 71).
|
gnodet
left a comment
There was a problem hiding this comment.
Review summary: Solid and well-structured extension of GenAI observability to three additional OpenAI producers. The pattern follows the established createChatCompletion in OpenAIProducer closely. Two issues worth addressing before merge.
This review was generated by an automated reviewer (Hermès) on behalf of @gnodet.
…n, and responses Extend camel-openai producers beyond chat-completion with OpenTelemetry spans and Micrometer metrics using the existing GenAiObservability API. - Instrument OpenAIEmbeddingsProducer, OpenAIModerationProducer, and OpenAIResponsesProducer with try/recordSuccess/recordError/close - Add GenAiOperationName.MODERATION for content-policy operations - Add OpenAIEmbeddingsObservabilityTest, OpenAIModerationObservabilityTest, OpenAIResponsesObservabilityTest, and shared test support - Document OpenAI operation coverage in ai-observability.adoc and 4.23 upgrade guide Co-authored-by: Cursor Agent <noreply@cursor.com>
- Scope GenAI spans to SDK calls only (embeddings/moderation) - Map openai:responses to gen_ai.operation.name=chat per OTel OpenAI usage - Clarify MODERATION as Camel extension in enum javadoc and docs - Strengthen tests: body/header assertions, exact token tags, override properties Co-authored-by: Cursor Agent <noreply@cursor.com>
- Pass OpenAI token counts as Long without Math.toIntExact (includes CAMEL-24560 GenAiUsage Long token fields cherry-picked from follow-up) - Extract observedCall helper in OpenAIResponsesProducer to deduplicate observation boilerplate between createResponse and createStructuredResponse - Restore moderation security comments explaining why mismatched result counts must fail the exchange Co-authored-by: Cursor Agent <noreply@cursor.com>
067e3b1 to
d1a3fc2
Compare
|
This comment was generated by an AI agent on behalf of @atiaomar1978-hub. Review feedback from @gnodet has been addressed and the branch rebased onto latest
Rebased commits on
Tests run locally after rebase: |
gnodet
left a comment
There was a problem hiding this comment.
Re-review after d1a3fc2: All four findings from the previous review are addressed.
Math.toIntExactremoved (Embeddings) —usage.promptTokens()passed directly toGenAiUsage.of(Long, ...), matching theOpenAIProducer.createChatCompletionpattern.Math.toIntExactremoved (Responses) —usage.inputTokens()/usage.outputTokens()passed directly aslong.observedCallhelper extracted (Responses) — Shared helper eliminates the observation boilerplate duplication betweencreateResponseandcreateStructuredResponse. Clean implementation usingThrowingSupplier.- Security comment restored (Moderation) — The content-gating invariant comment is present.
No new issues. The observation patterns are consistent with OpenAIProducer.createChatCompletion, tests cover all three new producers, and the docs are updated.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Summary
Follow-up to CAMEL-23861 / CAMEL-24559: extend GenAI observability to additional OpenAI producer operations beyond
chat-completion.This PR instruments OpenAI embeddings, moderation, and responses with the existing
GenAiObservabilityAPI.gen_ai.operation.nameopenai:embeddingsembeddingsopenai:moderationmoderation(Camel extension)openai:responseschatopenai:chat-completionchat(unchanged)Changes
OpenAIEmbeddingsProducer,OpenAIModerationProducer,OpenAIResponsesProducerGenAiOperationName.MODERATIONOpenAIEmbeddingsObservabilityTest,OpenAIModerationObservabilityTest,OpenAIResponsesObservabilityTestai-observability.adoc, catalog mirror, 4.23 upgrade guideTest plan
./mvnw -pl components/camel-ai/camel-openai -am test -Dtest=OpenAIEmbeddingsObservabilityTest,OpenAIModerationObservabilityTest,OpenAIResponsesObservabilityTestImages, audio, Spring AI modules, and cloud LLMs remain for future CAMEL-24559 follow-ups.
AI-generated PR description on behalf of @atiaomar1978-hub