Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Model Deployment Choices #909

Closed
cyrilzakka opened this issue Jan 15, 2025 · 0 comments · Fixed by #910
Closed

Error in Model Deployment Choices #909

cyrilzakka opened this issue Jan 15, 2025 · 0 comments · Fixed by #910
Assignees
Labels
bug Something isn't working

Comments

@cyrilzakka
Copy link

cyrilzakka commented Jan 15, 2025

What is the issue?

Newest commit results in error on make first-run:

Traceback (most recent call last):
  File "/Users/cyril/Downloads/cohere-toolkit-main/src/backend/scripts/cli/main.py", line 97, in <module>
    start()
  File "/Users/cyril/Downloads/cohere-toolkit-main/src/backend/scripts/cli/main.py", line 70, in start
    selected_deployments = select_deployments_prompt(all_deployments, secrets)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyril/Downloads/cohere-toolkit-main/src/backend/scripts/cli/prompts.py", line 152, in select_deployments_prompt
    choices=[deployment.value for deployment in deployments.keys()],
                                                ^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'keys'
make[1]: *** [setup] Error 1
make: *** [first-run] Error 2

Fix should be:

def select_deployments_prompt(deployments, _):
    print_styled("🚀 Let's set up your model deployments.", bcolors.MAGENTA)
    deployments = inquirer.checkbox(
        "Select the model deployments you want to set up",
        choices=list(deployments.keys()),
        default=["Cohere Platform"],
        validate=lambda _, x: len(x) > 0,
    )
    return deployments

and

def deployment_prompt(secrets, configs):
    for secret in configs.env_vars():
        value = secrets.get(secret)

        if not value:
            value = inquirer.text(
                f"Enter the value for {secret}", validate=lambda _, x: len(x) > 0
            )

        secrets[secret] = value

in cohere-toolkit-main/src/backend/scripts/cli/prompts.py. Then start() in main.py should be:

def start():
    # Set any command args
    parser = argparse.ArgumentParser()
    args = parser.parse_args()

    show_welcome_message()

    secrets = dotenv_values()
    process_existing_yaml_config(secrets, CONFIG_FILE_PATH, overwrite_config_prompt)
    process_existing_yaml_config(secrets, SECRETS_FILE_PATH, overwrite_secrets_prompt)

    # SET UP ENVIRONMENT
    for _, prompt in PROMPTS.items():
        prompt(secrets)

    # SET UP TOOLS
    for name, configs in TOOLS.items():
        tool_prompt(secrets, name, configs)

    # SET UP ENVIRONMENT FOR DEPLOYMENTS

    # These imports run code that uses settings. Local imports are used so that we can
    # validate any existing config file above before using settings.
    from backend.config.deployments import (
        AVAILABLE_MODEL_DEPLOYMENTS as MANAGED_DEPLOYMENTS_SETUP,
    )

    all_deployments = {d.name(): d for d in MANAGED_DEPLOYMENTS_SETUP.copy()}
    selected_deployments = select_deployments_prompt(all_deployments, secrets)
    for deployment in selected_deployments:
        deployment_prompt(secrets, all_deployments[deployment])

    # REVIEW VARIABLES
    variables_to_update = review_variables_prompt(secrets)
    update_variable_prompt(secrets, variables_to_update)

    # SET UP .ENV FILE
    write_env_file(secrets)

    # SET UP YAML CONFIG FILES
    # Deal with strange edge case where there are preexisting configuration.yaml
    # and secrets.yaml FOLDERS presents in the config folder - cause still unclear
    delete_config_folders()
    write_template_config_files()
    write_config_files(secrets)

    # WRAP UP
    wrap_up(selected_deployments)

    # SHOW SOME EXAMPLES
    show_examples()

and

def deployment_prompt(secrets, configs):
    for secret in configs.env_vars():
        value = secrets.get(secret)

        if not value:
            value = inquirer.text(
                f"Enter the value for {secret}", validate=lambda _, x: len(x) > 0
            )

        secrets[secret] = value

Additional information

No response

@cyrilzakka cyrilzakka added the bug Something isn't working label Jan 15, 2025
@ezawadski ezawadski self-assigned this Jan 16, 2025
@ezawadski ezawadski linked a pull request Jan 16, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants