litellm/tests/rust-python-harness/strategies/e2e_parity/__init__.py
Nate Armstrong 5e08cb0e63
test(messages): add rust vs python messages parity characterization suite (#49610)
Runs every case through the Python /v1/messages path and the Rust path against one recording upstream and compares dispatch, upstream request, outcome, hidden params, standard logging fields and callback kwargs. Known Rust differences are strict xfails tagged with their inventory ID.
2026-11-02 21:02:52 -08:00

96 lines
2.9 KiB
Python

from pathlib import Path
from typing import Final
from ...shared.reporting.models import SURFACES
from ...shared.reporting.strategy import (
CaseDefinition,
ModuleCaseSpec,
NotImplementedCaseSpec,
StrategyDefinition,
)
from .reporting import render_e2e_results
from .runner import run_e2e_cases
CASES: Final[tuple[CaseDefinition, ...]] = (
CaseDefinition(
"ocr",
NotImplementedCaseSpec(reason="OCR has no Python implementation left to compare against."),
surface="sdk",
),
CaseDefinition(
"messages",
NotImplementedCaseSpec(
reason="Parity runs as the pytest suite in sdk/messages/test_native_parity.py, not as a runner case."
),
surface="sdk",
),
CaseDefinition(
"responses",
NotImplementedCaseSpec(
reason="Bridge unit tests exist, but no standalone end-to-end parity case is registered."
),
surface="sdk",
),
CaseDefinition(
"count_tokens",
NotImplementedCaseSpec(reason="No Rust count_tokens parity test is present yet."),
surface="sdk",
),
CaseDefinition(
"chat_completions",
NotImplementedCaseSpec(
reason="Bridge unit tests exist, but no standalone end-to-end parity case is registered."
),
surface="sdk",
),
CaseDefinition(
"transcription",
NotImplementedCaseSpec(
reason="Bridge unit tests exist, but no standalone end-to-end parity case is registered."
),
surface="sdk",
),
CaseDefinition(
"ocr",
NotImplementedCaseSpec(reason="No gateway end-to-end OCR parity case is registered."),
surface="gateway",
),
CaseDefinition(
"messages",
NotImplementedCaseSpec(reason="No gateway end-to-end Messages parity case is registered."),
surface="gateway",
),
CaseDefinition(
"responses",
NotImplementedCaseSpec(reason="No gateway end-to-end Responses parity case is registered."),
surface="gateway",
),
CaseDefinition(
"count_tokens",
NotImplementedCaseSpec(reason="No gateway end-to-end token-count parity case is registered."),
surface="gateway",
),
CaseDefinition(
"chat_completions",
NotImplementedCaseSpec(reason="No gateway end-to-end chat parity case is registered."),
surface="gateway",
),
CaseDefinition(
"transcription",
NotImplementedCaseSpec(reason="No gateway end-to-end transcription parity case is registered."),
surface="gateway",
),
)
STRATEGY: Final = StrategyDefinition(
id="e2e_parity",
order=10,
label="End-to-end parity",
description="Compare observable Python and Rust behavior over generated and recorded inputs.",
directory=Path(__file__).parent,
runnable_spec=ModuleCaseSpec,
cases=CASES,
run=run_e2e_cases,
render=render_e2e_results,
surfaces=SURFACES,
)