fix(watsonx): emit response events with logger#4153
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRefactors ChangesResponse Event Emission and Testing
Test Cassette Redactions
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Emit Watsonx response choice events through the provided event logger, add regression coverage for single, list, and stream response shapes, and keep dataset attachment cassette upload URLs redacted with deterministic non-live placeholders.
8ab3c08 to
f34d62d
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/opentelemetry-instrumentation-watsonx/tests/test_events.py (1)
58-83: ⚡ Quick winAdd a regression test for mixed invalid entries in batched responses.
Please add one case where the list includes non-dict items and
resultscontains non-dict elements, then assert only valid dict messages emit logs. This locks in the new filtering behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/opentelemetry-instrumentation-watsonx/tests/test_events.py` around lines 58 - 83, Add a regression test in tests/test_events.py alongside test_emit_response_events_writes_choice_log_for_list_response that calls _emit_response_events with a mixed list containing non-dict items (e.g., a string or None) and entries whose "results" list includes non-dict elements; then use the event_logger fixture/exporter to collect finished logs and assert that only the valid dict messages produced gen_ai.choice logs (with correct index/message/finish_reason) and that invalid entries produced no logs. Reference _emit_response_events, event_logger, and exporter when locating where to add the new assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/opentelemetry-instrumentation-watsonx/tests/test_events.py`:
- Around line 58-83: Add a regression test in tests/test_events.py alongside
test_emit_response_events_writes_choice_log_for_list_response that calls
_emit_response_events with a mixed list containing non-dict items (e.g., a
string or None) and entries whose "results" list includes non-dict elements;
then use the event_logger fixture/exporter to collect finished logs and assert
that only the valid dict messages produced gen_ai.choice logs (with correct
index/message/finish_reason) and that invalid entries produced no logs.
Reference _emit_response_events, event_logger, and exporter when locating where
to add the new assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b3f80768-4106-44e0-9a69-2b0c3e8e0066
📒 Files selected for processing (5)
packages/opentelemetry-instrumentation-watsonx/opentelemetry/instrumentation/watsonx/__init__.pypackages/opentelemetry-instrumentation-watsonx/tests/test_events.pypackages/traceloop-sdk/tests/datasets/cassettes/test_dataset_with_attachments/test_create_dataset_with_file_attachments_mocked.yamlpackages/traceloop-sdk/tests/datasets/cassettes/test_dataset_with_attachments/test_create_dataset_with_in_memory_attachment.yamlpackages/traceloop-sdk/tests/datasets/cassettes/test_dataset_with_attachments/test_create_dataset_with_mixed_attachments.yaml
✅ Files skipped from review due to trivial changes (2)
- packages/traceloop-sdk/tests/datasets/cassettes/test_dataset_with_attachments/test_create_dataset_with_in_memory_attachment.yaml
- packages/traceloop-sdk/tests/datasets/cassettes/test_dataset_with_attachments/test_create_dataset_with_mixed_attachments.yaml
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
Summary
Validation
Summary by CodeRabbit
Bug Fixes
Tests
Chores