games.mastermind.configurable_config¶

Configurable Mastermind configuration using the generic player agent system.

This module provides configurable Mastermind game configurations that replace hardcoded LLM settings with dynamic, configurable player agents.

Classes¶

ConfigurableMastermindConfig

Configurable Mastermind configuration with dynamic LLM selection.

Functions¶

create_advanced_mastermind_config(**kwargs)

Create an advanced Mastermind configuration with powerful models.

create_budget_mastermind_config(**kwargs)

Create a budget-friendly Mastermind configuration.

create_experimental_mastermind_config(**kwargs)

Create an experimental Mastermind configuration with mixed providers.

create_mastermind_config([codemaker_model, ...])

Create a configurable Mastermind configuration with simple model specifications.

create_mastermind_config_from_example(example_name, ...)

Create a configurable Mastermind configuration from a predefined example.

create_mastermind_config_from_player_configs(...)

Create a configurable Mastermind configuration from detailed player.

get_example_config(name)

Get a predefined example configuration by name.

list_example_configurations()

List all available example configurations.

Module Contents¶

class games.mastermind.configurable_config.ConfigurableMastermindConfig¶

Bases: haive.games.mastermind.config.MastermindConfig

Configurable Mastermind configuration with dynamic LLM selection.

This configuration allows users to specify different LLMs for different roles in the Mastermind game, providing flexibility and avoiding hardcoded models.

codemaker_model¶

Model for codemaker (can be string or LLMConfig)

codebreaker_model¶

Model for codebreaker (can be string or LLMConfig)

codemaker_name¶

Name for codemaker

codebreaker_name¶

Name for codebreaker

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

model_post_init(__context)¶

Initialize engines after model creation.

Parameters:

__context (Any)

Return type:

None

games.mastermind.configurable_config.create_advanced_mastermind_config(**kwargs)¶

Create an advanced Mastermind configuration with powerful models.

Return type:

ConfigurableMastermindConfig

games.mastermind.configurable_config.create_budget_mastermind_config(**kwargs)¶

Create a budget-friendly Mastermind configuration.

Return type:

ConfigurableMastermindConfig

games.mastermind.configurable_config.create_experimental_mastermind_config(**kwargs)¶

Create an experimental Mastermind configuration with mixed providers.

Return type:

ConfigurableMastermindConfig

games.mastermind.configurable_config.create_mastermind_config(codemaker_model='gpt-4o', codebreaker_model='claude-3-5-sonnet-20240620', **kwargs)¶

Create a configurable Mastermind configuration with simple model specifications.

Parameters:
  • codemaker_model (str) – Model for codemaker and analyzer

  • codebreaker_model (str) – Model for codebreaker and analyzer

  • **kwargs – Additional configuration parameters

Returns:

Configured Mastermind game

Return type:

ConfigurableMastermindConfig

Examples

>>> config = create_mastermind_config("gpt-4o", "claude-3-opus", temperature=0.5)
>>> config = create_mastermind_config(
...     "openai:gpt-4o",
...     "anthropic:claude-3-5-sonnet-20240620",
...     enable_analysis=True
... )
games.mastermind.configurable_config.create_mastermind_config_from_example(example_name, **kwargs)¶

Create a configurable Mastermind configuration from a predefined example.

Parameters:
  • example_name (str) – Name of the example configuration

  • **kwargs – Additional configuration parameters to override

Returns:

Configured Mastermind game

Return type:

ConfigurableMastermindConfig

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_mastermind_config_from_example("budget", enable_analysis=False)
>>> config = create_mastermind_config_from_example("advanced", visualize_game=True)
games.mastermind.configurable_config.create_mastermind_config_from_player_configs(player_configs, **kwargs)¶

Create a configurable Mastermind configuration from detailed player. configurations.

Parameters:
Returns:

Configured Mastermind game

Return type:

ConfigurableMastermindConfig

Expected roles:
  • “codemaker_player”: Player 1 configuration

  • “codebreaker_player”: Player 2 configuration

  • “codemaker_analyzer”: Player 1 analyzer configuration

  • “codebreaker_analyzer”: Player 2 analyzer configuration

Examples

>>> player_configs = {
...     "codemaker_player": PlayerAgentConfig(
...         llm_config="gpt-4o",
...         temperature=0.7,
...         player_name="Strategic Codemaker"
...     ),
...     "codebreaker_player": PlayerAgentConfig(
...         llm_config="claude-3-opus",
...         temperature=0.3,
...         player_name="Tactical Codebreaker"
...     ),
...     "codemaker_analyzer": PlayerAgentConfig(
...         llm_config="gpt-4o",
...         temperature=0.2,
...         player_name="Mastermind Strategist"
...     ),
...     "codebreaker_analyzer": PlayerAgentConfig(
...         llm_config="claude-3-opus",
...         temperature=0.2,
...         player_name="Mastermind Analyst"
...     ),
... }
>>> config = create_mastermind_config_from_player_configs(player_configs)
games.mastermind.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:

ConfigurableMastermindConfig

Raises:

ValueError – If the example name is not found

games.mastermind.configurable_config.list_example_configurations()¶

List all available example configurations.

Returns:

Mapping of configuration names to descriptions

Return type:

Dict[str, str]