fix review around /models api call

This commit is contained in:
Sumit Jaiswal 2025-05-30 16:14:31 +05:30
parent 6a96b6c264
commit 9c42598aee
No known key found for this signature in database
GPG key ID: A4604B39D64D6AEC

View file

@ -312,12 +312,8 @@ class VLLMInferenceAdapter(Inference, ModelsProtocolPrivate):
HealthResponse: A dictionary containing the health status.
"""
try:
headers = {}
client = self._create_client() if self.client is None else self.client
if client.api_key:
headers["Authorization"] = f"Bearer {client.api_key}"
models_url = f"{client.base_url}models"
requests.get(models_url, headers=headers, timeout=10)
client.models.list() # Ensure the client is initialized
return HealthResponse(
status=HealthStatus.OK
)