mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
Merge 75fbc4b481 into 7bc80994b7
This commit is contained in:
commit
b4b4bad2c8
3 changed files with 24 additions and 1 deletions
|
|
@ -74,6 +74,7 @@ if TYPE_CHECKING:
|
|||
vertex_llm_base: Final = VertexBase()
|
||||
router: Final = APIRouter()
|
||||
openai_passthrough_router: Final = APIRouter()
|
||||
anthropic_passthrough_router: Final = APIRouter()
|
||||
default_vertex_config: Final = None
|
||||
|
||||
passthrough_endpoint_router: Final = PassthroughEndpointRouter()
|
||||
|
|
@ -605,7 +606,7 @@ async def is_streaming_request_fn(request: Request) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
@router.api_route(
|
||||
@anthropic_passthrough_router.api_route(
|
||||
"/anthropic/{endpoint:path}",
|
||||
methods=["GET", "POST", "PUT", "DELETE", "PATCH"],
|
||||
tags=["Anthropic Pass-through", "pass-through"],
|
||||
|
|
|
|||
|
|
@ -574,6 +574,7 @@ from litellm.proxy.openai_files_endpoints.files_endpoints import (
|
|||
set_files_config,
|
||||
)
|
||||
from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import (
|
||||
anthropic_passthrough_router,
|
||||
openai_passthrough_router,
|
||||
passthrough_endpoint_router,
|
||||
vertex_ai_live_websocket_passthrough,
|
||||
|
|
@ -17498,6 +17499,7 @@ app.include_router(image_router)
|
|||
app.include_router(fine_tuning_router)
|
||||
app.include_router(credential_router)
|
||||
app.include_router(openai_passthrough_router)
|
||||
app.include_router(anthropic_passthrough_router)
|
||||
app.include_router(batches_router)
|
||||
app.include_router(openai_files_router)
|
||||
app.include_router(llm_passthrough_router)
|
||||
|
|
|
|||
|
|
@ -3067,6 +3067,26 @@ def test_native_provider_routes_are_unchanged(method, path, expected_name):
|
|||
assert _resolve_route_name(method, path) == expected_name
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"method, path",
|
||||
[
|
||||
("POST", "/anthropic/v1/files"),
|
||||
("GET", "/anthropic/v1/files"),
|
||||
("GET", "/anthropic/v1/files/file-abc123"),
|
||||
("DELETE", "/anthropic/v1/files/file-abc123"),
|
||||
("POST", "/anthropic/v1/batches"),
|
||||
("POST", "/anthropic/v1/messages"),
|
||||
],
|
||||
)
|
||||
def test_anthropic_passthrough_prefix_wins_over_native_provider_routes(method, path):
|
||||
"""
|
||||
Anthropic's Files API has no `purpose` field and no `files_settings` config,
|
||||
so the native /{provider}/v1/files and /{provider}/v1/batches routes must never
|
||||
capture /anthropic/... with provider="anthropic".
|
||||
"""
|
||||
assert _resolve_route_name(method, path) == "anthropic_proxy_route"
|
||||
|
||||
|
||||
class TestCursorProxyRoute:
|
||||
"""Tests for the Cursor Cloud Agents pass-through route."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue