mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
style(vector-stores): satisfy lint budgets
This commit is contained in:
parent
1a0f4aa4b2
commit
734d7c4d2f
7 changed files with 31 additions and 15 deletions
|
|
@ -57,7 +57,7 @@
|
|||
"limit": 5601
|
||||
},
|
||||
"reportMissingTypeArgument": {
|
||||
"limit": 15285
|
||||
"limit": 15284
|
||||
},
|
||||
"reportMissingTypeStubs": {
|
||||
"limit": 40
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
"limit": 0
|
||||
},
|
||||
"reportUnknownArgumentType": {
|
||||
"limit": 44360
|
||||
"limit": 44149
|
||||
},
|
||||
"reportUnknownLambdaType": {
|
||||
"limit": 109
|
||||
|
|
|
|||
|
|
@ -184,7 +184,9 @@ class _MilvusSearchOptions(BaseModel):
|
|||
def result_limit(self) -> int:
|
||||
return self.max_num_results or self.limit
|
||||
|
||||
def output_fields_with_text(self, text_field: str) -> list[str]:
|
||||
def output_fields_with_text(
|
||||
self, text_field: str
|
||||
) -> list[str]: # mutable-ok: PyMilvus requires output_fields as a list
|
||||
output_fields: Final = self.output_fields or ()
|
||||
if "*" in output_fields or text_field in output_fields:
|
||||
return list(output_fields)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ def _redact_sensitive_litellm_params(litellm_params: Any, _depth: int = 0) -> An
|
|||
|
||||
|
||||
def _validated_litellm_params(
|
||||
litellm_params: dict[str, Any],
|
||||
litellm_params: dict[str, Any], # mutable-ok: provider parameters arrive as a mutable request object
|
||||
) -> dict[str, Any]: # mutable-ok: persistence validation returns a serializable parameter dict
|
||||
from litellm.types.router import GenericLiteLLMParams
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def normalize_vector_store_provider(custom_llm_provider: object) -> str | None:
|
|||
try:
|
||||
_, provider, _, _ = litellm.get_llm_provider(model=custom_llm_provider)
|
||||
return provider
|
||||
except Exception:
|
||||
except Exception: # noqa: BLE001 # provider parsing failures fall back to the explicit prefix
|
||||
return custom_llm_provider.split("/", 1)[0]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@
|
|||
"limit": 117
|
||||
},
|
||||
"TQ008": {
|
||||
"limit": 11003
|
||||
"limit": 11000
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -686,8 +686,12 @@ def test_user_supplied_milvus_grpc_connection_requires_proxy_admin():
|
|||
@pytest.mark.asyncio
|
||||
async def test_unmanaged_milvus_grpc_connection_requires_admin_after_provider_normalization(provider):
|
||||
with (
|
||||
patch.object(litellm, "vector_store_registry", None),
|
||||
patch("litellm.proxy.proxy_server.prisma_client", None),
|
||||
patch.object( # test-quality-ok: the endpoint reads the process-wide registry directly
|
||||
litellm, "vector_store_registry", None
|
||||
),
|
||||
patch( # test-quality-ok: the endpoint reads the proxy database singleton directly
|
||||
"litellm.proxy.proxy_server.prisma_client", None
|
||||
),
|
||||
pytest.raises(HTTPException) as exc_info,
|
||||
):
|
||||
await _update_request_data_with_litellm_managed_vector_store_registry(
|
||||
|
|
@ -720,7 +724,9 @@ async def test_managed_milvus_uses_only_persisted_connection_for_non_admin():
|
|||
mock_registry = MagicMock()
|
||||
mock_registry.get_litellm_managed_vector_store_from_registry.return_value = managed_vector_store
|
||||
|
||||
with patch.object(litellm, "vector_store_registry", mock_registry):
|
||||
with patch.object( # test-quality-ok: the helper reads the process-wide registry directly
|
||||
litellm, "vector_store_registry", mock_registry
|
||||
):
|
||||
result = await _update_request_data_with_litellm_managed_vector_store_registry(
|
||||
data={
|
||||
"query": "safe",
|
||||
|
|
@ -789,7 +795,9 @@ async def test_config_loaded_milvus_grpc_connection_is_trusted():
|
|||
]
|
||||
)
|
||||
|
||||
with patch.object(litellm, "vector_store_registry", registry):
|
||||
with patch.object( # test-quality-ok: config trust is established by the process-wide registry
|
||||
litellm, "vector_store_registry", registry
|
||||
):
|
||||
result = await _update_request_data_with_litellm_managed_vector_store_registry(
|
||||
data={"query": "allowed"},
|
||||
vector_store_id="configured",
|
||||
|
|
@ -884,7 +892,9 @@ async def test_config_vector_store_id_cannot_be_created_in_database():
|
|||
prisma_client = MagicMock()
|
||||
|
||||
with (
|
||||
patch.object(litellm, "vector_store_registry", registry),
|
||||
patch.object( # test-quality-ok: create checks collisions against the process-wide registry
|
||||
litellm, "vector_store_registry", registry
|
||||
),
|
||||
pytest.raises(HTTPException, match="defined in proxy configuration") as exc_info,
|
||||
):
|
||||
await create_vector_store_in_db(
|
||||
|
|
@ -908,9 +918,13 @@ async def test_config_vector_store_id_cannot_be_updated_in_database():
|
|||
prisma_client = MagicMock()
|
||||
|
||||
with (
|
||||
patch.object(litellm, "vector_store_registry", registry),
|
||||
patch("litellm.proxy.proxy_server.prisma_client", prisma_client),
|
||||
patch(
|
||||
patch.object( # test-quality-ok: update checks collisions against the process-wide registry
|
||||
litellm, "vector_store_registry", registry
|
||||
),
|
||||
patch( # test-quality-ok: the endpoint reads the proxy database singleton directly
|
||||
"litellm.proxy.proxy_server.prisma_client", prisma_client
|
||||
),
|
||||
patch( # test-quality-ok: feature entitlement is outside the collision behavior
|
||||
"litellm.proxy.vector_store_endpoints.management_endpoints.check_feature_access_for_user",
|
||||
new=AsyncMock(),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"LIT001": {
|
||||
"limit": 22328
|
||||
"limit": 22327
|
||||
},
|
||||
"LIT002": {
|
||||
"limit": 26748
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue