mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 20:14:13 +00:00
fix: Fixing prompts import warning
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
65d45c7318
commit
9fc0696052
2 changed files with 15 additions and 2 deletions
|
@ -70,7 +70,8 @@ def builtin_automatically_routed_apis() -> list[AutoRoutedApiInfo]:
|
||||||
|
|
||||||
def providable_apis() -> list[Api]:
|
def providable_apis() -> list[Api]:
|
||||||
routing_table_apis = {x.routing_table_api for x in builtin_automatically_routed_apis()}
|
routing_table_apis = {x.routing_table_api for x in builtin_automatically_routed_apis()}
|
||||||
return [api for api in Api if api not in routing_table_apis and api != Api.inspect and api != Api.providers]
|
internal_apis = {Api.inspect, Api.providers, Api.prompts}
|
||||||
|
return [api for api in Api if api not in routing_table_apis and api not in internal_apis]
|
||||||
|
|
||||||
|
|
||||||
def _load_remote_provider_spec(spec_data: dict[str, Any], api: Api) -> ProviderSpec:
|
def _load_remote_provider_spec(spec_data: dict[str, Any], api: Api) -> ProviderSpec:
|
||||||
|
|
|
@ -12,7 +12,7 @@ import yaml
|
||||||
from pydantic import BaseModel, Field, ValidationError
|
from pydantic import BaseModel, Field, ValidationError
|
||||||
|
|
||||||
from llama_stack.core.datatypes import Api, Provider, StackRunConfig
|
from llama_stack.core.datatypes import Api, Provider, StackRunConfig
|
||||||
from llama_stack.core.distribution import get_provider_registry
|
from llama_stack.core.distribution import get_provider_registry, providable_apis
|
||||||
from llama_stack.providers.datatypes import ProviderSpec
|
from llama_stack.providers.datatypes import ProviderSpec
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,6 +152,18 @@ class TestProviderRegistry:
|
||||||
assert registry[Api.inference]["test_provider"].provider_type == "test_provider"
|
assert registry[Api.inference]["test_provider"].provider_type == "test_provider"
|
||||||
assert registry[Api.inference]["test_provider"].api == Api.inference
|
assert registry[Api.inference]["test_provider"].api == Api.inference
|
||||||
|
|
||||||
|
def test_internal_apis_excluded(self):
|
||||||
|
"""Test that internal APIs are excluded and other APIs are included in providable APIs."""
|
||||||
|
apis = providable_apis()
|
||||||
|
internal_apis = {Api.inspect, Api.providers, Api.prompts}
|
||||||
|
|
||||||
|
for internal_api in internal_apis:
|
||||||
|
assert internal_api not in apis, f"Internal API {internal_api} should not be in providable_apis"
|
||||||
|
|
||||||
|
included_apis = {Api.inference, Api.safety, Api.agents}
|
||||||
|
for api in included_apis:
|
||||||
|
assert api in apis, f"API {api} should be in providable_apis"
|
||||||
|
|
||||||
def test_external_remote_providers(self, api_directories, mock_providers, base_config, provider_spec_yaml):
|
def test_external_remote_providers(self, api_directories, mock_providers, base_config, provider_spec_yaml):
|
||||||
"""Test loading external remote providers from YAML files."""
|
"""Test loading external remote providers from YAML files."""
|
||||||
remote_dir, _ = api_directories
|
remote_dir, _ = api_directories
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue