|
16 | 16 | from .agentstack_data import FrameworkData, ProjectMetadata, ProjectStructure, CookiecutterData |
17 | 17 | from agentstack.logger import log |
18 | 18 | from agentstack.utils import get_package_path |
| 19 | +from agentstack.generation.files import ConfigFile |
19 | 20 | from agentstack.generation.tool_generation import get_all_tools |
20 | 21 | from .. import generation |
21 | 22 | from ..utils import open_json_file, term_color, is_snake_case |
22 | 23 |
|
| 24 | +PREFERRED_MODELS = [ |
| 25 | + 'openai/gpt-4o', |
| 26 | + 'anthropic/claude-3-5-sonnet', |
| 27 | + 'openai/o1-preview', |
| 28 | + 'openai/gpt-4-turbo', |
| 29 | + 'anthropic/claude-3-opus', |
| 30 | +] |
23 | 31 |
|
24 | 32 | def init_project_builder(slug_name: Optional[str] = None, template: Optional[str] = None, use_wizard: bool = False): |
25 | 33 | if slug_name and not is_snake_case(slug_name): |
@@ -114,6 +122,27 @@ def welcome_message(): |
114 | 122 | print(border) |
115 | 123 |
|
116 | 124 |
|
| 125 | +def configure_default_model(path: Optional[str] = None): |
| 126 | + """Set the default model""" |
| 127 | + agentstack_config = ConfigFile(path) |
| 128 | + if agentstack_config.default_model: |
| 129 | + return # Default model already set |
| 130 | + |
| 131 | + print("Project does not have a default model configured.") |
| 132 | + other_msg = f"Other (enter a model name)" |
| 133 | + model = inquirer.list_input( |
| 134 | + message="Which model would you like to use?", |
| 135 | + choices=PREFERRED_MODELS + [other_msg], |
| 136 | + ) |
| 137 | + |
| 138 | + if model == other_msg: # If the user selects "Other", prompt for a model name |
| 139 | + print(f'A list of available models is available at: "https://docs.litellm.ai/docs/providers"') |
| 140 | + model = inquirer.text(message="Enter the model name") |
| 141 | + |
| 142 | + with ConfigFile(path) as agentstack_config: |
| 143 | + agentstack_config.default_model = model |
| 144 | + |
| 145 | + |
117 | 146 | def ask_framework() -> str: |
118 | 147 | framework = "CrewAI" |
119 | 148 | # framework = inquirer.list_input( |
|
0 commit comments