games.connect4.configurable_config¶

Configurable Connect4 agent configuration using player agents.

from typing import Any This module provides a Connect4 configuration that supports configurable player agents instead of hardcoded engine configurations.

Classes¶

ConfigurableConnect4Config

Configurable Connect4 agent configuration.

Functions¶

create_connect4_config([red_model, yellow_model, ...])

Create a Connect4 configuration with simple model strings.

create_connect4_config_from_example(example_name[, ...])

Create a Connect4 configuration from an example.

create_connect4_config_from_player_configs(player_configs)

Create a Connect4 configuration from player agent configurations.

Module Contents¶

class games.connect4.configurable_config.ConfigurableConnect4Config¶

Bases: haive.core.engine.agent.agent.AgentConfig

Configurable Connect4 agent configuration.

This configuration supports using different LLM configurations for different players without hardcoding them in engines.

Examples

>>> # Simple string-based configuration
>>> config = ConfigurableConnect4Config(
...     red_model="gpt-4",
...     yellow_model="claude-3-opus"
... )
>>> # Using player agent configs
>>> config = ConfigurableConnect4Config(
...     player_configs={
...         "red_player": PlayerAgentConfig(llm_config="gpt-4"),
...         "yellow_player": PlayerAgentConfig(llm_config="claude-3-opus"),
...     }
... )
>>> # Using example configuration
>>> config = ConfigurableConnect4Config(
...     example_config="gpt_vs_claude"
... )
class Config¶

Pydantic configuration.

configure_engines_and_names()¶

Configure engines from the provided player configurations.

Return type:

Any

games.connect4.configurable_config.create_connect4_config(red_model='gpt-4o', yellow_model='claude-3-5-sonnet-20240620', temperature=0.7, enable_analysis=False, **kwargs)¶

Create a Connect4 configuration with simple model strings.

Parameters:
  • red_model (str) – Model for red player

  • yellow_model (str) – Model for yellow player

  • temperature (float) – Temperature for all engines

  • enable_analysis (bool) – Whether to enable position analysis

  • **kwargs – Additional configuration parameters

Returns:

Configured Connect4 agent

Return type:

ConfigurableConnect4Config

Example

>>> config = create_connect4_config("gpt-4", "claude-3-opus", temperature=0.8)
games.connect4.configurable_config.create_connect4_config_from_example(example_name, enable_analysis=False, **kwargs)¶

Create a Connect4 configuration from an example.

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

  • enable_analysis (bool) – Whether to enable position analysis

  • **kwargs – Additional configuration parameters

Returns:

Configured Connect4 agent

Return type:

ConfigurableConnect4Config

Available examples: gpt_vs_claude, gpt_only, claude_only, budget, mixed

Example

>>> config = create_connect4_config_from_example("budget")
games.connect4.configurable_config.create_connect4_config_from_player_configs(player_configs, enable_analysis=False, **kwargs)¶

Create a Connect4 configuration from player agent configurations.

Parameters:
Returns:

Configured Connect4 agent

Return type:

ConfigurableConnect4Config

Example

>>> configs = {
...     "red_player": create_player_config("gpt-4", player_name="Red Master"),
...     "yellow_player": create_player_config("claude-3-opus", player_name="Yellow Pro"),
... }
>>> config = create_connect4_config_from_player_configs(configs)