mindroot.lib.providers package¶
Subpackages¶
Submodules¶
mindroot.lib.providers.commands module¶
mindroot.lib.providers.hooks module¶
mindroot.lib.providers.missing module¶
- async mindroot.lib.providers.missing.get_missing_commands(agent_name=None, context=None)[source]¶
Identify commands that are used in agent instructions but not available in the system.
- Parameters:
agent_name (str, optional) – Name of the agent to check
- Returns:
Mapping of missing commands and potential plugins that provide them
- Return type:
dict
mindroot.lib.providers.model_preferences_v2 module¶
- class mindroot.lib.providers.model_preferences_v2.ModelPreferencesV2[source]¶
Bases:
objectNew model preferences system supporting ordered provider/model pairs for fallback selection.
- add_preference(service: str, provider: str, model: str, position: int | None = None) None[source]¶
Add a provider/model preference for a service at specified position (or end).
- ensure_preferences_exist() None[source]¶
Copy template preferences file to data directory if it doesn’t exist.
- get_ordered_providers_for_service(service_name: str) List[Tuple[str, str]][source]¶
Get ordered list of (provider, model) pairs for a service.
- get_preferences() Dict[str, List[List[str]]][source]¶
Get preferences in new format: {service: [[provider, model], …]}
- migrate_from_old_format(old_preferences: List[Dict]) Dict[str, List[List[str]]][source]¶
Convert old format preferences to new format.
Old format: [{“service_or_command_name”: “stream_chat”, “flag”: “default”, “model”: “claude-3”}] New format: {“stream_chat”: [[“ah_anthropic”, “claude-3.5-sonnet”]]}
- remove_preference(service: str, provider: str, model: str) bool[source]¶
Remove a provider/model preference for a service. Returns True if removed.
mindroot.lib.providers.services module¶
- mindroot.lib.providers.services.service_class(protocol: Type[P], *, flags=[])[source]¶
Class decorator that registers all Protocol methods as services.
This enables class-based service implementations with IDE autocomplete when inheriting from a Protocol.
- Parameters:
protocol – The Protocol class being implemented. Only methods defined in this Protocol will be registered as services.
flags – Optional flags to pass to each service registration.
Example
from mindroot.services import service_class from mindroot.protocols import LLM
@service_class(LLM) class DeepSeekLLM(LLM):
- async def stream_chat(self, model: str, messages: list = None,
context = None, …) -> AsyncIterator[str]:
# IDE autocomplete works here! …
- async def format_image_message(self, pil_image, context = None) -> dict:
…
The decorator will: 1. Instantiate the class (must have no required __init__ args) 2. Find all methods that are defined in the Protocol 3. Register each matching method as a service