agents.discovery.selection_strategies¶
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¶
Adaptive selection that learns from usage patterns. |
|
Base class for tool selection strategies. |
|
Capability-based tool selection. |
|
Context-aware tool selection considering conversation history. |
|
Ensemble strategy combining multiple selection approaches. |
|
Selection strategy that learns from user feedback and tool performance. |
|
Semantic similarity-based tool selection. |
Functions¶
|
Create a selection strategy by name. |
Module Contents¶
- class agents.discovery.selection_strategies.AdaptiveSelectionStrategy(learning_rate=0.1)¶
Bases:
BaseSelectionStrategy
Adaptive selection that learns from usage patterns.
Init .
- Parameters:
learning_rate (float) – [TODO: Add description]
- async select_tools(query, available_tools, context, max_tools=5)¶
Select tools using adaptive learning.
- class agents.discovery.selection_strategies.BaseSelectionStrategy¶
Bases:
abc.ABC
Base class for tool selection strategies.
- abstractmethod select_tools(query, available_tools, context, max_tools=5)¶
- Async:
- Parameters:
- Return type:
haive.agents.discovery.dynamic_tool_selector.ToolSelectionResult
Select tools based on strategy.
- class agents.discovery.selection_strategies.CapabilityBasedStrategy(capability_weights=None)¶
Bases:
BaseSelectionStrategy
Capability-based tool selection.
Init .
- async select_tools(query, available_tools, context, max_tools=5)¶
Select tools based on capability matching.
- class agents.discovery.selection_strategies.ContextualSelectionStrategy(context_weight=0.3)¶
Bases:
BaseSelectionStrategy
Context-aware tool selection considering conversation history.
Init .
- Parameters:
context_weight (float) – [TODO: Add description]
- async select_tools(query, available_tools, context, max_tools=5)¶
Select tools considering full context.
- class agents.discovery.selection_strategies.EnsembleSelectionStrategy(strategies=None)¶
Bases:
BaseSelectionStrategy
Ensemble strategy combining multiple selection approaches.
Init .
- Parameters:
strategies (list[BaseSelectionStrategy] | None) – [TODO: Add description]
- async select_tools(query, available_tools, context, max_tools=5)¶
Select tools using ensemble of strategies.
- class agents.discovery.selection_strategies.LearningSelectionStrategy¶
Bases:
BaseSelectionStrategy
Selection strategy that learns from user feedback and tool performance.
Init .
- Returns:
Add return description]
- Return type:
[TODO
- add_feedback(tool_name, rating, context, feedback_data)¶
Add user feedback for learning.
- async select_tools(query, available_tools, context, max_tools=5)¶
Select tools using learned patterns and feedback.
- class agents.discovery.selection_strategies.SemanticSelectionStrategy(similarity_threshold=0.7)¶
Bases:
BaseSelectionStrategy
Semantic similarity-based tool selection.
Init .
- Parameters:
similarity_threshold (float) – [TODO: Add description]
- async select_tools(query, available_tools, context, max_tools=5)¶
Select tools based on semantic similarity to query.