From 24385cfd03e75ce85ef10d61d12a199036fc0852 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Tue, 11 Feb 2025 19:12:46 -0500 Subject: [PATCH] fix: filter out remote::sample providers when listing (#1057) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What does this PR do? Before: ```  llama stack list-providers agents +------------------------+-----------------------------------------------------------------------+ | Provider Type | PIP Package Dependencies | +------------------------+-----------------------------------------------------------------------+ | inline::meta-reference | matplotlib,pillow,pandas,scikit-learn,aiosqlite,psycopg2-binary,redis | +------------------------+-----------------------------------------------------------------------+ | remote::sample | | +------------------------+-----------------------------------------------------------------------+ ``` After: ```  llama stack list-providers agents +------------------------+-----------------------------------------------------------------------+ | Provider Type | PIP Package Dependencies | +------------------------+-----------------------------------------------------------------------+ | inline::meta-reference | matplotlib,pillow,pandas,scikit-learn,aiosqlite,psycopg2-binary,redis | +------------------------+-----------------------------------------------------------------------+ ``` [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan Manually. [//]: # (## Documentation) Signed-off-by: Ihar Hrachyshka --- llama_stack/cli/stack/list_providers.py | 2 +- llama_stack/providers/datatypes.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/llama_stack/cli/stack/list_providers.py b/llama_stack/cli/stack/list_providers.py index 909fea030..bd152c980 100644 --- a/llama_stack/cli/stack/list_providers.py +++ b/llama_stack/cli/stack/list_providers.py @@ -47,7 +47,7 @@ class StackListProviders(Subcommand): rows = [] for spec in providers_for_api.values(): - if spec.provider_type == "sample": + if spec.is_sample: continue rows.append( [ diff --git a/llama_stack/providers/datatypes.py b/llama_stack/providers/datatypes.py index d0c448f8c..8df91cce6 100644 --- a/llama_stack/providers/datatypes.py +++ b/llama_stack/providers/datatypes.py @@ -86,6 +86,10 @@ class ProviderSpec(BaseModel): # used internally by the resolver; this is a hack for now deps__: List[str] = Field(default_factory=list) + @property + def is_sample(self) -> bool: + return self.provider_type in ("sample", "remote::sample") + class RoutingTable(Protocol): def get_provider_impl(self, routing_key: str) -> Any: ...