Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llama_stack/providers/remote/inference/vllm/vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ async def register_model(self, model: Model) -> Model:
except ValueError:
pass # Ignore statically unknown model, will check live listing
try:
res = await self.client.models.list()
res = self.client.models.list()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the rationale for removing await here?
Wouldnt this break at the below line [m.id async for m in res] where res is expected to be a async iterator? Without await, res will be a co-routine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsyncOpenAI.models.list is a sync method that returns an async generator

being sync, it cannot be awaited. the resulting async generator needs async for.

except APIConnectionError as e:
raise ValueError(
f"Failed to connect to vLLM at {self.config.url}. Please check if vLLM is running and accessible at that URL."
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/providers/inference/test_remote_vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

@pytest.fixture(scope="module")
def mock_openai_models_list():
with patch("openai.resources.models.AsyncModels.list", new_callable=AsyncMock) as mock_list:
with patch("openai.resources.models.AsyncModels.list") as mock_list:
yield mock_list


Expand Down
Loading