tooluniverse.openalex_tool module¶
- class tooluniverse.openalex_tool.BaseTool(tool_config)[source][source]¶
Bases:
object
- classmethod get_default_config_file()[source][source]¶
Get the path to the default configuration file for this tool type.
This method uses a robust path resolution strategy that works across different installation scenarios:
Installed packages: Uses importlib.resources for proper package resource access
Development mode: Falls back to file-based path resolution
Legacy Python: Handles importlib.resources and importlib_resources
Override this method in subclasses to specify a custom defaults file.
- Returns:
Path or resource object pointing to the defaults file
- tooluniverse.openalex_tool.register_tool(tool_type_name=None, config=None)[source][source]¶
Decorator to automatically register tool classes and their configs.
- Usage:
@register_tool(‘CustomToolName’, config={…}) class MyTool:
pass
- class tooluniverse.openalex_tool.OpenAlexTool(tool_config)[source][source]¶
Bases:
BaseTool
Tool to retrieve literature from OpenAlex based on search keywords.
- search_literature(search_keywords, max_results=10, year_from=None, year_to=None, open_access=None)[source][source]¶
Search for literature using OpenAlex API.
- Parameters:
search_keywords (str) – Keywords to search for in title, abstract, and content.
max_results (int) – Maximum number of results to return (default: 10).
year_from (int) – Start year for publication date filter (optional).
year_to (int) – End year for publication date filter (optional).
open_access (bool) – Filter for open access papers only (optional).
- Returns:
List of dictionaries containing paper information.
- Return type: