haive.games.llm_config_factory¶

Unified LLM configuration factory for games.

This module provides a simplified factory for creating LLM configurations for game agents, leveraging the new haive.core.models.llm factory system.

Classes¶

GameLLMFactory

Factory for creating game-specific LLM configurations.

Functions¶

get_model_info(model)

Placeholder for model info - not yet implemented in core.

list_available_models()

Placeholder for listing models - not yet implemented in core.

Module Contents¶

class haive.games.llm_config_factory.GameLLMFactory¶

Factory for creating game-specific LLM configurations.

This factory simplifies the process of creating LLM configurations for games by providing game-optimized defaults and leveraging the core LLM factory.

classmethod create_game_llm_pair(player1_model='gpt-4', player2_model='gpt-4', game_type='strategic', temperature=None)¶

Create a pair of LLM configs for two-player games.

Parameters:
  • player1_model (str) – Model string for player 1

  • player2_model (str) – Model string for player 2

  • game_type (str) – Type of game for temperature defaults

  • temperature (float | None) – Override temperature for both players

Returns:

Tuple of (player1_config, player2_config)

Return type:

tuple[haive.games.models.llm.LLMConfig, haive.games.models.llm.LLMConfig]

Examples

>>> # Same model
>>> p1, p2 = GameLLMFactory.create_game_llm_pair("gpt-4")
>>> # Different models
>>> p1, p2 = GameLLMFactory.create_game_llm_pair(
...     "claude-3-opus",
...     "gpt-4"
... )
>>> # With providers
>>> p1, p2 = GameLLMFactory.create_game_llm_pair(
...     "anthropic:claude-3-opus",
...     "openai:gpt-4"
... )
classmethod create_llm_config(model, temperature=None, game_type='default', **kwargs)¶

Create an LLM configuration for a game.

This method wraps the core create_llm_config with game-specific defaults.

Parameters:
  • model (str) – Model string (e.g., “gpt-4”, “claude-3-opus”, “anthropic:claude-3-sonnet”)

  • temperature (float | None) – Temperature setting (uses game_type default if None)

  • game_type (str) – Type of game (“strategic”, “creative”, “precise”, “competitive”)

  • **kwargs – Additional parameters

Returns:

Configured LLM instance

Return type:

LLMConfig

Examples

>>> # Simple usage
>>> config = GameLLMFactory.create_llm_config("gpt-4")
>>> # Game-specific temperature
>>> config = GameLLMFactory.create_llm_config(
...     "claude-3-opus",
...     game_type="strategic"
... )
>>> # Custom parameters
>>> config = GameLLMFactory.create_llm_config(
...     "gpt-4",
...     temperature=0.5,
...     max_tokens=1000
... )

Get recommended model for a game type.

Parameters:
  • game_type (str) – Type of game (“chess”, “creative”, “strategic”)

  • performance (str) – Performance tier (“fast”, “default”, “strong”)

Returns:

Recommended model string

Return type:

str

Examples

>>> # Get default chess model
>>> model = GameLLMFactory.get_recommended_model("chess")
>>> print(model)  # "gpt-4"
>>> # Get fast creative model
>>> model = GameLLMFactory.get_recommended_model("creative", "fast")
>>> print(model)  # "gpt-3.5-turbo"
classmethod list_game_models(game_type=None)¶

List available models for games.

Parameters:

game_type (str | None) – Optional game type to get recommendations for

Returns:

Dictionary with model information

Return type:

dict[str, Any]

Examples

>>> models = GameLLMFactory.list_game_models("chess")
>>> print(models["recommendations"])
haive.games.llm_config_factory.get_model_info(model)¶

Placeholder for model info - not yet implemented in core.

Parameters:

model (str)

Return type:

dict[str, Any]

haive.games.llm_config_factory.list_available_models()¶

Placeholder for listing models - not yet implemented in core.

Return type:

list