mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
get_cost_per_unit now delegates to the wire cost_per_unit policy pinned against executed Python, so _auto-suffixed keys fall back to their base key and _standard no longer does, matching _SERVICE_TIER_SUFFIXES; threshold detection excludes the same suffix set Python derives from its ServiceTier enum plus _batches. The two private tier_key copies in generic_input and generic_output collapse onto base_rate_selection's shared one. scripts/check_cost_test_mirrors.py requires every tests/python_*.rs file to carry a // mirrors: marker naming a real Python test under tests/ (or the fixture generator for replay files), runs in the rust CI job, and all 57 files now carry verified markers
189 lines
6.2 KiB
YAML
189 lines
6.2 KiB
YAML
name: LiteLLM Rust
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "litellm-rust/**"
|
|
- "litellm/rust_bridge/**"
|
|
- "tests/test_litellm_rust/**"
|
|
- "litellm/integrations/custom_logger.py"
|
|
- "litellm/litellm_core_utils/litellm_logging.py"
|
|
- "litellm/litellm_core_utils/logging_worker.py"
|
|
- "litellm/proxy/guardrails/**"
|
|
- "litellm/utils.py"
|
|
- "litellm/ocr/**"
|
|
- "litellm/llms/base_llm/ocr/**"
|
|
- "litellm/llms/custom_httpx/llm_http_handler.py"
|
|
- "tests/test_litellm/ocr/**"
|
|
- "tests/test_litellm/conftest.py"
|
|
- "Makefile"
|
|
- ".cargo/**"
|
|
- "pyproject.toml"
|
|
- "uv.lock"
|
|
- "rust-toolchain.toml"
|
|
- ".github/actions/setup-uv-with-retries/**"
|
|
- ".github/scripts/smoke_test_native_wheel.py"
|
|
- ".github/scripts/verify_linux_native_wheel.py"
|
|
- "tests/test_litellm/rust_bridge/native_route_wheel_test.py"
|
|
- ".github/workflows/test-rust.yml"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- litellm_internal_staging
|
|
- litellm_oss_staging
|
|
- "litellm_**"
|
|
paths:
|
|
- "litellm-rust/**"
|
|
- "litellm/rust_bridge/**"
|
|
- "tests/test_litellm_rust/**"
|
|
- "litellm/integrations/custom_logger.py"
|
|
- "litellm/litellm_core_utils/litellm_logging.py"
|
|
- "litellm/litellm_core_utils/logging_worker.py"
|
|
- "litellm/proxy/guardrails/**"
|
|
- "litellm/utils.py"
|
|
- "litellm/ocr/**"
|
|
- "litellm/llms/base_llm/ocr/**"
|
|
- "litellm/llms/custom_httpx/llm_http_handler.py"
|
|
- "tests/test_litellm/ocr/**"
|
|
- "tests/test_litellm/conftest.py"
|
|
- "Makefile"
|
|
- ".cargo/**"
|
|
- "pyproject.toml"
|
|
- "uv.lock"
|
|
- "rust-toolchain.toml"
|
|
- ".github/actions/setup-uv-with-retries/**"
|
|
- ".github/scripts/smoke_test_native_wheel.py"
|
|
- ".github/scripts/verify_linux_native_wheel.py"
|
|
- "tests/test_litellm/rust_bridge/native_route_wheel_test.py"
|
|
- ".github/workflows/test-rust.yml"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
rust-lint:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
defaults:
|
|
run:
|
|
working-directory: litellm-rust
|
|
steps:
|
|
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- run: rustup toolchain install --no-self-update
|
|
|
|
- run: cargo fmt --all --check
|
|
|
|
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
workspaces: litellm-rust
|
|
cache-on-failure: true
|
|
|
|
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
|
|
rust-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
defaults:
|
|
run:
|
|
working-directory: litellm-rust
|
|
steps:
|
|
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- uses: ./.github/actions/setup-uv-with-retries
|
|
with:
|
|
version: "0.10.9"
|
|
|
|
- name: Install Python dependencies for the bridge tests
|
|
working-directory: .
|
|
run: |
|
|
uv sync --frozen --no-install-project
|
|
|
|
- name: Cost test mirrors markers
|
|
working-directory: .
|
|
run: python3 scripts/check_cost_test_mirrors.py
|
|
echo "PYTHONPATH=$PWD/.venv/lib/$(ls .venv/lib)/site-packages" >> "$GITHUB_ENV"
|
|
|
|
- run: rustup toolchain install --no-self-update
|
|
|
|
- uses: taiki-e/install-action@d438492cf8a250514fa2d34b30bc3c0dc37c65ff # v2.87.8
|
|
with:
|
|
tool: cargo-nextest@0.9.143
|
|
|
|
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
workspaces: litellm-rust
|
|
cache-on-failure: true
|
|
|
|
- run: cargo nextest run --workspace --locked
|
|
|
|
- run: cargo test --workspace --doc --locked
|
|
|
|
- name: Test token counter feature combinations
|
|
run: |
|
|
for features in '' fast huggingface tiktoken fast,huggingface fast,tiktoken huggingface,tiktoken fast,huggingface,tiktoken; do
|
|
cargo test -p litellm-token-counter --locked --no-default-features --features "$features"
|
|
cargo check -p litellm-python-bridge --locked --no-default-features --features "abi3${features:+,$features}"
|
|
done
|
|
|
|
- name: Test secret manager feature combinations
|
|
run: |
|
|
cargo test -p litellm-auth-gcp --locked --no-default-features
|
|
for features in '' aws google hashicorp azure cyberark aws,google aws,azure google,azure aws,google,azure aws,google,cyberark aws,google,azure,cyberark aws,google,hashicorp,azure,cyberark; do
|
|
cargo test -p litellm-secrets --locked --no-default-features --features "$features"
|
|
done
|
|
|
|
rust-wheel:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- uses: ./.github/actions/setup-uv-with-retries
|
|
with:
|
|
version: "0.10.9"
|
|
|
|
- run: rustup toolchain install --no-self-update
|
|
|
|
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
workspaces: litellm-rust
|
|
cache-on-failure: true
|
|
|
|
- run: uv build --wheel --out-dir dist
|
|
|
|
- run: python .github/scripts/verify_linux_native_wheel.py dist/*.whl
|
|
env:
|
|
RELEASE_WHEEL_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- run: python tests/test_litellm/rust_bridge/native_route_wheel_test.py dist/*.whl
|
|
|
|
- name: Run pytest tests/test_litellm_rust with the compiled extension
|
|
run: make test-rust-extension
|
|
|
|
- run: >-
|
|
uv build --wheel --out-dir panic-dist
|
|
--config-setting "maturin.build-args=--features panic-test,extension-module"
|
|
|
|
- run: python .github/scripts/smoke_test_native_wheel.py panic-dist/*.whl
|