mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* refactor(bedrock): parameterise the invoke messages request transform for mantle reuse * fix(bedrock_mantle): split the mantle messages adapter into bedrock/mantle and bedrock_mantle configs on the invoke transform * test(bedrock_mantle): assert python's url, region, auth, shaping and usage behaviour on both mantle routes * docs(bedrock_mantle): note the shared invoke transform and the bedrock/mantle deprecation plan * test(bedrock_mantle): satisfy clippy on the wire body key order check * fix(bedrock_mantle): resolve the api key and model as python does on both mantle routes bedrock/mantle/ now reads an explicit empty api_key as given, so it signs with SigV4 instead of reading AWS_BEARER_TOKEN_BEDROCK. bedrock_mantle/ splits a region prefix only for python's BEDROCK_REGIONS list and logs the model without it. Both routes run the invoke transform on the model id python sends, so its rejection texts name that model. * fix(bedrock_mantle): project the bedrock params and capabilities python reads on both mantle routes bedrock_mantle/ now gets the guardrailConfig, request metadata and bedrock-keyed model capabilities that the inherited invoke transform reads in python, and both mantle routes get aws_bedrock_project_id so the anthropic-workspace-id header is sent. Capabilities are looked up for the model id python hands the invoke transform. * fix(bedrock_mantle): raise python's errors and shape tools on the mantle routes in the host The host now replays python's provider resolution, url and signing for a mantle call rust refused before sending it, so an invalid region and an upper-case public host raise python's BadRequestError or ValueError. A bedrock_mantle/ credential failure raises the Mantle ValueError, the invoke web_search rejection stays raw with llm_provider bedrock, caller tools are shaped in place, and the connect-failure text uses the mantle url. * feat(messages): serve bedrock mantle messages on rust only Both Mantle Messages configs, bedrock_mantle/<claude> and bedrock/mantle/<model>, now resolve to Target.BEDROCK_MANTLE, which the catalog makes RUST_REQUIRED for the bedrock and bedrock_mantle providers. Non-Claude bedrock_mantle models keep their chat or responses bridge on Python, and the Rust provider match only gives bedrock_mantle a Messages config for Claude models, as Python does. * fix(bedrock_mantle): resolve invoke helper capabilities under bedrock on the mantle routes Python's Mantle configs run the shared Anthropic transform on capabilities resolved under the route's provider and the Bedrock Invoke helpers (adaptive thinking, effort support) under bedrock, both for the model id the route sends. Rust now carries the Invoke helpers' flags in BedrockCapabilities, and the Python host and the router probe the keys mantle_capability_lookup names on bedrock_mantle/ and bedrock/mantle/. Every other route keeps its lookup unchanged. * style(rust_bridge): keep the typing noqa on the cast import line * test(bedrock_mantle): pin the python reference and send the mantle wire tests through rust Mantle Messages is served by Rust only now, so the unit wire tests call the Python handler directly as the invoke tests do, and the same requests run through the native route against the recording server and must match what Python sends and answers. * test(rust_bridge): cover the mantle error replay when python would not sign or refuse the call * refactor(bedrock_mantle): model mantle betas and usage as typed json instead of python truthiness Betas are read as an optional list of strings, so an absent or empty list sends no header and anything else is a transform bug. Usage is zero filled only when it is an object. * refactor(bedrock_mantle): rename first_truthy to first_non_empty * fix(rust_bridge): raise mantle region and credential failures natively instead of replaying python Rust now reports an invalid Mantle region as a typed error naming where Python refuses it. A region bedrock_mantle/ rejects while resolving the provider raises get_llm_provider's BadRequestError with an empty llm_provider, and a region refused later (bedrock/mantle/, or an upper-case Mantle host on SigV4) raises the bare ValueError. A bedrock_mantle/ credential failure raises litellm's own Mantle auth ValueError, keeping AwsAuthError for web identity failures. The host no longer re-runs Python's provider resolution, URL building or signing for these errors, so no STS call happens on the error path. * fix(bedrock_mantle): escape control characters in the invalid region message * fix(bedrock_mantle): refuse a reply whose usage is not an object instead of billing zero tokens A Mantle reply whose usage is present but is a list, string or number now raises litellm's APIError 500 rather than zero-filling the usage. Absent or null usage still bills zero tokens. * fix(bedrock_mantle): raise the botocore class for STS credential failures the Mantle signer lets through Rust now names why an STS call failed (rejected with a code, invalid web identity token, or unreachable) and the host raises the same class Python's credential code lets through on bedrock_mantle/: botocore ClientError, AwsAuthError 401 or EndpointConnectionError. Only the four failures the Mantle signer wraps keep its ValueError. Nothing is replayed through botocore and STS is not called again on the error path. * fix(rust_bridge): name the origin Rust could not connect to instead of rebuilding the bedrock URL in Python A connect failure now carries the scheme://host:port the client tried, and the host reads it for both bedrock routes rather than asking the Python config's get_complete_url for the URL Rust already sent to. * fix(bedrock_mantle): log the tools Rust shapes instead of reshaping the caller's tools in Python The Mantle configs now log their requested params with the tools shaped by Rust's invoke helpers, and Rust tells the host when a call is a Bedrock invoke call whose caller tools Python still shapes in place. The host no longer re-detects the Mantle route or its region prefix: the model id a Mantle rejection names comes from Rust too. * fix(bedrock_mantle): log and raise the model id Rust names for a Mantle call refused before sending A bedrock/mantle/ call refused before it was sent logged the model and raised it with its mantle/ prefix, where Python's handler names the model id. The host now takes the model Rust attaches to the failure for the logger and the raised error, with no route detection on the Python side. * fix(bedrock_mantle): zero-fill usage on a Mantle reply that is not a message A 200 reply that does not parse as a message, such as an error envelope, skipped the Mantle usage normalisation, so it billed no usage where Python bills zero input and output tokens. Configs now get a hook for such unchecked replies and both Mantle routes zero-fill the usage there, through a typed usage struct shared with the message path. A usage object with mistyped token counts is now refused as unbillable, like a non-object usage. * fix(bedrock_mantle): hand the agentic hooks the requested stream flag on Mantle routes The agentic loop hook read the call's params back from the wire body, which on the Mantle routes leaves out stream unless it is true. Python's hooks see the params from before its Mantle transform, stream false included. The hook now restores the requested stream flag on the two Mantle routes. * fix(bedrock_mantle): warn when a Mantle route drops a disabled thinking Both Mantle routes dropped thinking type disabled on an always-thinking model without the warning Python logs about the thinking tokens still being billed as output tokens. The shared Anthropic thinking translation now logs it when the route asks, and only the two Mantle configs ask, so other providers keep their behaviour. * fix(bedrock_mantle): build the Mantle URL with the url crate and stop copying Python on odd values Both Mantle routes now parse the base with the url crate, put the Messages route on the path and keep the caller's query string after it, where Python's string join could land the route inside the query. Odd inputs follow plain Rust rules instead of Python's quirks. A blank api_base or api_key counts as unset, an upper-case public Mantle host is sent and signed lowercased, and only a boolean true stream flag streams, so a stream string no longer waits on an SSE reply the request never asked for. A base that is not a URL is refused before sending. * test(bedrock_mantle): check the Rust Mantle route against captured Python output and drop dead Python Messages code The Rust Mantle tests no longer run Python's Messages handler beside Rust. The wire requests, signing scopes and usage Python's Mantle configs produced are captured once in a JSON fixture, and error tests check the class and status only. The Python unit tests that drove Python's Mantle Messages handler end to end are gone, keeping the URL, chat and request transform tests. Python's Mantle Messages configs lose the methods only that handler called: the environment validation, the response transform and the stream iterator, and the bedrock_mantle Messages config no longer mixes in the Mantle signer. The request transform stays because count_tokens reads its options through it. * fix(bedrock_mantle): map a Mantle route credential failure from Rust's kind instead of signing again in Python A bedrock/mantle/ call whose credentials Rust could not acquire made the host run Python's sign_request again to find the exception, which could reach STS on the error path. Rust now names the failure unavailable on both Mantle routes and the host raises botocore's NoCredentialsError, or the STS class Rust names, from a fixed list. The Bedrock invoke route keeps its replay. The GetLLMProvider wording copied from Python for a region refused while resolving bedrock_mantle/ is gone with its marker. The refusal stays a 400 BadRequestError. * refactor(bedrock_mantle): read Mantle capabilities from the Rust catalog and type the project id A Mantle call asked Python's capability probes up to three times per request. The host now reads them from the Rust catalog of the live model map through messages_route_capabilities, as the router already does, so a Mantle call makes no capability host call. aws_bedrock_project_id is a typed litellm_params field every host projects, replacing the Mantle-only passthrough projection. * refactor(bedrock_mantle): read the Mantle betas and wire body through typed structs The betas now come off the request's own anthropic_beta field instead of a serialization of the whole request, and the Mantle wire body is a typed struct that drops the version and betas, puts model and stream last and keeps stream only when it is a boolean true. * docs(bedrock_mantle): document the Mantle Messages configs and say Rust instead of native in the new tests Both Mantle transformation files get a file doc, the two config structs and the model id helper get docs, and mantle_capabilities is private now that only messages_route_capabilities composes it. The tests this port added name the Rust host's error rust_error rather than native. The Mantle wire body struct also stops tripping clippy on its dropped fields. * fix(bedrock_mantle): log the route model for a bedrock/mantle call refused before sending Python's handler logs the route model (mantle/<id>) before the Mantle config's transform refuses the call; only the raised error carries the bare model id. * fix(bedrock_mantle): name no provider and the requested model for a region refused resolving bedrock_mantle Python's get_llm_provider refuses an invalid bedrock_mantle region before any provider resolves, so its BadRequestError has llm_provider "" and the request's model. The Rust host now attaches that provider and model for the refusal. * fix(bedrock_mantle): raise botocore ProfileNotFound for an AWS profile no profile file defines Rust names a missing AWS profile as its own credential failure kind with the profile name, and the host raises botocore's ProfileNotFound for it from its fixed class list instead of NoCredentialsError. bedrock_mantle/ keeps wrapping it in the Mantle auth ValueError, as Python does. * docs(rust_bridge): mark the bedrock invoke signing replay for removal * fix(rust_bridge): build ProfileNotFound only when Rust names the profile * test(health_check): answer the Mantle Claude probes from a local server now that Rust sends them * fix(bedrock_mantle): read a region path segment from the model on the bedrock/mantle route * style(bedrock_mantle): format the region_from_model import * test(rust_bridge): cover a connect failure with no known base on the messages route A provider outside anthropic, azure_ai and bedrock with no api_base has no base to reword a connect failure against, so the host keeps Rust's text. * fix(rust_bridge): name the origin Rust dialed in a bedrock connect failure A Bedrock or Mantle connect failure reworded the caller's api_base, but Rust can send elsewhere: Mantle rebuilds a public host on https in the resolved region, and a blank api_base counts as unset. Prefer the connect origin Rust reports whenever it set one. * fix(bedrock_mantle): log and raise the model Python names on Mantle refusals A refused Mantle call logged the request model with only the provider prefix removed, so a bedrock_mantle/ region prefix stayed in the failure log (us-west-2/anthropic.claude-x), where Python's handler logs the model get_llm_provider resolves. Rust now names that model on the error as messages_logged_model. The unbillable-usage APIError names the model id Rust sent (messages_provider_model), the one the failure log carries. * test(rust_bridge): cover the refused-reply mapping to APIError 500 Rust marks a Mantle reply whose usage litellm cannot bill with messages_refused_reply, and the host raises it as litellm.APIError 500. Cover both halves: errors.rs sets the marker only for an UnbillableUsage response, and the host maps it naming the model Rust sent. * refactor(bedrock_mantle): have Rust name bedrock on a Mantle invoke bad request The host decided in Python that a bedrock_mantle refusal the Bedrock invoke transform raises as BadRequestError names llm_provider=bedrock. Rust now sets messages_provider=bedrock on that error for both Mantle routes, and the host only reads it. The raised error is unchanged. |
||
|---|---|---|
| .. | ||
| cache | ||
| chat_completions | ||
| embeddings | ||
| messages | ||
| ocr | ||
| responses | ||
| support | ||
| tokenizer | ||
| AGENTS.md | ||
| conftest.py | ||
| test_clickhouse_spend.py | ||
| test_dispatch.py | ||
| test_fork_guard.py | ||
| test_public_entries.py | ||