# PubMedAPIWrapper

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper)

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.

## Signature

```python
PubMedAPIWrapper()
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `top_k_results` | `unknown` | Yes | number of the top-scored document used for the PubMed tool |
| `MAX_QUERY_LENGTH` | `unknown` | Yes | maximum length of the query. Default is 300 characters. |
| `doc_content_chars_max` | `unknown` | Yes | maximum length of the document content. Content will be truncated if it exceeds this length. Default is 2000 characters. |
| `max_retry` | `unknown` | Yes | maximum number of retries for a request. Default is 5. |
| `sleep_time` | `unknown` | Yes | time to wait between retries. Default is 0.2 seconds. |
| `email` | `unknown` | Yes | email address to be used for the PubMed API. |
| `api_key` | `unknown` | Yes | API key to be used for the PubMed API. |

## Extends

- `BaseModel`

## Properties

- `parse`
- `base_url_esearch`
- `base_url_efetch`
- `max_retry`
- `sleep_time`
- `top_k_results`
- `MAX_QUERY_LENGTH`
- `doc_content_chars_max`
- `email`
- `api_key`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper/validate_environment)
- [`run()`](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper/run)
- [`lazy_load()`](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper/lazy_load)
- [`load()`](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper/load)
- [`lazy_load_docs()`](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper/lazy_load_docs)
- [`load_docs()`](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper/load_docs)
- [`retrieve_article()`](https://reference.langchain.com/python/langchain-community/utilities/pubmed/PubMedAPIWrapper/retrieve_article)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/utilities/pubmed.py#L15)