mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-13 08:52:02 +00:00
test(providers): align SageMaker wire assertions with request semantics (#51536)
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
eb811913f1
commit
ba200f5773
1 changed files with 4 additions and 3 deletions
|
|
@ -406,14 +406,14 @@ def test_openai_route_sends_a_custom_deployment_key_at_the_top_level_of_the_body
|
|||
assert _body(request) == {"input": [text], "input_type": "query", "model": SERVED_MODEL}, request.body
|
||||
|
||||
|
||||
def test_deployment_extra_body_wins_over_the_callers_encoding_format(proxy: Gateway, wire: Wire) -> None:
|
||||
def test_callers_encoding_format_wins_over_deployment_extra_body(proxy: Gateway, wire: Wire) -> None:
|
||||
text: Final = _text()
|
||||
created: Final = _sdk(proxy).embeddings.create(
|
||||
model="sm-openai-pinned", input=[text], extra_body={"cache": _NO_CACHE}
|
||||
)
|
||||
assert [row.embedding for row in created.data] == [[0.25, -0.5, 1.0]], created
|
||||
request: Final = _only_request(wire)
|
||||
assert _body(request) == {"input": [text], "encoding_format": "float", "model": SERVED_MODEL}, request.body
|
||||
assert _body(request) == {"input": [text], "encoding_format": "base64", "model": SERVED_MODEL}, request.body
|
||||
|
||||
|
||||
def test_openai_route_returns_the_base64_string_a_raw_caller_asked_for_unchanged(proxy: Gateway, wire: Wire) -> None:
|
||||
|
|
@ -533,7 +533,8 @@ def test_container_outage_errors_reach_the_caller_and_every_attempt_carries_the_
|
|||
attempts: Final = wire.drain()
|
||||
assert len(attempts) >= 1, attempts
|
||||
assert {attempt.headers[COMPONENT_HEADER] for attempt in attempts} == {COMPONENT}, attempts
|
||||
assert {attempt.body for attempt in attempts} == {json.dumps({"input": [text], "model": SERVED_MODEL}).encode()}
|
||||
for attempt in attempts:
|
||||
assert _body(attempt) == {"input": [text], "model": SERVED_MODEL}, attempt.body
|
||||
assert _spend_row(response)["status"] == "failure"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue