games.chess.dynamic_config¶
Dynamic configuration for chess game.
This module provides a flexible configuration system for chess that supports: - Legacy hardcoded engines (backward compatibility) - Simple model string configuration - Example-based configuration - Advanced PlayerAgentConfig configuration
Classes¶
Dynamic configuration for chess game. |
Functions¶
|
Create a budget-friendly chess configuration. |
|
Create a competitive chess configuration with top models. |
|
Create a chess configuration with simple model strings. |
|
Create a chess configuration from a predefined example. |
|
Create a chess configuration with detailed player configs. |
|
Create a chess configuration using legacy hardcoded engines. |
|
Create an experimental chess configuration with mixed providers. |
Module Contents¶
- class games.chess.dynamic_config.ChessConfig¶
Bases:
haive.games.core.config.BaseGameConfig
Dynamic configuration for chess game.
This configuration supports multiple modes: 1. Legacy: Use hardcoded engines from engines.py 2. Simple: Specify models as strings (white_model, black_model) 3. Example: Use predefined configurations (e.g., “gpt_vs_claude”) 4. Advanced: Full PlayerAgentConfig specifications
- white_model¶
Model for white player (simple mode)
- black_model¶
Model for black player (simple mode)
- white_player_name¶
Display name for white player
- black_player_name¶
Display name for black player
- max_moves¶
Maximum moves before draw (default: 200)
- enable_fen_visualization¶
Show FEN strings in analysis
- create_engines_from_player_configs(player_configs)¶
Create engines from player configurations.
- Parameters:
player_configs (dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig])
- Return type:
list[Any]
- create_simple_player_configs()¶
Create player configs from simple model strings.
- Return type:
dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig]
- games.chess.dynamic_config.budget_chess(**kwargs)¶
Create a budget-friendly chess configuration.
- Return type:
- games.chess.dynamic_config.competitive_chess(**kwargs)¶
Create a competitive chess configuration with top models.
- Return type:
- games.chess.dynamic_config.create_chess_config(white_model='gpt-4o', black_model='claude-3-5-sonnet-20240620', **kwargs)¶
Create a chess configuration with simple model strings.
- Parameters:
- Returns:
ChessConfig instance
- Return type:
Examples
>>> config = create_chess_config("gpt-4", "claude-3-opus") >>> config = create_chess_config( ... "openai:gpt-4o", ... "anthropic:claude-3-5-sonnet", ... temperature=0.8 ... )
- games.chess.dynamic_config.create_chess_config_from_example(example_name, **kwargs)¶
Create a chess configuration from a predefined example.
- Parameters:
example_name (str) – Name of the example configuration
**kwargs – Additional parameters to override
- Returns:
ChessConfig instance
- Return type:
- Available examples:
“gpt_vs_claude”: GPT-4 vs Claude
“anthropic_vs_openai”: Claude vs GPT showdown
“gpt_only”: GPT-4 for both players
“claude_only”: Claude for both players
“budget”: Cost-effective models
“mixed”: Different providers
Examples
>>> config = create_chess_config_from_example("budget") >>> config = create_chess_config_from_example("gpt_vs_claude", max_moves=150)
- games.chess.dynamic_config.create_chess_config_with_players(player_configs, **kwargs)¶
Create a chess configuration with detailed player configs.
- Parameters:
player_configs (dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig]) – Dictionary mapping role names to PlayerAgentConfig
**kwargs – Additional configuration parameters
- Returns:
ChessConfig instance
- Return type:
- Expected roles:
“white_player”: White player configuration
“black_player”: Black player configuration
“white_analyzer”: White analyzer configuration (optional)
“black_analyzer”: Black analyzer configuration (optional)
Examples
>>> player_configs = { ... "white_player": PlayerAgentConfig( ... llm_config="gpt-4", ... temperature=0.7, ... player_name="Aggressive White" ... ), ... "black_player": PlayerAgentConfig( ... llm_config="claude-3-opus", ... temperature=0.3, ... player_name="Defensive Black" ... ) ... } >>> config = create_chess_config_with_players(player_configs)
- games.chess.dynamic_config.create_legacy_chess_config(**kwargs)¶
Create a chess configuration using legacy hardcoded engines.
This is for backward compatibility with existing code.
- Parameters:
**kwargs – Additional configuration parameters
- Returns:
ChessConfig instance with hardcoded engines
- Return type:
- games.chess.dynamic_config.experimental_chess(**kwargs)¶
Create an experimental chess configuration with mixed providers.
- Return type: