haive.games.checkers.generic_engines ==================================== .. py:module:: haive.games.checkers.generic_engines .. autoapi-nested-parse:: Generic Checkers engines using the new generic player agent system. from typing import Any This module demonstrates how to use the generic player agent system for Checkers, showing the same pattern working across different games with different player identifiers. Classes ------- .. autoapisummary:: haive.games.checkers.generic_engines.CheckersPromptGenerator Functions --------- .. autoapisummary:: haive.games.checkers.generic_engines.compare_checkers_with_other_games haive.games.checkers.generic_engines.create_generic_checkers_config_from_example haive.games.checkers.generic_engines.create_generic_checkers_engines haive.games.checkers.generic_engines.create_generic_checkers_engines_simple haive.games.checkers.generic_engines.create_multi_game_checkers_demo Module Contents --------------- .. py:class:: CheckersPromptGenerator(players) Bases: :py:obj:`haive.games.core.agent.generic_player_agent.GenericPromptGenerator`\ [\ :py:obj:`str`\ , :py:obj:`str`\ ] Checkers-specific prompt generator using the generic system. Init . :param players: [TODO: Add description] .. py:method:: create_analysis_prompt(player) Create a Checkers analysis prompt for the specified player. :param player: Player color ("red" or "black") :returns: Prompt template for position analysis :rtype: ChatPromptTemplate .. py:method:: create_move_prompt(player) Create a Checkers move prompt for the specified player. :param player: Player color ("red" or "black") :returns: Prompt template for move generation :rtype: ChatPromptTemplate .. py:method:: get_analysis_output_model() Get the structured output model for Checkers analysis. .. py:method:: get_move_output_model() Get the structured output model for Checkers moves. .. py:function:: compare_checkers_with_other_games() Compare the checkers pattern with other games to show generalization. This function demonstrates how the same generic system works for different games with different player naming conventions. .. py:function:: create_generic_checkers_config_from_example(example_name, temperature = 0.3) Create Checkers engines from predefined examples using generics. :param example_name: Name of the example configuration :param temperature: Temperature for all engines :returns: Dictionary of engines :rtype: dict[str, AugLLMConfig] Available examples: - "gpt_vs_claude": GPT-4 vs Claude - "gpt_only": GPT-4 for both players - "claude_only": Claude for both players - "budget": Cost-effective models - "mixed": Different provider per role - "checkers_masters": High-powered models for competitive play .. py:function:: create_generic_checkers_engines(player_configs) Create Checkers engines using the generic system. :param player_configs: Dictionary of role name to player configuration :returns: Dictionary of configured engines :rtype: dict[str, AugLLMConfig] .. rubric:: Example >>> configs = { ... "red_player": PlayerAgentConfig(llm_config="gpt-4"), ... "black_player": PlayerAgentConfig(llm_config="claude-3-opus"), ... "red_analyzer": PlayerAgentConfig(llm_config="gpt-4"), ... "black_analyzer": PlayerAgentConfig(llm_config="claude-3-opus"), ... } >>> engines = create_generic_checkers_engines(configs) .. py:function:: create_generic_checkers_engines_simple(red_model = 'gpt-4o', black_model = 'claude-3-5-sonnet-20240620', temperature = 0.3, **kwargs) Create Checkers engines with simple model configurations using generics. :param red_model: Model for red player and analyzer :param black_model: Model for black player and analyzer :param temperature: Temperature for player engines :param \*\*kwargs: Additional configuration parameters :returns: Dictionary of engines :rtype: dict[str, AugLLMConfig] .. rubric:: Example >>> engines = create_generic_checkers_engines_simple("gpt-4", "claude-3-opus") >>> engines = create_generic_checkers_engines_simple( ... "openai:gpt-4o", ... "anthropic:claude-3-5-sonnet-20240620", ... temperature=0.5 ... ) .. py:function:: create_multi_game_checkers_demo() Create engines for multiple games including checkers. This demonstrates how the same configuration approach works across different games with the generic system.