feat(messages)!: add Anthropic Message Batches API#5577
feat(messages)!: add Anthropic Message Batches API#5577cdoern wants to merge 1 commit intoogx-ai:mainfrom
Conversation
✱ Stainless preview buildsThis PR will update the Edit this comment to update it. It will appear in the SDK's changelogs. ✅ llama-stack-client-go studio · conflict
✅ llama-stack-client-node studio · conflict
✅ llama-stack-client-python studio · conflict
✅ llama-stack-client-openapi studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
7f7488d to
0ed9397
Compare
…ranslation (ogx-ai#5587) ## Summary - Adds a new `messages-openai` integration test suite that reuses `tests/integration/messages` with the `gpt` setup, so requests flow through `_anthropic_to_openai` / `_openai_to_anthropic` in `providers/inline/messages/impl.py` instead of the native passthrough branch that the existing `messages` (ollama-reasoning) suite hits. - Registers the suite in `tests/integration/ci_matrix.json` so replay-mode CI runs it, and adds a `gpt` / `messages-openai` row to `.github/workflows/record-integration-tests.yml` so future rerecord runs refresh it. - Includes 12 recordings captured against `openai/gpt-4o` so replay mode works out-of-the-box (no API key required in CI). This is a precursor to ogx-ai#5577 — the batches tests there need a suite that targets OpenAI, because batches go through `create_message()` which only exercises translation when the provider is not in `_NATIVE_MESSAGES_MODULES`. ## Test plan Recorded locally and verified against `openai/gpt-4o`: ```bash ./scripts/integration-tests.sh \ --stack-config server:ci-tests \ --suite messages-openai \ --inference-mode record-if-missing ``` Result: 13/13 tests pass. Recording URLs point at `https://api.openai.com/v1/chat/completions`, confirming the translation path is being exercised (not the Anthropic-native `/v1/messages` endpoint the ollama suite hits). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Charlie Doern <cdoern@redhat.com>
4842890 to
70091ac
Compare
Add the 5 Anthropic Message Batches endpoints under /v1/messages:
- POST /v1/messages/batches (create batch)
- GET /v1/messages/batches (list batches)
- GET /v1/messages/batches/{id} (retrieve batch)
- POST /v1/messages/batches/{id}/cancel (cancel batch)
- GET /v1/messages/batches/{id}/results (stream JSONL results)
The implementation follows the same pattern as the existing OpenAI Batches
provider: KVStore for persistence, background asyncio tasks with
semaphore-based concurrency control, and reuse of the existing
create_message() flow for processing individual batch requests. The
MessagesConfig now requires a kvstore backend, which is a breaking change
to the provider configuration.
Integration tests run under the messages-openai suite and cover create /
retrieve / list / cancel / results / duplicate-custom_id / 404 paths against
openai/gpt-4o, with recordings committed for replay-mode CI.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Charlie Doern <cdoern@redhat.com>
70091ac to
25dae2f
Compare
|
not sure why backwards compatibility test is failing, I added |
Summary
Adds all 5 Anthropic Message Batches API endpoints under
/v1/messages:POST /v1/messages/batches— create a batch of message requestsGET /v1/messages/batches— list batches with paginationGET /v1/messages/batches/{id}— retrieve batch statusPOST /v1/messages/batches/{id}/cancel— cancel an in-progress batchGET /v1/messages/batches/{id}/results— stream results as JSONLThe implementation follows the same architecture as the existing OpenAI Batches provider: KVStore persistence, background asyncio tasks with semaphore-based concurrency control, and reuse of the existing
create_message()flow for processing individual batch requests.Breaking change
MessagesConfignow requires akvstorebackend (KVStoreReference). Existing distributions are updated via codegen; out-of-tree configs will need to add this field.Test plan
tests/integration/messages/test_message_batches.pycovering create / retrieve / list / cancel / results / duplicate-custom_id / 404, running under themessages-openaisuite (already wired intotests/integration/ci_matrix.json)openai/gpt-4oso replay-mode CI works without an API keyLocally verified:
./scripts/integration-tests.sh \ --stack-config server:ci-tests --setup gpt \ --file tests/integration/messages/test_message_batches.py # 6 passed in 1.76s🤖 Generated with Claude Code