mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-13 04:22:35 +00:00
Review, reverse the conditional on api_token_presence
This commit is contained in:
parent
f20eb57bef
commit
24c6b01d16
1 changed files with 2 additions and 6 deletions
|
|
@ -79,18 +79,14 @@ class VLLMInferenceAdapter(OpenAIMixin):
|
||||||
|
|
||||||
async def check_model_availability(self, model: str) -> bool:
|
async def check_model_availability(self, model: str) -> bool:
|
||||||
"""
|
"""
|
||||||
Check model availability only when api_token is configured.
|
|
||||||
Skip the check when running without authentication.
|
Skip the check when running without authentication.
|
||||||
"""
|
"""
|
||||||
if self.config.api_token:
|
if not self.config.api_token:
|
||||||
# If we have a token, perform the normal availability check
|
|
||||||
try:
|
try:
|
||||||
return model in [m.id async for m in self.client.models.list()]
|
return model in [m.id async for m in self.client.models.list()]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# If listing models fails, log the error but allow the model
|
|
||||||
log.warning(f"Failed to check model availability: {e}")
|
log.warning(f"Failed to check model availability: {e}")
|
||||||
return True
|
raise ValueError(f"Failed to check model availability: {e}") from e
|
||||||
# Without a token, skip the check to avoid OAuth redirects
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def openai_chat_completion(
|
async def openai_chat_completion(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue