llama-stack-mirror/llama_stack
Matthew Farrellee 68877f331e feat: Add optional idempotency support to batches API
Implements optional idempotency for batch creation using `idem_tok` parameter:

* **Core idempotency**: Same token + parameters returns existing batch
* **Conflict detection**: Same token + different parameters raises HTTP 409 ConflictError
* **Metadata order independence**: Different key ordering doesn't affect idempotency

**API changes:**
- Add optional `idem_tok` parameter to `create_batch()` method
- Enhanced API documentation with idempotency extensions

**Implementation:**
- Reference provider supports idempotent batch creation
- ConflictError for proper HTTP 409 status code mapping
- Comprehensive parameter validation

**Testing:**
- Unit tests: focused tests covering core scenarios with parametrized conflict detection
- Integration tests: tests validating real OpenAI client behavior

This enables client-side retry safety and prevents duplicate batch creation
when using the same idempotency token, following REST API
2025-08-08 08:08:08 -04:00
..
apis feat: Add optional idempotency support to batches API 2025-08-08 08:08:08 -04:00
cli chore: rename templates to distributions (#3035) 2025-08-04 11:34:17 -07:00
core feat: add batches API with OpenAI compatibility (with inference replay) (#3162) 2025-08-15 15:34:15 -07:00
distributions feat: add batches API with OpenAI compatibility (with inference replay) (#3162) 2025-08-15 15:34:15 -07:00
models chore(tests): fix responses and vector_io tests (#3119) 2025-08-12 16:15:53 -07:00
providers feat: Add optional idempotency support to batches API 2025-08-08 08:08:08 -04:00
strong_typing chore: enable pyupgrade fixes (#1806) 2025-05-01 14:23:50 -07:00
testing fix(recording): endpoint resolution (#3013) 2025-08-01 16:23:54 -07:00
ui feat(UI): Adding linter and prettier for UI (#3156) 2025-08-14 15:58:43 -06:00
__init__.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
env.py refactor(test): move tools, evals, datasetio, scoring and post training tests (#1401) 2025-03-04 14:53:47 -08:00
log.py chore(tests): fix responses and vector_io tests (#3119) 2025-08-12 16:15:53 -07:00
schema_utils.py feat(auth): API access control (#2822) 2025-07-24 15:30:48 -07:00