Base class for all research tools in the ml_research_tools package. Provides standard interface for argument parsing and execution.

class ml_research_tools.core.base_tool.BaseTool(services)[source]#

Bases: ABC

Base class for all research tools.

This class defines a standard interface that all tools should implement, including methods for parsing arguments and executing the tool’s functionality.

Initialize the tool with default values.

Parameters:

services (ServiceProvider)

name: str = 'base_tool'#
description: str = 'Base tool description'#
__init__(services)[source]#

Initialize the tool with default values.

Parameters:

services (ServiceProvider)

Return type:

None

abstractmethod classmethod add_arguments(parser)[source]#

Add tool-specific arguments to the argument parser.

Parameters:

parser (ArgumentParser) – The argument parser to add arguments to

Return type:

None

classmethod add_subparser(subparsers)[source]#

Add a subparser for this tool to a parent parser’s subparsers.

Parameters:

subparsers (_SubParsersAction) – subparsers object from the parent parser

Return type:

ArgumentParser

Returns:

The created subparser

abstractmethod execute(config, args)[source]#

Execute the tool with the provided arguments.

Parameters:
  • config (Config) – Configuration object

  • args (Namespace) – Parsed command-line arguments

Return type:

int

Returns:

Exit code (0 for success, non-zero for error)

execute_from_args(args)[source]#

Execute the tool from parsed arguments.

Parameters:

args (Namespace) – Parsed command-line arguments

Return type:

int

Returns:

Exit code (0 for success, non-zero for error)

parse_and_execute(args=None)[source]#

Parse command-line arguments and execute the tool.

Parameters:

args (Optional[List[str]]) – Command-line arguments (uses sys.argv if None)

Return type:

int

Returns:

Exit code (0 for success, non-zero for error)

create_progress(**kwargs)[source]#

Create a progress bar with rich formatting.

Return type:

Progress

Returns:

Rich Progress object

Parameters:

kwargs (Any)