We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bbd912d commit 6f8024fCopy full SHA for 6f8024f
1 file changed
python/copilot/client.py
@@ -923,13 +923,16 @@ async def list_models(self) -> list["ModelInfo"]:
923
if self._models_cache is not None:
924
return list(self._models_cache) # Return a copy to prevent cache mutation
925
926
+ models: list[ModelInfo]
927
if self._on_list_models:
928
# Use custom handler instead of CLI RPC
929
result = self._on_list_models()
930
+ # cast needed: inspect.isawaitable isn't a type guard, so the
931
+ # linter can't narrow list[ModelInfo] | Awaitable[list[ModelInfo]]
932
if inspect.isawaitable(result):
- models = await result
933
+ models = cast(list[ModelInfo], await result)
934
else:
- models = result
935
+ models = cast(list[ModelInfo], result)
936
937
if not self._client:
938
raise RuntimeError("Client not connected")
0 commit comments