Several smaller fixes to make adapters work

Also, reorganized the pattern of __init__ inside providers so
configuration can stay lightweight
This commit is contained in:
Ashwin Bharambe 2024-08-28 09:42:08 -07:00
parent 2a1552a5eb
commit 45987996c4
23 changed files with 164 additions and 160 deletions

View file

@ -48,7 +48,10 @@ class ApiConfigure(Subcommand):
)
def _run_api_configure_cmd(self, args: argparse.Namespace) -> None:
config_file = BUILDS_BASE_DIR / args.api / f"{args.name}.yaml"
name = args.name
if not name.endswith(".yaml"):
name += ".yaml"
config_file = BUILDS_BASE_DIR / args.api / name
if not config_file.exists():
self.parser.error(
f"Could not find {config_file}. Please run `llama api build` first"
@ -79,10 +82,19 @@ def configure_llama_provider(config_file: Path) -> None:
)
provider_spec = providers[provider_id]
cprint(f"Configuring API surface: {api}", "white", attrs=["bold"])
cprint(
f"Configuring API surface: {api} ({provider_id})", "white", attrs=["bold"]
)
config_type = instantiate_class_type(provider_spec.config_class)
try:
existing_provider_config = config_type(**stub_config)
except KeyError:
existing_provider_config = None
provider_config = prompt_for_config(
config_type,
existing_provider_config,
)
print("")