Files
factorio-learning-environment/fle/env/gym_env/config.py
kiankyars 5ee9586e1d llm_factory (#290)
* first iteration

* change to support openai api endpoints

* Refactor APIFactory to use OpenAI-compatible endpoints

- Unified all providers to use OpenAI client format
- Eliminated provider-specific conditional branches
- Simplified provider detection using dict ordering
- Removed unused parameters and added missing return
- 90% reduction in code complexity

* Further simplify APIFactory

- Remove redundant MODELS_WITH_IMAGE_SUPPORT array
- Use provider config supports_images instead
- Inline _prepare_messages logic
- Extract _get_reasoning_length helper
- Add missing default return
- 20+ line reduction while maintaining functionality

* removecomment

* Inline reasoning length logic

- Remove _get_reasoning_length helper method
- Inline reasoning effort logic in o1/o3 handling
- Keep code simpler and more direct

* add provider sorting for openrouter to get fastest throughput

* add nitro

* add usage tracking

* usage

* undo changes that added logging

* update config paths

* remove offset

* offset

* Aug 20, 2025 at 20:25

* fix run_idx port offset

* make sure there is keyerror if no port

* fix
2025-08-21 12:58:39 +03:00

34 lines
1.0 KiB
Python

from dataclasses import dataclass
from typing import List, Optional
from fle.agents.gym_agent import GymAgent
from fle.env.gym_env.observation_formatter import BasicObservationFormatter
from fle.eval.tasks import TaskABC
from a2a.types import AgentCard
@dataclass
class GymRunConfig:
"""Configuration for a single gym environment evaluation run"""
env_id: str # Gym environment ID from registry (e.g., "Factorio-iron_ore_throughput_16-v0")
model: str
version: Optional[int] = None
observation_formatter: Optional[BasicObservationFormatter] = None
@dataclass
class GymEvalConfig:
"""Configuration for gym evaluation"""
agents: List[GymAgent]
version: int
version_description: str
task: Optional[TaskABC] = None
agent_cards: Optional[List[AgentCard]] = None
env_id: Optional[str] = None # Gym environment ID for registry-based creation
def __post_init__(self):
if self.task is None and hasattr(self.agents[0], "task"):
self.task = self.agents[0].task