Assessment: Anthropic Batch fix#989
Conversation
… and enhance Anthropic batch handling
…ty in create_batch method
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughUpdates Anthropic batch creation to use the beta batches endpoint with optional structured-outputs support, and raises the assessment batch max-tokens default to 16384 with matching tests. ChangesAnthropic structured outputs beta and assessment batch token constant
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant AnthropicBatchProvider
participant AnthropicClient
participant AnthropicBetaBatchesAPI
AnthropicBatchProvider->>AnthropicBatchProvider: inspect requests for output_config
AnthropicBatchProvider->>AnthropicClient: beta.messages.batches.create(requests, betas)
AnthropicClient->>AnthropicBetaBatchesAPI: create batch request
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
OpenAPI changes ⚪ No API surface changesNote This PR does not modify the API contract.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@backend/app/core/batch/anthropic.py`:
- Around line 82-84: The `create_batch` logging in `anthropic.py` is emitting
the full serialized `requests` payload at info level, which can leak
prompts/messages and create oversized logs. Update the `logger.info` call in
`create_batch` to avoid dumping `json.dumps(requests, indent=2)`; either lower
it to debug or replace it with minimal metadata such as request count and
`custom_id` values. Keep the change localized to the batch request logging path
and preserve the rest of the batch creation flow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 94da541c-68e8-4817-aceb-3d813576b01e
📒 Files selected for processing (4)
backend/app/core/batch/anthropic.pybackend/app/crud/assessment/batch.pybackend/app/models/llm/constants.pybackend/app/tests/assessment/test_batch.py
… tests Route batch creation through the beta endpoint with the structured-outputs beta so output_config (JSON schema) is forwarded instead of stripped, and update the provider tests to assert the beta path and beta flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🎉 This PR is included in version 1.3.0-main.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Issue
Closes #990
Summary
Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.