Commit graph

115 commits

Author SHA1 Message Date
Yujong Lee
ff2ca804b5 fix(python-bridge): preserve Qdrant facade dispatch after rebase
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:47:56 +00:00
Yujong Lee
acbec828db fix(python-bridge): fall back to Python when qdrant_api_key changes after binding
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:47:56 +00:00
Yujong Lee
632c95f87e fix(python-bridge): make the Qdrant config tests tolerate an unset OPENAI_API_KEY
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:47:56 +00:00
Yujong Lee
fbaa535657 fix(python-bridge): ignore class data defaults in the facade guard
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:47:56 +00:00
Yujong Lee
93e9836524 feat(python-bridge): serve QdrantSemanticCache natively
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:47:56 +00:00
Yujong Lee
fc3844e991 refactor(cache-response): generalize ResponseCache over the backend context
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:47:56 +00:00
Yujong Lee
9c48e137dc fix(rust): preserve HTTP host and TLS error context
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:32:33 +00:00
Yujong Lee
5aeb367d2a fix(rust): preserve Python settings coercion at the native boundary 2026-09-21 21:32:33 +00:00
Yujong Lee
52216df1ff fix(rust): preserve structured conversion semantics 2026-09-21 21:32:33 +00:00
Yujong Lee
83d4ce05c9 feat(rust-cache): serve RedisClusterCache natively as a Redis topology
Extend cache-redis so RedisTopology::Cluster routes single-key commands by
hash slot, groups pipelines by slot while keeping reply order, scans and
scoped-flushes every primary, and fans admin commands out to all nodes.
The bridge projects RedisClusterCache startup_nodes into the typed topology,
accepts the exact RedisClusterCache identity, guards nodes_manager state,
and falls back to Python for anything it cannot project.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 20:49:21 +00:00
Yujong Lee
991108cc48 refactor(rust): align cache foundation with Python backends 2026-09-21 12:50:21 -07:00
Yujong Lee
efcafa7f12 fix(rust): invalidate changed Redis pool settings 2026-09-21 12:30:17 -07:00
Yujong Lee
14febcc878 fix(rust): shrink cache configuration bridge 2026-09-21 12:22:18 -07:00
Yujong Lee
59dbbe5ce7 fix(cache): outline Python configuration extraction 2026-09-21 12:10:06 -07:00
Yujong Lee
cda8904382 fix(cache): keep native wheel within size budget 2026-09-21 12:03:13 -07:00
Yujong Lee
a7bc8e373e feat(cache): project Python backend configuration 2026-09-21 11:56:04 -07:00
Yujong Lee
22995d1575 fix(cache): remove redundant source comments 2026-09-21 11:23:47 -07:00
Yujong Lee
1b6b704ddd refactor(cache): keep native foundation isolated 2026-09-21 11:15:44 -07:00
Yujong Lee
595711829a wip 2026-09-21 10:30:42 -07:00
Yujong Lee
ef14fdaf33 fix(cache): harden native foundation parity 2026-09-21 09:53:41 -07:00
Yujong Lee
da402b8aee fix(cache): preserve batch callback contracts 2026-09-21 08:27:17 -07:00
Yujong Lee
cc8cadebb4 fix(cache): close native parity gaps 2026-09-21 07:56:20 -07:00
Yujong Lee
0c3a0a2089 refactor(cache): separate response policy and host selection 2026-09-20 21:11:48 -07:00
Yujong Lee
081c93908f feat(cache): add native response cache and Python binding foundations 2026-09-20 20:55:45 -07:00
Yujong Lee
831810248a refactor(rust): keep the Python token counter on the fast backend
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-20 21:49:39 +00:00
Yujong Lee
a619b765fc refactor(rust): simplify tokenizer bridge features
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-20 21:25:19 +00:00
Yujong Lee
84c26978a3 refactor(rust): split token counter backends 2026-09-20 14:10:31 -07:00
Yujong Lee
ad8ac449fc style(rust): format renamed callback adapter
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-19 23:08:37 +00:00
Yujong Lee
df84fef96e refactor(rust): rename legacy callback adapter crate
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-19 23:06:26 +00:00
yujonglee
d675c1285b
Merge pull request #41987 from BerriAI/litellm_rust_fork_safety
fix(rust): refuse native routes in processes forked after the runtime started
2026-09-19 13:47:54 -07:00
Yujong Lee
752647d146 wip 2026-09-19 10:41:41 -07:00
Yujong Lee
bb44fe5292 wip 2026-09-19 10:36:59 -07:00
yujonglee
bd82d73ca1
Merge pull request #41981 from BerriAI/litellm_rust_typed_pyo3
refactor(rust): use typed pyo3 APIs instead of getattr/import strings
2026-09-19 10:09:34 -07:00
Yujong Lee
619a19b8a2 refactor(rust): use typed pyo3 APIs instead of getattr/import strings
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-19 16:46:34 +00:00
Yujong Lee
c404bed9f0 feat(rust): add Amazon Textract to litellm.ocr and sign provider requests after host hooks
Add an aws_textract OCR provider on the Rust route, with no Python path. The
detect-document-text model returns plain lines and analyze-document renders
layout and tables as markdown. Both use Textract's synchronous API, so a
multi-page PDF or TIFF is rejected with an error that names the single-page
limit. A call with no region fails instead of falling back to Bedrock's default

SigV4 covers the request body, and host hooks can rewrite that body before it
is sent. litellm-http now has OutboundRequest, which serializes the body once,
shows those bytes to a RequestSigner and is the only thing a route can send.
Chat, audio transcription and OCR build it after their hooks ran, so a callback
that redacts the body still produces a valid Bedrock or Textract signature

ChatCompletionsAuth and AudioTranscriptionAuth are replaced by
litellm_auth::RequestAuth, and one helper in core turns it into a signed or
unsigned request. Audio transcription now signs only the AWS header set and
rejects a forwarded header that SigV4 computes, the same as chat

The OCR catalog routes aws_textract as Rust required, and the dispatch context
reads the provider from the model prefix so a provider scoped rule can match
2026-09-19 09:11:52 -07:00
yujonglee
362be56bb0
Merge pull request #41969 from BerriAI/litellm_rust_settings_layers
refactor(rust): centralize layered settings resolution
2026-09-19 09:00:19 -07:00
Yujong Lee
1669213eb5 fix(rust): read OCR secrets from the process environment and decline when a secret manager is readable
The OCR route called back into Python's get_secret_str for every env
fallback. With no secret manager configured that is os.environ behind a GIL
hop, and with one configured it blocked a tokio worker on vault I/O and also
sent the Azure and GCP identity variables, which Python reads with os.getenv,
to the vault. The other Rust routes already read the process environment.

Read the process environment here too. When litellm would read secrets from
a secret manager, decline the Rust route so the Python route serves the call
with the vault-backed keys
2026-09-19 08:32:46 -07:00
Yujong Lee
1ee4b62e9c fix(rust): honor vertex_project, vertex_location and enable_azure_ad_token_refresh globals
Python resolves the Vertex project and location as call params, then the
litellm.vertex_project / litellm.vertex_location globals, then env, and
Azure AD token refresh from litellm.enable_azure_ad_token_refresh alone.
Native OCR skipped the globals, so a config.yaml litellm_settings value
silently fell through to the credential's project and us-central1, and a
managed identity setup without an API key failed. The bridge now reads
them through a provider_defaults settings group into OcrSettings, and
VertexConfig / AzureAuthInputs slot them in at Python's precedence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 21:01:37 -07:00
Yujong Lee
0d76359dc9 fix(rust): resolve OCR provider env fallbacks through the secret manager
Python reads every provider credential fallback (MISTRAL_API_KEY,
AZURE_AI_API_KEY, AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT, Azure AD and
Vertex env, ...) through get_secret_str, which consults the configured
key_management_system before os.environ. Native OCR read std::env
directly, so a key held only in the vault went missing and a stale env
copy silently won. OcrClient now carries an injected secret Lookup that
the connection exposes to providers and auth crates; the bridge backs it
with settings.secret -> get_secret_str, pure Rust keeps the process env.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 20:57:24 -07:00
Yujong Lee
c0705f31b4 fix(rust): read OCR env-backed constants instead of hardcoding their defaults
Native OCR hardcoded the default of five Python constants that come from
env vars, so an operator setting them saw no effect:
REQUEST_TIMEOUT (Rust used 600s, Python 6000s), MAX_IMAGE_URL_DOWNLOAD_SIZE_MB
(0 disables document downloads), AZURE_OPERATION_POLLING_TIMEOUT,
AZURE_DOCUMENT_INTELLIGENCE_API_VERSION and
AZURE_DOCUMENT_INTELLIGENCE_DEFAULT_DPI. OcrSettings reads them through
Lookup with Python's parsing, the bridge builds it per call and OcrClient
carries it into the connection. A zero per-call timeout now falls back to
REQUEST_TIMEOUT, matching `timeout or request_timeout`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 20:51:55 -07:00
Yujong Lee
d77c144c6c refactor(rust): split custom_httpx into litellm-http and the OCR handler
custom_httpx mirrored a Python module that mixes transport plumbing with
OCR orchestration. The transport half (media fetcher, transport errors,
request and header helpers) now lives in litellm-http next to the pool,
TLS, proxies and settings, and the OCR request handler moves to
base_llm/ocr/handler.rs. Drops the unused deserialize_optional_param and
stale dead_code allows.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 20:46:36 -07:00
yujonglee
1c432dbc5f
Merge pull request #41921 from BerriAI/litellm_agents_md_consolidation
chore: consolidate CLAUDE.md into AGENTS.md
2026-09-18 20:40:33 -07:00
Yujong Lee
caf37c8b6f refactor(rust): share settings lookup and layer merge through core-utils
Settings sources beyond HTTP (media fetch, Azure Document Intelligence,
Vertex, timeouts) need the same env lookup and precedence merge, so move
them out of litellm-http into core_utils::settings. Lookup readers name the
Python idiom they mirror: get keeps a present empty value like
os.getenv(X, fallback), truthy drops it like an `or` chain, enabled only
switches on for "true". SSL_CERT_FILE now reads through truthy, matching
Python's `if ssl_cert_file and ...` check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 20:36:07 -07:00
Yujong Lee
bae4f22d3a refactor(rust): merge http settings from per-source layers
Each source (per-call kwargs, environment variables, the Python module) now
builds an HttpSettingsLayer, and HttpSettings::from_layers merges them with
explicit precedence. The aiohttp and httpx proxy-env rule is resolved once in
the merge, so HttpSettings carries a single trust_proxy_env flag
2026-09-18 19:53:14 -07:00
Yujong Lee
80dbb2a28a refactor(rust): resolve the http client config through From and TryFrom
HttpClientConfig::resolve becomes From<&HttpSettings> for Resolution and client_builder becomes TryFrom<&HttpClientConfig> for reqwest::ClientBuilder, matching the rustls conversion. The verify decision moves into From<&HttpSettings> for Verify, and the proxy environment rule moves next to its flags as HttpSettings::trusts_proxy_env. The curve and cipher results are read with transpose and a default selection, which removes the tuple destructuring
2026-09-18 19:48:34 -07:00
Yujong Lee
51010ea486 feat(rust): serve every gateway HTTP setting natively instead of declining to Python
litellm-http now builds the rustls config itself, so one route-neutral place covers roots, the client certificate, ALPN, ssl_ecdh_curve and ssl_security_level. A curve picks the single key exchange group. A cipher string restricts the TLS 1.2 suites it names, and entries rustls cannot express, such as @SECLEVEL=1, are logged once and skipped.

user_url_validation and user_url_allowed_hosts are applied by the media fetcher. Document downloads honor the environment proxy whenever provider calls do, keeping the per-hop address check, and stay on the pinned resolver when no proxy applies.

AIOHTTP_SO_KEEPALIVE, AIOHTTP_TCP_KEEPIDLE, AIOHTTP_TCP_KEEPINTVL, AIOHTTP_TCP_KEEPCNT and AIOHTTP_KEEPALIVE_TIMEOUT map onto the client. A client= argument and a live SSLContext are ignored
2026-09-18 19:39:07 -07:00
Yujong Lee
bf7d1c0733 chore: consolidate CLAUDE.md into AGENTS.md
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-19 02:30:35 +00:00
Yujong Lee
c635c35b3d fix(rust): keep native OCR on the proxy by declining only a supplied client
The proxy attaches its shared aiohttp session to every request as shared_session, so declining on it sent every proxy OCR call to Python, which never uses that session for OCR. aclient_session is a litellm global and never a call argument, so that check could not match. The proxy-shaped lifecycle test now asserts the call was served by Rust
2026-09-18 18:47:36 -07:00
Yujong Lee
157fa58947 fix(rust): leave calls with a custom URL policy on the Python route
litellm.user_url_validation and litellm.user_url_allowed_hosts are only implemented by the Python document fetcher, so an allowlisted internal document was rejected by the Rust route's network policy. The bridge now declines when either is changed from its default
2026-09-18 18:09:14 -07:00
Yujong Lee
8d2476465f fix(rust): honor environment proxies by default and name the cause in transport errors
Python's aiohttp transport reads HTTP(S)_PROXY on every request unless disable_aiohttp_trust_env is set, so the Rust clients now do the same instead of requiring aiohttp_trust_env. Transport error messages include reqwest's source chain, so a rejected certificate or refused connection is no longer reported as just 'error sending request'
2026-09-18 17:58:07 -07:00