haive.games.connect4.generic_engines ==================================== .. py:module:: haive.games.connect4.generic_engines .. autoapi-nested-parse:: Generic Connect4 engines using the new generic player agent system. This module demonstrates how to use the generic player agent system for Connect4, showing the same pattern working with red/yellow player identifiers. Classes ------- .. autoapisummary:: haive.games.connect4.generic_engines.Connect4PromptGenerator Functions --------- .. autoapisummary:: haive.games.connect4.generic_engines.create_generic_connect4_config_from_example haive.games.connect4.generic_engines.create_generic_connect4_engines haive.games.connect4.generic_engines.create_generic_connect4_engines_simple Module Contents --------------- .. py:class:: Connect4PromptGenerator(players) Bases: :py:obj:`haive.games.core.agent.generic_player_agent.GenericPromptGenerator`\ [\ :py:obj:`str`\ , :py:obj:`str`\ ] Connect4-specific prompt generator using the generic system. Init . :param players: [TODO: Add description] .. py:method:: create_analysis_prompt(player) Create a Connect4 analysis prompt for the specified player. :param player: Player color ("red" or "yellow") :returns: Prompt template for position analysis :rtype: ChatPromptTemplate .. py:method:: create_move_prompt(player) Create a Connect4 move prompt for the specified player. :param player: Player color ("red" or "yellow") :returns: Prompt template for move generation :rtype: ChatPromptTemplate .. py:method:: get_analysis_output_model() Get the structured output model for Connect4 analysis. .. py:method:: get_move_output_model() Get the structured output model for Connect4 moves. .. py:function:: create_generic_connect4_config_from_example(example_name, temperature = 0.7) Create Connect4 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 .. py:function:: create_generic_connect4_engines(player_configs) Create Connect4 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"), ... "yellow_player": PlayerAgentConfig(llm_config="claude-3-opus"), ... "red_analyzer": PlayerAgentConfig(llm_config="gpt-4"), ... "yellow_analyzer": PlayerAgentConfig(llm_config="claude-3-opus"), ... } >>> engines = create_generic_connect4_engines(configs) .. py:function:: create_generic_connect4_engines_simple(red_model = 'gpt-4o', yellow_model = 'claude-3-5-sonnet-20240620', temperature = 0.7, **kwargs) Create Connect4 engines with simple model configurations using generics. :param red_model: Model for red player and analyzer :param yellow_model: Model for yellow 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_connect4_engines_simple("gpt-4", "claude-3-opus") >>> engines = create_generic_connect4_engines_simple( ... "openai:gpt-4o", ... "anthropic:claude-3-5-sonnet-20240620", ... temperature=0.8 ... )