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 if the input data cannot be parsed to form a valid model.

param S2_MAX_QUERY_LENGTH: int = 300#
param doc_content_chars_max: int | None = 4000#
param load_max_docs: int = 100#
param top_k_results: int = 5#
run(query: str) β†’ str[source]#

Run the Semantic Scholar API.

Parameters:

query (str) –

Return type:

str