mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-03 07:23:33 +00:00
test(spend): assert Anthropic envelope for Messages budget refusals (#49800)
Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
3da6029977
commit
408773bb69
1 changed files with 11 additions and 1 deletions
|
|
@ -346,5 +346,15 @@ def test_a_broken_messages_stream_counts_toward_the_budget(gateway: Gateway) ->
|
|||
_broken_messages_stream(gateway, model, key)
|
||||
after: Final = _messages(gateway, model, key, streamed=False)
|
||||
|
||||
assert_budget_refusal(after)
|
||||
assert after.status_code == 422, after.text
|
||||
body: Final = JSON_OBJECT.validate_json(after.content)
|
||||
error: Final = JSON_OBJECT.validate_python(body["error"])
|
||||
assert body == {
|
||||
"type": "error",
|
||||
"error": {
|
||||
"type": "invalid_request_error",
|
||||
"message": error["message"],
|
||||
"litellm_error_type": "budget_exceeded",
|
||||
},
|
||||
}, after.text
|
||||
assert _rows(gateway, key, 2) == (metered, StatusRow(status="failure", spend=0.0))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue