mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 17:00:09 +00:00
add all providers
This commit is contained in:
parent
1dc337db8b
commit
e6ed7eabbb
18 changed files with 265 additions and 27 deletions
|
|
@ -44,36 +44,37 @@ class RunConfigSettings(BaseModel):
|
|||
provider_configs[api_str] = api_providers
|
||||
continue
|
||||
|
||||
provider_type = provider_types[0]
|
||||
provider_id = provider_type.split("::")[-1]
|
||||
provider_configs[api_str] = []
|
||||
for provider_type in provider_types:
|
||||
provider_id = provider_type.split("::")[-1]
|
||||
|
||||
api = Api(api_str)
|
||||
if provider_type not in provider_registry[api]:
|
||||
raise ValueError(
|
||||
f"Unknown provider type: {provider_type} for API: {api_str}"
|
||||
api = Api(api_str)
|
||||
if provider_type not in provider_registry[api]:
|
||||
raise ValueError(
|
||||
f"Unknown provider type: {provider_type} for API: {api_str}"
|
||||
)
|
||||
|
||||
config_class = provider_registry[api][provider_type].config_class
|
||||
assert (
|
||||
config_class is not None
|
||||
), f"No config class for provider type: {provider_type} for API: {api_str}"
|
||||
|
||||
config_class = instantiate_class_type(config_class)
|
||||
if hasattr(config_class, "sample_run_config"):
|
||||
config = config_class.sample_run_config(
|
||||
__distro_dir__=f"distributions/{name}"
|
||||
)
|
||||
else:
|
||||
config = {}
|
||||
|
||||
provider_configs[api_str].append(
|
||||
Provider(
|
||||
provider_id=provider_id,
|
||||
provider_type=provider_type,
|
||||
config=config,
|
||||
)
|
||||
)
|
||||
|
||||
config_class = provider_registry[api][provider_type].config_class
|
||||
assert (
|
||||
config_class is not None
|
||||
), f"No config class for provider type: {provider_type} for API: {api_str}"
|
||||
|
||||
config_class = instantiate_class_type(config_class)
|
||||
if hasattr(config_class, "sample_run_config"):
|
||||
config = config_class.sample_run_config(
|
||||
__distro_dir__=f"distributions/{name}"
|
||||
)
|
||||
else:
|
||||
config = {}
|
||||
|
||||
provider_configs[api_str] = [
|
||||
Provider(
|
||||
provider_id=provider_id,
|
||||
provider_type=provider_type,
|
||||
config=config,
|
||||
)
|
||||
]
|
||||
|
||||
# Get unique set of APIs from providers
|
||||
apis = list(sorted(providers.keys()))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue