haive.games.risk.configurable_config¶
Configurable Risk configuration using the generic player agent system.
This module provides configurable Risk game configurations that replace hardcoded LLM settings with dynamic, configurable player agents.
Classes¶
Configurable Risk configuration with dynamic LLM selection. |
Functions¶
|
Create an advanced Risk configuration with powerful models. |
|
Create a budget-friendly Risk configuration. |
|
Create an experimental Risk configuration with mixed providers. |
|
Create a configurable Risk configuration with simple model specifications. |
|
Create a configurable Risk configuration from a predefined example. |
|
Create a configurable Risk configuration from detailed player configurations. |
|
Get a predefined example configuration by name. |
List all available example configurations. |
Module Contents¶
- class haive.games.risk.configurable_config.ConfigurableRiskConfig(/, **data)¶
Bases:
haive.games.risk.config.RiskConfig
Configurable Risk configuration with dynamic LLM selection.
This configuration allows users to specify different LLMs for different roles in the Risk game, providing flexibility and avoiding hardcoded models.
- Parameters:
data (Any)
- player1_model¶
Model for player1 (can be string or LLMConfig)
- player2_model¶
Model for player2 (can be string or LLMConfig)
- player1_name¶
Name for player1
- player2_name¶
Name for player2
- example_config¶
Optional example configuration name
- player_configs¶
Optional detailed player configurations
- temperature¶
Temperature for LLM generation
- enable_analysis¶
Whether to enable strategic analysis
- visualize_game¶
Whether to visualize game state
- recursion_limit¶
Python recursion limit for game execution
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_post_init(__context)¶
Initialize engines after model creation.
- Parameters:
__context (Any)
- Return type:
None
- haive.games.risk.configurable_config.create_advanced_risk_config(**kwargs)¶
Create an advanced Risk configuration with powerful models.
- Return type:
- haive.games.risk.configurable_config.create_budget_risk_config(**kwargs)¶
Create a budget-friendly Risk configuration.
- Return type:
- haive.games.risk.configurable_config.create_experimental_risk_config(**kwargs)¶
Create an experimental Risk configuration with mixed providers.
- Return type:
- haive.games.risk.configurable_config.create_risk_config(player1_model='gpt-4o', player2_model='claude-3-5-sonnet-20240620', **kwargs)¶
Create a configurable Risk configuration with simple model specifications.
- Parameters:
- Returns:
Configured Risk game
- Return type:
Examples
>>> config = create_risk_config("gpt-4o", "claude-3-opus", temperature=0.5) >>> config = create_risk_config( ... "openai:gpt-4o", ... "anthropic:claude-3-5-sonnet-20240620", ... enable_analysis=True ... )
- haive.games.risk.configurable_config.create_risk_config_from_example(example_name, **kwargs)¶
Create a configurable Risk configuration from a predefined example.
- Parameters:
example_name (str) – Name of the example configuration
**kwargs – Additional configuration parameters to override
- Returns:
Configured Risk game
- Return type:
- Available examples:
“gpt_vs_claude”: GPT vs Claude
“gpt_only”: GPT for both players
“claude_only”: Claude for both players
“budget”: Cost-effective models
“mixed”: Different provider per role
“advanced”: High-powered models for strategic gameplay
Examples
>>> config = create_risk_config_from_example("budget", enable_analysis=False) >>> config = create_risk_config_from_example("advanced", visualize_game=True)
- haive.games.risk.configurable_config.create_risk_config_from_player_configs(player_configs, **kwargs)¶
Create a configurable Risk 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 Risk game
- Return type:
- Expected roles:
“player1_player”: Player 1 configuration
“player2_player”: Player 2 configuration
“player1_analyzer”: Player 1 analyzer configuration
“player2_analyzer”: Player 2 analyzer configuration
Examples
>>> player_configs = { ... "player1_player": PlayerAgentConfig( ... llm_config="gpt-4o", ... temperature=0.7, ... player_name="Strategic General" ... ), ... "player2_player": PlayerAgentConfig( ... llm_config="claude-3-opus", ... temperature=0.3, ... player_name="Tactical Commander" ... ), ... "player1_analyzer": PlayerAgentConfig( ... llm_config="gpt-4o", ... temperature=0.2, ... player_name="Risk Strategist" ... ), ... "player2_analyzer": PlayerAgentConfig( ... llm_config="claude-3-opus", ... temperature=0.2, ... player_name="Risk Analyst" ... ), ... } >>> config = create_risk_config_from_player_configs(player_configs)
- haive.games.risk.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