mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
fix(vllm): stop requiring an api key to list vllm models
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
d90200003b
commit
2ed624550d
2 changed files with 1 additions and 12 deletions
|
|
@ -47,9 +47,7 @@ class VLLMModelInfo(BaseLLMModelInfo):
|
|||
def get_api_base(api_base: str | None = None) -> str | None:
|
||||
api_base = api_base or get_secret_str("VLLM_API_BASE")
|
||||
if api_base is None:
|
||||
raise ValueError(
|
||||
"VLLM_API_BASE is not set. Please set the environment variable, to use VLLM's pass-through - `{LITELLM_API_BASE}/vllm/{endpoint}`."
|
||||
)
|
||||
raise ValueError("VLLM_API_BASE is not set.")
|
||||
return api_base
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -62,12 +60,7 @@ class VLLMModelInfo(BaseLLMModelInfo):
|
|||
|
||||
def get_models(self, api_key: str | None = None, api_base: str | None = None) -> list[str]:
|
||||
api_base = VLLMModelInfo.get_api_base(api_base)
|
||||
api_key = VLLMModelInfo.get_api_key(api_key)
|
||||
endpoint: Final = "/v1/models"
|
||||
if api_base is None or api_key is None:
|
||||
raise ValueError(
|
||||
"VLLM_API_BASE or VLLM_API_KEY is not set. Please set the environment variable, to query VLLM's `/models` endpoint."
|
||||
)
|
||||
|
||||
url: Final = _add_path_to_api_base(api_base, endpoint)
|
||||
response: Final = litellm.module_level_client.get(
|
||||
|
|
|
|||
|
|
@ -449,10 +449,6 @@ def test_get_known_models_from_wildcard_hosted_vllm_uses_provider_endpoint():
|
|||
litellm.check_provider_endpoint = True # test-quality-ok: required to exercise provider endpoint discovery
|
||||
with (
|
||||
patch("litellm.module_level_client.get", return_value=response), # test-quality-ok: required HTTP boundary
|
||||
patch( # test-quality-ok: VLLM model listing has no injectable API key seam
|
||||
"litellm.llms.vllm.common_utils.VLLMModelInfo.get_api_key",
|
||||
return_value="test-key",
|
||||
),
|
||||
):
|
||||
result = get_known_models_from_wildcard(
|
||||
"hosted_vllm/*",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue