games.chess.configurable_engines

Configurable chess engines using the new player agent system.

This module provides chess engine configurations that use configurable player agents instead of hardcoded LLM configurations, making it easy to switch LLMs for different players.

Functions

create_anthropic_vs_openai_engines([white_model, ...])

Create chess engines with Anthropic vs OpenAI models.

create_chess_analysis_prompt(color)

Create a chess analysis prompt for the specified color.

create_chess_move_prompt(color)

Create a chess move prompt for the specified color.

create_configurable_chess_engines(player_configs)

Create chess engines from configurable player agents.

create_mixed_provider_engines([providers, temperature])

Create chess engines with different providers for each role.

create_same_model_engines([model, temperature])

Create chess engines using the same model for all roles.

get_chess_role_definitions()

Get role definitions for chess players and analyzers.

get_example_engines(config_name)

Get example engine configuration by name.

Module Contents

games.chess.configurable_engines.create_anthropic_vs_openai_engines(white_model='claude-3-5-sonnet-20240620', black_model='gpt-4o', temperature=0.7)

Create chess engines with Anthropic vs OpenAI models.

Parameters:
  • white_model (str) – Anthropic model for white player

  • black_model (str) – OpenAI model for black player

  • temperature (float) – Temperature for all engines

Returns:

Dictionary of engines

Return type:

Dict[str, AugLLMConfig]

games.chess.configurable_engines.create_chess_analysis_prompt(color)

Create a chess analysis prompt for the specified color.

Parameters:

color (str) – Player color (“white” or “black”)

Returns:

Prompt template for position analysis

Return type:

ChatPromptTemplate

games.chess.configurable_engines.create_chess_move_prompt(color)

Create a chess move prompt for the specified color.

Parameters:

color (str) – Player color (“white” or “black”)

Returns:

Prompt template for move generation

Return type:

ChatPromptTemplate

games.chess.configurable_engines.create_configurable_chess_engines(player_configs)

Create chess engines from configurable player agents.

Parameters:

player_configs (dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig]) – Dictionary of role name to player configuration

Returns:

Dictionary of configured engines

Return type:

Dict[str, AugLLMConfig]

Example

>>> configs = {
...     "white_player": PlayerAgentConfig(llm_config="gpt-4"),
...     "black_player": PlayerAgentConfig(llm_config="claude-3-opus"),
...     "white_analyzer": PlayerAgentConfig(llm_config="gpt-4"),
...     "black_analyzer": PlayerAgentConfig(llm_config="claude-3-opus"),
... }
>>> engines = create_configurable_chess_engines(configs)
games.chess.configurable_engines.create_mixed_provider_engines(providers=None, temperature=0.7)

Create chess engines with different providers for each role.

Parameters:
  • providers (dict[str, str]) – Dictionary of role to model string

  • temperature (float) – Temperature for all engines

Returns:

Dictionary of engines

Return type:

Dict[str, AugLLMConfig]

games.chess.configurable_engines.create_same_model_engines(model='gpt-4o', temperature=0.7)

Create chess engines using the same model for all roles.

Parameters:
  • model (str) – Model string to use for all roles

  • temperature (float) – Temperature for all engines

Returns:

Dictionary of engines

Return type:

Dict[str, AugLLMConfig]

games.chess.configurable_engines.get_chess_role_definitions()

Get role definitions for chess players and analyzers.

Returns:

Dictionary of role definitions

Return type:

Dict[str, GamePlayerRole]

games.chess.configurable_engines.get_example_engines(config_name)

Get example engine configuration by name.

Parameters:

config_name (str) – Name of the configuration from EXAMPLE_CONFIGS

Returns:

Dictionary of engines

Return type:

Dict[str, AugLLMConfig]

Available configs: anthropic_vs_openai, gpt4_only, claude_only,

mixed_providers, budget_friendly