Skip to content

Commit 3576fd5

Browse files
committed
feat: use model config for model parameters
1 parent 6a0f4fa commit 3576fd5

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/balatrollm/bot.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from balatrobot import BalatroClient, BalatroError
1313
from balatrobot.enums import State
1414

15-
from .config import Config
15+
from .config import Config, load_model_config
1616
from .data_collection import RunStatsCollector, generate_run_directory
1717
from .strategies import StrategyManager
1818

@@ -83,11 +83,13 @@ def __init__(self, config: Config, base_url: str, api_key: str, port: int = 1234
8383
8484
Args:
8585
config: Bot configuration containing model and strategy settings.
86-
base_url: Base URL for the LiteLLM proxy server.
87-
api_key: API key for LiteLLM proxy authentication.
86+
base_url: Base URL for OpenAI compatible API.
87+
api_key: API key for authentication.
8888
port: Port for BalatroBot client connection.
8989
"""
9090
self.config = config
91+
self.model_config = load_model_config(config.model)
92+
9193
self.llm_client = AsyncOpenAI(api_key=api_key, base_url=base_url)
9294
self.balatro_client = BalatroClient(port=port)
9395
self.strategy_manager = StrategyManager(config.strategy)
@@ -183,16 +185,17 @@ async def _make_llm_request_with_retries(
183185

184186
for attempt in range(max_retries):
185187
try:
188+
# Build request data from model config
186189
request_data = {
187-
"extra_headers": {
188-
"HTTP-Referer": "https://github.com/S1M0N38/balatrollm",
189-
"X-Title": "BalatroLLM",
190-
},
191190
"model": self.config.model,
192191
"messages": messages,
193192
"tools": tools,
194-
"tool_choice": "auto",
195193
}
194+
195+
# Add model-specific parameters from config
196+
for key, value in self.model_config.items():
197+
request_data[key] = value
198+
196199
request_id = self.data_collector.write_request(request_data)
197200

198201
response = await self.llm_client.chat.completions.create(**request_data)

0 commit comments

Comments
 (0)