Repository navigation
feat(models): add Anthropic Messages dialect - #145
Conversation
|
Commit messages and identities clean: single author matching 28 merged commits, no trailers, no private paths. Verified empirically: 623 tests pass, ruff/ty clean, 95% coverage on the new module, and a two-turn tool-use continuation round-trips end to end. BlockingBug: adaptive thinking is treated as guaranteed — With Suggest requiring the summary only when a thinking block is present, and never when the reply was truncated. Bug:
A refusal arrives as HTTP 200 and is a scoreable outcome, not an error. Letting Non-blocking
Verified clean
|
Bind the provider-neutral model IR to Anthropic's native Messages JSON and SSE protocols with explicit capability admission, independent request auditing, strict response lifting, and replay-safe extended-thinking continuations. Reject unsupported authority, tool, and response shapes before they can be silently reinterpreted.
Exercise reachable request rejection, opaque replay validation, wire verifier mismatches, malformed provider responses, and SSE state-machine failures. Raise the dialect module's combined line/branch coverage above the core gate so multi-dialect integration does not dilute coverage below 95%.
Assert that streaming HTTP failures are raised before the SSE parser runs, preserving the same status contract as non-streaming Messages requests.
Strengthen Anthropic request and response validation, classify context-window termination as truncation, and document the dialect's required max_tokens, seed policy, and passthrough limitations.
Allow adaptive-thinking turns without thinking blocks and lift refusal responses as scoreable terminal outcomes. Normalize streaming and non-streaming refusals to empty text, validate refusal details, preserve streamed HTTP error bodies, and skip success-only output requirements for refused responses.
aedcd19 to
3335dfc
Compare
|
Thanks — addressed the actionable findings in the latest commit. Adaptive thinkingAdaptive thinking is no longer treated as guaranteed:
Refusal handlingAnthropic refusals are now reachable and treated as scoreable terminal outcomes:
For streaming refusals, any content received before the terminal refusal is
The second shape is defensive coverage rather than a claim that Anthropic Streaming HTTP errorsStreaming error responses are now read before Follow-ups
Explicitly disabling thinking requires a shared IR decision, so it remains a The shipped Validation
|
The refusal early return skipped `_validated_content_block` entirely, so a refusal carrying an unparseable block lifted cleanly while the same block on the success path raised. Validate then discard, keeping the documented normalization to empty text. Also document two things a reader cannot get from the code: why `summary='none'` enables thinking here but is a no-op on Responses, and the three beta-gated `stop_details` fields that would be rejected as unknown if header passthrough ever lands. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
63a33fe to
d601f57
Compare
Type
Summary
anthropic_messagesdialect using Anthropic’s native Messages JSON and SSE protocols.max_tokensandmodel_context_window_exceededas Anthropic truncation outcomes in shared anomaly and report accounting.anthropic_messagesconfiguration contract, including requiredmax_tokens, unsupported request seeds, and the absence of raw body/header passthrough such asanthropic-beta.Related Issues
Refs #25
Test Plan
Automated
ruff check && ruff format --check)ty checkormypy --strict)pdm run pytest)Manual
No live Anthropic endpoint was exercised. Native request, response, SSE, authentication, continuation, and failure paths were verified with real
httpxrequest construction over mocked HTTP transports.Checklist
Required (all PRs)
type(scope): description)AI-Generated Code - <model> (<provider>)in module docstringcore/