tooluniverse.openalex_tool moduleΒΆ

class tooluniverse.openalex_tool.OpenAlexTool(tool_config)[source]ΒΆ

Bases: BaseTool

Tool to retrieve literature from OpenAlex based on search keywords.

__init__(tool_config)[source]ΒΆ
_extract_paper_info(work)[source]ΒΆ

Extract relevant information from a work object returned by OpenAlex API.

Parameters:

work (dict) – Work object from OpenAlex API response.

Returns:

Formatted paper information.

Return type:

dict

get_paper_by_doi(doi)[source]ΒΆ

Retrieve a specific paper by its DOI.

Parameters:

doi (str) – DOI of the paper to retrieve.

Returns:

Paper information or None if not found.

Return type:

dict

get_papers_by_author(author_name, max_results=10)[source]ΒΆ

Retrieve papers by a specific author.

Parameters:
  • author_name (str) – Name of the author to search for.

  • max_results (int) – Maximum number of results to return.

Returns:

List of papers by the author.

Return type:

list

run(arguments)[source]ΒΆ

Main entry point for the tool.

search_literature(search_keywords, max_results=10, year_from=None, year_to=None, open_access=None)[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:

list