SemanticScholarAPIWrapper#

class langchain_community.utilities.semanticscholar.SemanticScholarAPIWrapper[source]#

Bases: BaseModel

Wrapper around semanticscholar.org API. danielnsilva/semanticscholar

You should have this library installed.

pip install semanticscholar

Semantic Scholar API can conduct searches and fetch document metadata like title, abstract, authors, etc.

Attributes: top_k_results: number of the top-scored document used for the Semantic Scholar tool load_max_docs: a limit to the number of loaded documents

Example: .. code-block:: python

from langchain_community.utilities.semanticscholar import SemanticScholarAPIWrapper ss = SemanticScholarAPIWrapper(

top_k_results = 3, load_max_docs = 3

) ss.run(โ€œbiases in large language modelsโ€)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param S2_MAX_QUERY_LENGTH: int = 300#
param doc_content_chars_max: int | None = 4000#
param load_max_docs: int = 100#
param returned_fields: List[str] = ['title', 'abstract', 'venue', 'year', 'paperId', 'citationCount', 'openAccessPdf', 'authors', 'externalIds']#
param top_k_results: int = 5#
run(query: str) โ†’ str[source]#

Run the Semantic Scholar API.

Parameters:

query (str)

Return type:

str