litellm/litellm-rust/crates/config
Yujong Lee 75d779c1f4 feat(config): share Rust parsing and includes with Python
Preserve raw documents and project typed native settings separately while sharing include traversal, merging and path warnings with existing Python loaders

Keep source access, settings precedence and lifecycle orchestration in Python, with PyYAML compatibility for unsupported values and public errors

Validation passes make check, strict workspace clippy, 497 Python tests, 85 config tests and a live proxy model-list smoke test. The full Rust suite passes 5683 tests and reproduces two existing logging failures from the unchanged default branch
2026-10-19 14:53:58 -07:00
..
src feat(config): share Rust parsing and includes with Python 2026-10-19 14:53:58 -07:00
tests feat(rust): one LitellmParams type for a config and a caller (#45642) 2026-10-09 16:29:45 -07:00
Cargo.toml feat(config): share Rust parsing and includes with Python 2026-10-19 14:53:58 -07:00
README.md feat(config): share Rust parsing and includes with Python 2026-10-19 14:53:58 -07:00

Shared proxy config

Document::from_yaml parses a config without filling defaults, resolving secrets or discarding extension fields. Document::typed projects it into Config for native consumers. Config::from_yaml and Config::load use the same document parser

The parser follows the existing Python loader's YAML 1.1 scalar behavior. For example, on is a boolean, 012 is octal, and 1e3 stays a string. Mapping order and duplicate-key replacement are preserved. Debug output excludes document values

includes owns the breadth-first include queue, duplicate detection, list extension and replacement of other values. Local paths resolve next to the declaring config, with the existing root-relative fallback and ambiguity warnings. File identity uses normalized absolute paths, matching Python rather than resolving symlinks

The Python bridge adapts this core behind the existing proxy and bucket loaders. Python retains source access, database and runtime settings precedence, secret resolution and lifecycle effects. Nested Python values pass through the include merge without serialization

Python falls back to PyYAML for aliases, merge keys, explicit tags, timestamps, binary values, sets, non-string mapping keys and integers outside the native numeric range. This preserves Python object identity, types and YAML exception details. Native parsing accepts nonrecursive aliases with bounded expansion, but cannot project every Python YAML value yet. A missing extension uses the existing Python compatibility implementation

This crate does not implement a second settings-precedence engine. Native request execution consumes typed configuration loaded at startup, without calling Python to parse it per request