From b98c7c828e0d96e708f0f268d6dcd0637d58803e Mon Sep 17 00:00:00 2001 From: rluisr Date: Sun, 23 Aug 2026 23:59:13 +0900 Subject: [PATCH 1/2] perf(proxy): reduce Prisma client import time --- .../litellm_proxy_extras/schema.prisma | 1 + litellm/proxy/schema.prisma | 1 + schema.prisma | 1 + .../test_litellm/proxy/test_prisma_schema.py | 20 +++++++++++++++++++ 4 files changed, 23 insertions(+) create mode 100644 tests/test_litellm/proxy/test_prisma_schema.py diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index d9959677116..1828245bc6b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -5,6 +5,7 @@ datasource client { generator client { provider = "prisma-client-py" + recursive_type_depth = -1 binaryTargets = ["native", "debian-openssl-1.1.x", "debian-openssl-3.0.x", "linux-musl", "linux-musl-openssl-3.0.x"] } diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index d9959677116..1828245bc6b 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -5,6 +5,7 @@ datasource client { generator client { provider = "prisma-client-py" + recursive_type_depth = -1 binaryTargets = ["native", "debian-openssl-1.1.x", "debian-openssl-3.0.x", "linux-musl", "linux-musl-openssl-3.0.x"] } diff --git a/schema.prisma b/schema.prisma index d9959677116..1828245bc6b 100644 --- a/schema.prisma +++ b/schema.prisma @@ -5,6 +5,7 @@ datasource client { generator client { provider = "prisma-client-py" + recursive_type_depth = -1 binaryTargets = ["native", "debian-openssl-1.1.x", "debian-openssl-3.0.x", "linux-musl", "linux-musl-openssl-3.0.x"] } diff --git a/tests/test_litellm/proxy/test_prisma_schema.py b/tests/test_litellm/proxy/test_prisma_schema.py new file mode 100644 index 00000000000..1a95fa66adc --- /dev/null +++ b/tests/test_litellm/proxy/test_prisma_schema.py @@ -0,0 +1,20 @@ +from pathlib import Path +from typing import Final + +import pytest + + +REPOSITORY_ROOT: Final = Path(__file__).resolve().parents[3] +SCHEMA_PATHS: Final = ( + REPOSITORY_ROOT / "schema.prisma", + REPOSITORY_ROOT / "litellm/proxy/schema.prisma", + REPOSITORY_ROOT / "litellm-proxy-extras/litellm_proxy_extras/schema.prisma", +) + + +@pytest.mark.parametrize("schema_path", SCHEMA_PATHS) +def test_prisma_client_uses_recursive_types(schema_path: Path) -> None: + schema: Final = schema_path.read_text(encoding="utf-8") + generator_settings: Final = schema.partition("generator client {")[2].partition("}")[0] + + assert "recursive_type_depth = -1" in tuple(line.strip() for line in generator_settings.splitlines()) From 9255ac11790edf9322f085b62f21b4a39df5a7d7 Mon Sep 17 00:00:00 2001 From: rluisr Date: Mon, 24 Aug 2026 00:05:03 +0900 Subject: [PATCH 2/2] test(proxy): reject commented Prisma settings --- tests/test_litellm/proxy/test_prisma_schema.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_litellm/proxy/test_prisma_schema.py b/tests/test_litellm/proxy/test_prisma_schema.py index 1a95fa66adc..8ca9556ef92 100644 --- a/tests/test_litellm/proxy/test_prisma_schema.py +++ b/tests/test_litellm/proxy/test_prisma_schema.py @@ -1,3 +1,4 @@ +import re from pathlib import Path from typing import Final @@ -17,4 +18,8 @@ def test_prisma_client_uses_recursive_types(schema_path: Path) -> None: schema: Final = schema_path.read_text(encoding="utf-8") generator_settings: Final = schema.partition("generator client {")[2].partition("}")[0] - assert "recursive_type_depth = -1" in tuple(line.strip() for line in generator_settings.splitlines()) + assert re.search( + r"^\s*recursive_type_depth\s*=\s*-1\s*$", + generator_settings, + flags=re.MULTILINE, + )