|
12 | 12 | from balatrobot import BalatroClient, BalatroError |
13 | 13 | from balatrobot.enums import State |
14 | 14 |
|
15 | | -from .config import Config |
| 15 | +from .config import Config, load_model_config |
16 | 16 | from .data_collection import RunStatsCollector, generate_run_directory |
17 | 17 | from .strategies import StrategyManager |
18 | 18 |
|
@@ -83,11 +83,13 @@ def __init__(self, config: Config, base_url: str, api_key: str, port: int = 1234 |
83 | 83 |
|
84 | 84 | Args: |
85 | 85 | 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. |
88 | 88 | port: Port for BalatroBot client connection. |
89 | 89 | """ |
90 | 90 | self.config = config |
| 91 | + self.model_config = load_model_config(config.model) |
| 92 | + |
91 | 93 | self.llm_client = AsyncOpenAI(api_key=api_key, base_url=base_url) |
92 | 94 | self.balatro_client = BalatroClient(port=port) |
93 | 95 | self.strategy_manager = StrategyManager(config.strategy) |
@@ -183,16 +185,17 @@ async def _make_llm_request_with_retries( |
183 | 185 |
|
184 | 186 | for attempt in range(max_retries): |
185 | 187 | try: |
| 188 | + # Build request data from model config |
186 | 189 | request_data = { |
187 | | - "extra_headers": { |
188 | | - "HTTP-Referer": "https://github.com/S1M0N38/balatrollm", |
189 | | - "X-Title": "BalatroLLM", |
190 | | - }, |
191 | 190 | "model": self.config.model, |
192 | 191 | "messages": messages, |
193 | 192 | "tools": tools, |
194 | | - "tool_choice": "auto", |
195 | 193 | } |
| 194 | + |
| 195 | + # Add model-specific parameters from config |
| 196 | + for key, value in self.model_config.items(): |
| 197 | + request_data[key] = value |
| 198 | + |
196 | 199 | request_id = self.data_collector.write_request(request_data) |
197 | 200 |
|
198 | 201 | response = await self.llm_client.chat.completions.create(**request_data) |
|
0 commit comments