Commit graph

118 commits

Author SHA1 Message Date
Yujong Lee
2a3ae253d4 refactor(rust): fold disk arms into shared match patterns
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 22:14:22 +00:00
Yujong Lee
f7b96c9ced Merge origin/main into litellm_native_disk_cache
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 22:13:09 +00:00
Yujong Lee
63c16fe5ac Merge origin/main into litellm_native_disk_cache
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:47:35 +00:00
Yujong Lee
bc641f01ae Merge remote-tracking branch 'origin/main' into litellm_native_azure_blob_cache 2026-09-21 21:47:19 +00:00
Yujong Lee
f43f9012f1 fix(rust): handle disk cache topology
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:44:24 +00:00
Yujong Lee
2f54f6078d chore: merge main into litellm_native_azure_blob_cache
Combines the Redis cluster bridge changes with the Azure Blob variant and
keeps account URL query parameters when building the container URL

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:43:08 +00:00
Yujong Lee
98e9e8c602 Merge origin/main into litellm_native_disk_cache
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:42:10 +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
5acfcfa4fe feat(rust): native Azure Blob response cache backend
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 21:00:48 +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
94b8bf7fd6 feat(rust): add native disk cache backend
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-21 20:37:26 +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