The service, piece by piece
Now the inside of the service, from submit to results.
That's the whole service. A request enters at the top and leaves at the bottom, as one line of a results file.
Submit checks the envelope fast
The submit call gets the batch somewhere durable, quickly, and says yes or no. It checks what is cheap and fatal for the whole file:
- the caller is signed in, and the tenant is under quota
- the file is within the size limits and parses
- every
custom_idis unique, and the model is known
Reject the whole batch only for envelope problems like these. Everything else is per request. Anthropic checks each request's parameters later, while the batch runs, and reports those errors once the whole batch has ended. So one malformed line out of 100,000 becomes one errored result.
MODELS and MAX_REQUESTS in the editor are what this service accepts. Write envelope_problems(model, requests): which of too many requests, unknown model and duplicate custom_id the batch has. A bad parameter inside one request is not on the list.