tooluniverse.openalex_tool 模块

class tooluniverse.openalex_tool.OpenAlexTool[源代码]

基类:BaseTool

基于搜索关键词从 OpenAlex 检索文献的工具。

__init__(tool_config)[源代码]
run(arguments)[源代码]

工具的主要入口点。

search_literature(search_keywords, max_results=10, year_from=None, year_to=None, open_access=None, *, require_has_fulltext=False, fulltext_terms=None)[源代码]

使用 OpenAlex API 进行文献检索。

参数

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).

退货

list: List of dictionaries containing paper information.

_extract_paper_info(work)[源代码]

从OpenAlex API返回的工作对象中提取相关信息。

参数

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

退货

dict: Formatted paper information.

get_paper_by_doi(doi)[源代码]

通过其 DOI 检索特定论文。

参数

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

退货

dict: Paper information or None if not found.

get_papers_by_author(author_name, max_results=10)[源代码]

检索特定作者的论文。

参数

author_name (str): Name of the author to search for. max_results (int): Maximum number of results to return.

退货

list: List of papers by the author.

class tooluniverse.openalex_tool.OpenAlexRESTTool[源代码]

基类:BaseTool

Generic JSON-config driven OpenAlex REST tool.

Notes: - OpenAlex strongly encourages providing a contact email via the mailto query param. - This tool returns a consistent wrapper: {status, data, url} (plus error fields on failure).

__init__(tool_config)[源代码]
static _normalize_openalex_id(value)[源代码]
static _normalize_doi(value)[源代码]
_build_url_and_params(arguments)[源代码]
run(arguments)[源代码]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

参数:
  • arguments (dict, optional) – Tool-specific arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (bool, optional) – Whether parameter validation was performed

备注

These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.

For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.