Skip to content

Commit f1d12a0

Browse files
committed
changes
1 parent 17e9db8 commit f1d12a0

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

agents/generate_and_validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ def generate_and_validate(
3434
logger.info(f"Generating solution for: {use_case}")
3535

3636
env_retain = os.getenv("RETAIN_ON_FAILURE")
37-
if env_retain is not None:
37+
if env_retain and env_retain.strip():
3838
retain_on_failure = env_retain.lower() in ["true", "1", "yes", "y"]
3939
logger.info(f"Using RETAIN_ON_FAILURE={retain_on_failure} from .env")
4040
else:
4141
retain_input = input("Retain solution even if build fails? (y/n) [default: y]: ")
4242
retain_on_failure = retain_input.lower() in ["y", "yes"] or retain_input == ""
43-
print("(Tip: add RETAIN_ON_FAILURE=true or RETAIN_ON_FAILURE=true to .env to skip this input prompt)")
43+
print("(Tip: add RETAIN_ON_FAILURE=true or RETAIN_ON_FAILURE=true to .env to skip this input prompt in future)")
4444

4545
llm_inputs = LLMInputs(
4646
use_case=use_case,

agents/generate_library.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ def _get_model_from_env_or_prompt(available_models: dict, model_type: str, env_v
5656
print(f"Using {env_model_name} for {model_type} (from environment variable)")
5757
return models[env_model_name]
5858
print(f"Warning: Model '{env_model_name}' specified in {env_var_name} not found. Prompting for selection.")
59-
60-
print(f"(Tip: add {env_var_name} to .env to skip this input prompt)")
61-
return select_model(available_models, model_type)
59+
return select_model(available_models, model_type, env_var_name)
6260

6361

6462
def main() -> None:
@@ -68,9 +66,10 @@ def main() -> None:
6866
raise EnvironmentError("No OpenAI API key found in .env file. Please add OPENAI_API_KEY")
6967

7068
available_models = get_available_models(api_keys)
69+
7170
use_case = get_user_input()
7271

73-
print("\nSelect models for library generation:")
72+
print("\nNow let's select the which LLMs to use to generate the library..")
7473
search_term_llm = _get_model_from_env_or_prompt(available_models, "NuGet package search", "SEARCH_TERM_LLM")
7574

7675
code_generation_llm = _get_model_from_env_or_prompt(available_models, "code generation", "CODE_GENERATION_LLM")

agents/utils/model_definitions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,19 @@ def get_model(model_name: str) -> BaseChatModel:
4545
raise KeyError(f"Model {model_name} not found in any provider.")
4646

4747

48-
def select_model(available_models: Dict[str, Dict[str, Any]], purpose: str) -> Any:
48+
def select_model(available_models: Dict[str, Dict[str, Any]], purpose: str, env_var_name: str) -> Any:
4949
"""Prompts the user to select a model from the available models based on the given purpose."""
50-
print(f"\nSelect model for {purpose}:")
50+
print(f"\nSelect model for {purpose} (Tip: add {env_var_name} to .env to skip this input prompt in future):")
5151
options = _get_model_options(available_models, purpose)
5252
default_option = options[0]
53-
5453
for idx, (name, _) in enumerate(options, start=1):
5554
if idx == 1:
5655
print(f"{idx}. {name} (default - press Enter)")
5756
else:
5857
print(f"{idx}. {name}")
58+
print(
59+
"! If you are using the free tier of the OpenAI API, only gpt4o-mini model will work (see https://platform.openai.com/docs/guides/rate-limits)"
60+
)
5961

6062
while True:
6163
choice = input("Enter your choice (number or press Enter for default): ").strip()

0 commit comments

Comments
 (0)