haive.agents.discovery.selection_strategies =========================================== .. py:module:: haive.agents.discovery.selection_strategies .. autoapi-nested-parse:: Tool selection strategies for dynamic tool selection. This module implements various strategies for selecting tools based on different criteria and approaches, providing flexibility in how tools are chosen for different contexts and use cases. Classes ------- .. autoapisummary:: haive.agents.discovery.selection_strategies.AdaptiveSelectionStrategy haive.agents.discovery.selection_strategies.BaseSelectionStrategy haive.agents.discovery.selection_strategies.CapabilityBasedStrategy haive.agents.discovery.selection_strategies.ContextualSelectionStrategy haive.agents.discovery.selection_strategies.EnsembleSelectionStrategy haive.agents.discovery.selection_strategies.LearningSelectionStrategy haive.agents.discovery.selection_strategies.SemanticSelectionStrategy Functions --------- .. autoapisummary:: haive.agents.discovery.selection_strategies.create_selection_strategy Module Contents --------------- .. py:class:: AdaptiveSelectionStrategy(learning_rate = 0.1) Bases: :py:obj:`BaseSelectionStrategy` Adaptive selection that learns from usage patterns. Init . :param learning_rate: [TODO: Add description] .. py:method:: select_tools(query, available_tools, context, max_tools = 5) :async: Select tools using adaptive learning. .. py:method:: update_performance(tool_name, success) Update tool performance based on execution results. .. py:class:: BaseSelectionStrategy Bases: :py:obj:`abc.ABC` Base class for tool selection strategies. .. py:method:: select_tools(query, available_tools, context, max_tools = 5) :abstractmethod: :async: Select tools based on strategy. .. py:class:: CapabilityBasedStrategy(capability_weights = None) Bases: :py:obj:`BaseSelectionStrategy` Capability-based tool selection. Init . :param capability_weights: [TODO: Add description] .. py:method:: select_tools(query, available_tools, context, max_tools = 5) :async: Select tools based on capability matching. .. py:class:: ContextualSelectionStrategy(context_weight = 0.3) Bases: :py:obj:`BaseSelectionStrategy` Context-aware tool selection considering conversation history. Init . :param context_weight: [TODO: Add description] .. py:method:: select_tools(query, available_tools, context, max_tools = 5) :async: Select tools considering full context. .. py:class:: EnsembleSelectionStrategy(strategies = None) Bases: :py:obj:`BaseSelectionStrategy` Ensemble strategy combining multiple selection approaches. Init . :param strategies: [TODO: Add description] .. py:method:: select_tools(query, available_tools, context, max_tools = 5) :async: Select tools using ensemble of strategies. .. py:class:: LearningSelectionStrategy Bases: :py:obj:`BaseSelectionStrategy` Selection strategy that learns from user feedback and tool performance. Init . :returns: Add return description] :rtype: [TODO .. py:method:: add_feedback(tool_name, rating, context, feedback_data) Add user feedback for learning. .. py:method:: select_tools(query, available_tools, context, max_tools = 5) :async: Select tools using learned patterns and feedback. .. py:class:: SemanticSelectionStrategy(similarity_threshold = 0.7) Bases: :py:obj:`BaseSelectionStrategy` Semantic similarity-based tool selection. Init . :param similarity_threshold: [TODO: Add description] .. py:method:: select_tools(query, available_tools, context, max_tools = 5) :async: Select tools based on semantic similarity to query. .. py:function:: create_selection_strategy(strategy_name, **kwargs) Create a selection strategy by name.