mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-10 08:28:25 +00:00
* feat(rust-bridge): scope catalog rules with a contextvar Co-Authored-By: Yujong Lee <yujong@berri.ai> * test(rust-bridge): select native integration routes with scoped rules Co-Authored-By: Yujong Lee <yujong@berri.ai> * test(rust-bridge): run the Rust extension suite without LITELLM_RUST Co-Authored-By: Yujong Lee <yujong@berri.ai> * test(rust-bridge): use scoped catalog rules in dispatch tests Co-Authored-By: Yujong Lee <yujong@berri.ai> * refactor(rust-bridge): keep catalog rules a static global and override them once per test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
847 B
Python
26 lines
847 B
Python
from typing import Final
|
|
|
|
import litellm
|
|
from tests.test_litellm_rust.messages.data import MESSAGES, MESSAGES_MODEL
|
|
from tests.test_litellm_rust.support.recording_server import RecordingServer
|
|
from tests.test_litellm_rust.support.routing import call_public
|
|
|
|
|
|
def _error(kind: str) -> dict[str, object]:
|
|
return {"type": "error", "error": {"type": kind, "message": kind}}
|
|
|
|
|
|
REQUEST: Final = {"model": MESSAGES_MODEL, "messages": list(MESSAGES), "max_tokens": 32}
|
|
BAD_REQUEST: Final = _error("invalid_request_error")
|
|
RATE_LIMITED: Final = _error("rate_limit_error")
|
|
|
|
|
|
async def call(server: RecordingServer, *, asynchronous: bool = True, **kwargs: object) -> object:
|
|
return await call_public(
|
|
litellm.completion,
|
|
litellm.acompletion,
|
|
REQUEST,
|
|
server,
|
|
asynchronous=asynchronous,
|
|
**kwargs,
|
|
)
|