44
55import argparse
66import asyncio
7+ import json
78import os
89import sys
910from pathlib import Path
@@ -31,8 +32,12 @@ def _create_argument_parser() -> argparse.ArgumentParser:
3132 epilog = """
3233Examples:
3334 balatrollm --model cerebras-gpt-oss-120b
34- balatrollm --model groq-qwen32b --proxy-url http://localhost:4000
35+ balatrollm --model groq-qwen32b --base-url http://localhost:4000
36+ balatrollm --strategy aggressive
37+ balatrollm --strategy /path/to/my/custom/strategy
38+ balatrollm --strategy ../custom-strategies/experimental
3539 balatrollm --list-models
40+ balatrollm --from-config runs/v0.2.0/cerebras-qwen3-235b/default/20250824_145835_RedDeck_s1_OOOO155/config.json
3641 """ ,
3742 )
3843
@@ -42,9 +47,9 @@ def _create_argument_parser() -> argparse.ArgumentParser:
4247 help = "Model name to use from LiteLLM proxy (default: cerebras-qwen3-235b)" ,
4348 )
4449 parser .add_argument (
45- "--proxy -url" ,
46- default = os .getenv ("LITELLM_PROXY_URL " , "http://localhost:4000" ),
47- help = "LiteLLM proxy URL (default: http://localhost:4000)" ,
50+ "--base -url" ,
51+ default = os .getenv ("LITELLM_BASE_URL " , "http://localhost:4000" ),
52+ help = "LiteLLM base URL (default: http://localhost:4000)" ,
4853 )
4954 parser .add_argument (
5055 "--api-key" ,
@@ -62,13 +67,17 @@ def _create_argument_parser() -> argparse.ArgumentParser:
6267 help = "Path to LiteLLM configuration file (default: config/litellm.yaml)" ,
6368 )
6469 parser .add_argument (
65- "--template " ,
66- default = os .getenv ("BALATROLLM_TEMPLATE " , "default" ),
67- help = "Strategy template to use (default: default)" ,
70+ "--strategy " ,
71+ default = os .getenv ("BALATROLLM_STRATEGY " , "default" ),
72+ help = "Strategy to use. Can be a built-in strategy name (default, aggressive) or a path to a strategy directory (default: default)" ,
6873 )
6974 parser .add_argument (
7075 "--verbose" , "-v" , action = "store_true" , help = "Enable verbose logging"
7176 )
77+ parser .add_argument (
78+ "--from-config" ,
79+ help = "Load configuration from a previous run's config.json file" ,
80+ )
7281
7382 return parser
7483
@@ -93,12 +102,15 @@ def _validate_config_file(config_path: str) -> None:
93102
94103async def run_bot (args ) -> None :
95104 """Run the Balatro bot with the given arguments."""
96- config = Config (
97- model = args .model ,
98- proxy_url = args .proxy_url ,
99- api_key = args .api_key ,
100- template = args .template ,
101- )
105+ if args .from_config :
106+ config = Config .from_config_file (args .from_config )
107+ else :
108+ config = Config (
109+ model = args .model ,
110+ base_url = args .base_url ,
111+ api_key = args .api_key ,
112+ strategy = args .strategy ,
113+ )
102114 bot = LLMBot (config , verbose = args .verbose )
103115
104116 if args .list_models :
@@ -113,7 +125,7 @@ async def _list_models(bot: LLMBot, args) -> None:
113125 print ("Checking available models from LiteLLM proxy..." )
114126
115127 if not await bot .validate_proxy_connection ():
116- print (f"ā Cannot connect to LiteLLM proxy at { args .proxy_url } " )
128+ print (f"ā Cannot connect to LiteLLM proxy at { args .base_url } " )
117129 print (f"Please start the proxy with: litellm --config { args .config } " )
118130 sys .exit (1 )
119131
@@ -132,7 +144,7 @@ async def _start_game(bot: LLMBot, args) -> None:
132144
133145 # Validate connections
134146 if not await bot .validate_proxy_connection ():
135- print (f"ā Cannot connect to LiteLLM proxy at { args .proxy_url } " )
147+ print (f"ā Cannot connect to LiteLLM proxy at { args .base_url } " )
136148 print (f"Please start the proxy with: litellm --config { args .config } " )
137149 sys .exit (1 )
138150
0 commit comments