Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Merge remote-tracking branch 'origin/main' into litellm_vllm_batch_runner

mateo-berri1aca37e513e6
diff --cc tests/test_litellm/proxy/openai_files_endpoint/test_files_common_utils.py
index b7e3088ff01,ef8af7bdbd3..50768e48d43
--- a/tests/test_litellm/proxy/openai_files_endpoint/test_files_common_utils.py
+++ b/tests/test_litellm/proxy/openai_files_endpoint/test_files_common_utils.py
@@@ -3,14 -4,34 +4,34 @@@ from unittest.mock import AsyncMock, Ma
import pytest
--
from litellm.proxy.openai_files_endpoints.common_utils import (
apply_unified_file_ids,
+ get_credentials_for_model,
+ is_litellm_executed_batch,
map_raw_file_ids_to_unified,
)
+ from litellm.proxy.route_llm_request import ProxyModelNotFoundError
+ from litellm.proxy.utils import handle_exception_on_proxy
from litellm.types.utils import LiteLLMBatch
+ _RAW_MODEL_WITH_PROMPT: Final = "opus-4.6 Please summarize my medical records\nPatient has diabetes"
+
+
+ def test_get_credentials_for_model_rejects_an_unknown_model_without_persisting_the_raw_model():
+ llm_router: Final = MagicMock()
+ llm_router.get_deployment_credentials_with_provider.return_value = None
+
+ with pytest.raises(ProxyModelNotFoundError) as raised:
+ get_credentials_for_model(
+ llm_router=llm_router, model_id=_RAW_MODEL_WITH_PROMPT, operation_context="file upload"
+ )
+
+ assert (raised.value.status_code, handle_exception_on_proxy(raised.value).code) == (400, "400")
+ assert _RAW_MODEL_WITH_PROMPT in raised.value.detail["error"]
+ assert raised.value.retryable_with_model_read_through is False
+ assert raised.value.spend_log_error_message.startswith("file upload: ")
+ assert "medical records" not in raised.value.spend_log_error_message
+
def _batch(input_file_id, output_file_id, error_file_id) -> LiteLLMBatch:
return LiteLLMBatch(