games.tic_tac_toe.configurable_config¶
Configurable Tic-Tac-Toe configuration using the generic player agent system.
This module provides configurable Tic-Tac-Toe game configurations that replace hardcoded LLM settings with dynamic, configurable player agents.
Classes¶
Configurable Tic-Tac-Toe configuration with dynamic LLM selection. |
Functions¶
|
Create a budget-friendly Tic-Tac-Toe configuration. |
|
Create an experimental Tic-Tac-Toe configuration with mixed providers. |
|
Create a quick Tic-Tac-Toe configuration with fast models. |
|
Create a configurable Tic-Tac-Toe configuration with simple model specifications. |
|
Create a configurable Tic-Tac-Toe configuration from a predefined example. |
|
Create a configurable Tic-Tac-Toe configuration from detailed player. |
|
Get a predefined example configuration by name. |
List all available example configurations. |
Module Contents¶
- class games.tic_tac_toe.configurable_config.ConfigurableTicTacToeConfig¶
Bases:
haive.games.tic_tac_toe.config.TicTacToeConfig
Configurable Tic-Tac-Toe configuration with dynamic LLM selection.
This configuration allows users to specify different LLMs for different roles in the Tic-Tac-Toe game, providing flexibility and avoiding hardcoded models.
- x_model¶
Model for X player (can be string or LLMConfig)
- o_model¶
Model for O player (can be string or LLMConfig)
- x_player_name¶
Name for the X player
- o_player_name¶
Name for the O player
- example_config¶
Optional example configuration name
- player_configs¶
Optional detailed player configurations
- temperature¶
Temperature for LLM generation
- max_moves¶
Maximum number of moves before draw
- enable_analysis¶
Whether to enable position analysis
- recursion_limit¶
Python recursion limit for game execution
- model_post_init(__context)¶
Initialize engines after model creation.
- Parameters:
__context (Any)
- Return type:
None
- games.tic_tac_toe.configurable_config.create_budget_ttt_config(**kwargs)¶
Create a budget-friendly Tic-Tac-Toe configuration.
- Return type:
- games.tic_tac_toe.configurable_config.create_experimental_ttt_config(**kwargs)¶
Create an experimental Tic-Tac-Toe configuration with mixed providers.
- Return type:
- games.tic_tac_toe.configurable_config.create_quick_ttt_config(**kwargs)¶
Create a quick Tic-Tac-Toe configuration with fast models.
- Return type:
- games.tic_tac_toe.configurable_config.create_ttt_config(x_model='gpt-4o', o_model='claude-3-5-sonnet-20240620', **kwargs)¶
Create a configurable Tic-Tac-Toe configuration with simple model specifications.
- Parameters:
- Returns:
Configured Tic-Tac-Toe game
- Return type:
Examples
>>> config = create_ttt_config("gpt-4o", "claude-3-opus", temperature=0.5) >>> config = create_ttt_config( ... "openai:gpt-4o", ... "anthropic:claude-3-5-sonnet-20240620", ... max_moves=9 ... )
- games.tic_tac_toe.configurable_config.create_ttt_config_from_example(example_name, **kwargs)¶
Create a configurable Tic-Tac-Toe configuration from a predefined example.
- Parameters:
example_name (str) – Name of the example configuration
**kwargs – Additional configuration parameters to override
- Returns:
Configured Tic-Tac-Toe game
- Return type:
- Available examples:
“gpt_vs_claude”: GPT-4 vs Claude
“gpt_only”: GPT-4 for both players
“claude_only”: Claude for both players
“budget”: Cost-effective models
“mixed”: Different provider per role
Examples
>>> config = create_ttt_config_from_example("budget", max_moves=9) >>> config = create_ttt_config_from_example("gpt_vs_claude", enable_analysis=False)
- games.tic_tac_toe.configurable_config.create_ttt_config_from_player_configs(player_configs, **kwargs)¶
Create a configurable Tic-Tac-Toe configuration from detailed player. configurations.
- Parameters:
player_configs (dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig]) – Dictionary mapping role names to player configurations
**kwargs – Additional configuration parameters
- Returns:
Configured Tic-Tac-Toe game
- Return type:
- Expected roles:
“X_player”: X player configuration
“O_player”: O player configuration
“X_analyzer”: X analyzer configuration
“O_analyzer”: O analyzer configuration
Examples
>>> player_configs = { ... "X_player": PlayerAgentConfig( ... llm_config="gpt-4o", ... temperature=0.7, ... player_name="Strategic X" ... ), ... "O_player": PlayerAgentConfig( ... llm_config="claude-3-opus", ... temperature=0.3, ... player_name="Tactical O" ... ), ... "X_analyzer": PlayerAgentConfig( ... llm_config="gpt-4o", ... temperature=0.2, ... player_name="X Analyst" ... ), ... "O_analyzer": PlayerAgentConfig( ... llm_config="claude-3-opus", ... temperature=0.2, ... player_name="O Analyst" ... ), ... } >>> config = create_ttt_config_from_player_configs(player_configs)
- games.tic_tac_toe.configurable_config.get_example_config(name)¶
Get a predefined example configuration by name.
- Parameters:
name (str) – Name of the example configuration
- Returns:
The example configuration
- Return type:
- Raises:
ValueError – If the example name is not found