mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-10 20:19:22 +00:00
Reuse builtin_automatically_routed_apis
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
This commit is contained in:
parent
35bc05d71b
commit
79b79889bc
3 changed files with 7 additions and 17 deletions
|
@ -9,20 +9,6 @@ from enum import Enum
|
||||||
from llama_models.schema_utils import json_schema_type
|
from llama_models.schema_utils import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
|
||||||
class RegisteredApi(Enum):
|
|
||||||
agents = "agents"
|
|
||||||
datasetio = "datasetio"
|
|
||||||
eval = "eval"
|
|
||||||
inference = "inference"
|
|
||||||
post_training = "post_training"
|
|
||||||
safety = "safety"
|
|
||||||
scoring = "scoring"
|
|
||||||
telemetry = "telemetry"
|
|
||||||
tool_runtime = "tool_runtime"
|
|
||||||
vector_io = "vector_io"
|
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class Api(Enum):
|
class Api(Enum):
|
||||||
inference = "inference"
|
inference = "inference"
|
||||||
|
|
|
@ -22,9 +22,9 @@ class StackListProviders(Subcommand):
|
||||||
self.parser.set_defaults(func=self._run_providers_list_cmd)
|
self.parser.set_defaults(func=self._run_providers_list_cmd)
|
||||||
|
|
||||||
def _add_arguments(self):
|
def _add_arguments(self):
|
||||||
from llama_stack.apis.datatypes import RegisteredApi
|
from llama_stack.distribution.distribution import builtin_automatically_routed_apis
|
||||||
|
|
||||||
api_values = [a.value for a in RegisteredApi]
|
api_values = [x.router_api for x in builtin_automatically_routed_apis()]
|
||||||
self.parser.add_argument(
|
self.parser.add_argument(
|
||||||
"api",
|
"api",
|
||||||
type=str,
|
type=str,
|
||||||
|
|
|
@ -56,7 +56,11 @@ def builtin_automatically_routed_apis() -> List[AutoRoutedApiInfo]:
|
||||||
|
|
||||||
def providable_apis() -> List[Api]:
|
def providable_apis() -> List[Api]:
|
||||||
routing_table_apis = set(x.routing_table_api for x in builtin_automatically_routed_apis())
|
routing_table_apis = set(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]
|
print(routing_table_apis)
|
||||||
|
print("\n")
|
||||||
|
res = [api for api in Api if api not in routing_table_apis and api != Api.inspect]
|
||||||
|
print(res)
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
def get_provider_registry() -> Dict[Api, Dict[str, ProviderSpec]]:
|
def get_provider_registry() -> Dict[Api, Dict[str, ProviderSpec]]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue