Repository navigation
Conversation
This was referenced Aug 27, 2026
jxnl
added a commit
that referenced
this pull request
Aug 28, 2026
## Summary - preserve every Anthropic batch system instruction during request conversion - reject AWS-documented unsupported Bedrock schema constraints locally without misclassifying property names that resemble constraint keywords - preserve caller-owned Bedrock nested inference configuration and Gemini safety mappings during normalization - preserve `TypedDict` `total=False`, `Required`, and `NotRequired` semantics for top-level and iterable response models - retry only failed live-provider tests once while keeping setup, collection, repeated, and other failures red - record the runtime and CI corrections in the `1.16.1` changelog ## Consolidated work Supersedes #2530, #2532, #2551, #2552, and #2568. Closes #2567. The original provider contributor commits and authors are preserved. Follow-up coverage expands the Bedrock regression matrix across nested schema paths, proves outgoing nested mappings are copied, and covers mixed Anthropic system content. The TypedDict patch is consolidated through one shared conversion helper; unlike #2568, it preserves explicit `Required` keys inside `total=False` definitions and fixes the iterable path as well. ## Validation - exact head: `e1e59211e5e0a02fe49a2cc52c07060934512397` on security-hardened main `000d893e2ece467d40e395f6ded37250dc732480` - release validator and wheel smoke tests report `1.16.1` on Python 3.9 and 3.13 - 133 focused deterministic tests passed locally across response-model, iterable, Bedrock, Gemini, batch, and remote-fetch interactions - full statement and branch coverage gate passes; offline coverage passes on Python 3.9-3.13 - Ruff lint/format and strict source/test `ty` checks pass - the workflow YAML parses, its shell block passes syntax validation, and `git diff --check` is clean - the complete exact-head GitHub matrix is green, including every configured provider suite and Workers - the mixed-provider lane observed two provider-side Cohere 422 responses, reran exactly those two failed node IDs once, and both passed - Codex Security full-range scan `ae875b7c-14cf-4dc7-a19f-91ad8f812786` completed with no findings across seven runtime, schema, mutation, and workflow surfaces - Codex Security incremental scan `2e87410f-1846-497c-ad22-9317449c63cd` completed with no findings on the final fail-closed workflow guard ## Intentionally separate - #2557 remains open because official Google GenAI materials conflict on function-response roles and the source PR has no provider-wire evidence resolving the ambiguity - OpenAI v3, async validators, Gemini tool-history conversion, Bedrock bearer authentication, provider additions, dependency batches, and architecture work remain outside this patch-sized consolidation - Dependabot PRs #2570-#2575 remain separate because they are major action updates or a broad Python dependency batch - the documentation-only consolidation remains in #2565 TAC status was unavailable, so protected scan-output visibility could not be verified; source coverage was complete.
Collaborator
|
Closing as consolidated by #2566, with mixed string/content-block system instructions and request immutability covered. Thank you for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
BatchRequest.to_anthropic_format()previously overwrotesystem_messagefor every system turn, so Anthropic batch requests silently kept only the final instruction. This change combines every system message in order through the existing Anthropic helper, preserves both string and content-block forms, and continues to remove system turns from the providermessageslist.A regression test covers interleaved user and multiple system turns, and the fix is recorded in the unreleased changelog.
Issue ticket number and link
N/A — no matching issue or pull request was found.
Validation
uv run pytest tests/test_batch_processor_coverage.py tests/coverage/test_batch_openai_coverage.py tests/coverage/test_batch_anthropic_coverage.py tests/coverage/test_batch_api_coverage.py tests/test_batch_in_memory.py -q— 102 passeduv run ruff check instructor/batch/request.py tests/coverage/test_batch_api_coverage.py— passeduv run ruff format --check instructor/batch/request.py tests/coverage/test_batch_api_coverage.py— passeduv run ty check instructor/batch/request.py tests/coverage/test_batch_api_coverage.py— passedChecklist before requesting a review
OpenAI Codex assisted with the implementation and test preparation; the change was reviewed and verified with the commands above.