haive.games.chess.llm_utils

Chess-specific LLM utilities using the game LLM factory.

This module provides chess-specific utilities for creating and configuring LLMs for chess gameplay, building on the core LLM factory system.

Functions

create_chess_engines_from_config(white_config, ...[, ...])

Create chess engines from simple configuration dictionaries.

create_chess_engines_simple([white_provider, ...])

Create chess engines with simple provider/model specification.

get_available_chess_providers()

Get list of available LLM providers for chess.

get_recommended_chess_models()

Get recommended models for chess gameplay.

Module Contents

haive.games.chess.llm_utils.create_chess_engines_from_config(white_config, black_config, enable_analysis=True, analyzer_configs=None)

Create chess engines from simple configuration dictionaries.

Parameters:
  • white_config (dict[str, Any]) – Config for white player with ‘provider’, ‘model’, etc.

  • black_config (dict[str, Any]) – Config for black player with ‘provider’, ‘model’, etc.

  • enable_analysis (bool) – Whether to create analyzer engines

  • analyzer_configs (dict[str, dict[str, Any]] | None) – Optional separate configs for analyzers

Returns:

Dictionary of AugLLMConfig objects for all chess roles

Return type:

dict[str, haive.core.engine.aug_llm.AugLLMConfig]

Examples

>>> # Simple provider-only config
>>> engines = create_chess_engines_from_config(
...     white_config={"provider": "anthropic"},
...     black_config={"provider": "openai"}
... )
>>> # With custom models
>>> engines = create_chess_engines_from_config(
...     white_config={
...         "provider": "anthropic",
...         "model": "claude-3-opus-20240229"
...     },
...     black_config={
...         "provider": "azure",
...         "model": "gpt-4-turbo"
...     }
... )
>>> # Separate analyzer configs
>>> engines = create_chess_engines_from_config(
...     white_config={"provider": "anthropic"},
...     black_config={"provider": "openai"},
...     analyzer_configs={
...         "white": {"provider": "azure"},
...         "black": {"provider": "azure"}
...     }
... )
haive.games.chess.llm_utils.create_chess_engines_simple(white_provider='anthropic', white_model=None, black_provider='anthropic', black_model=None, temperature=None, enable_analysis=True)

Create chess engines with simple provider/model specification.

Parameters:
  • white_provider (str) – Provider for white (e.g., “anthropic”, “openai”)

  • white_model (str | None) – Model for white (uses default if None)

  • black_provider (str) – Provider for black

  • black_model (str | None) – Model for black (uses default if None)

  • temperature (float | None) – Temperature for all engines

  • enable_analysis (bool) – Whether to create analyzer engines

Returns:

Dictionary of AugLLMConfig objects

Return type:

dict[str, haive.core.engine.aug_llm.AugLLMConfig]

Examples

>>> # Use defaults
>>> engines = create_chess_engines_simple()
>>> # Different providers
>>> engines = create_chess_engines_simple(
...     white_provider="anthropic",
...     black_provider="openai"
... )
>>> # Custom models
>>> engines = create_chess_engines_simple(
...     white_provider="anthropic",
...     white_model="claude-3-opus-20240229",
...     black_provider="openai",
...     black_model="gpt-4-turbo"
... )
haive.games.chess.llm_utils.get_available_chess_providers()

Get list of available LLM providers for chess.

Returns:

List of provider names

Return type:

list[str]

Get recommended models for chess gameplay.

Returns:

Dictionary mapping providers to recommended models

Return type:

dict[str, str]