Skip to content

Commit 3a5cb23

Browse files
committed
feat: add configurable port for balatrobot client
1 parent cc400a8 commit 3a5cb23

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/balatrollm/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def cmd_balatrollm(args) -> None:
5555
strategy=args.strategy,
5656
)
5757

58-
bot = LLMBot(config, base_url=args.base_url, api_key=args.api_key)
58+
bot = LLMBot(config, base_url=args.base_url, api_key=args.api_key, port=args.port)
5959

6060
if args.list_models:
6161
models = await bot.list_available_models()
@@ -169,6 +169,12 @@ def _create_argument_parser() -> argparse.ArgumentParser:
169169
default=1,
170170
help="Number of times to run the bot with the same configuration (default: 1)",
171171
)
172+
parser.add_argument(
173+
"--port",
174+
type=int,
175+
default=12346,
176+
help="Port for BalatroBot client connection (default: 12346)",
177+
)
172178

173179
# Benchmark subcommand
174180
benchmark_parser = subparsers.add_parser(

src/balatrollm/bot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,18 @@ class LLMBot:
7676
data_collector: Collector for structured run data and statistics.
7777
"""
7878

79-
def __init__(self, config: Config, base_url: str, api_key: str):
79+
def __init__(self, config: Config, base_url: str, api_key: str, port: int = 12346):
8080
"""Initialize the LLM bot.
8181
8282
Args:
8383
config: Bot configuration containing model and strategy settings.
8484
base_url: Base URL for the LiteLLM proxy server.
8585
api_key: API key for LiteLLM proxy authentication.
86+
port: Port for BalatroBot client connection.
8687
"""
8788
self.config = config
8889
self.llm_client = AsyncOpenAI(api_key=api_key, base_url=base_url)
89-
self.balatro_client = BalatroClient()
90+
self.balatro_client = BalatroClient(port=port)
9091
self.strategy_manager = StrategyManager(config.strategy)
9192
self.responses: list[ChatCompletion] = []
9293
self.tools = self.strategy_manager.load_tools()

0 commit comments

Comments
 (0)