langchain.utilities.pupmed.PubMedAPIWrapper¶

class langchain.utilities.pupmed.PubMedAPIWrapper(*, top_k_results: int = 3, load_max_docs: int = 25, doc_content_chars_max: int = 2000, load_all_available_meta: bool = False, email: str = 'your_email@example.com', base_url_esearch: str = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?', base_url_efetch: str = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?', max_retry: int = 5, sleep_time: float = 0.2, ARXIV_MAX_QUERY_LENGTH: int = 300)[source]¶

Bases: BaseModel

Wrapper around PubMed API.

This wrapper will use the PubMed API to conduct searches and fetch document summaries. By default, it will return the document summaries of the top-k results of an input search.

Parameters
  • top_k_results – number of the top-scored document used for the PubMed tool

  • load_max_docs – a limit to the number of loaded documents

  • load_all_available_meta –

    if True: the metadata of the loaded Documents gets all available meta info

    (see https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch)

    if False: the metadata gets only the most informative fields.

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 doc_content_chars_max: int = 2000¶
param email: str = 'your_email@example.com'¶
param load_all_available_meta: bool = False¶
param load_max_docs: int = 25¶
param top_k_results: int = 3¶
load(query: str) List[dict][source]¶

Search PubMed for documents matching the query. Return a list of dictionaries containing the document metadata.

load_docs(query: str) List[Document][source]¶
retrieve_article(uid: str, webenv: str) dict[source]¶
run(query: str) str[source]¶

Run PubMed search and get the article meta information. See https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch It uses only the most informative fields of article meta information.