Fetches top scientific papers from PubMed based on a query and returns them as Document objects.
# Source: https://github.com/mperkins0155/llama-hub | License: MIT | Copyright Jerry Liu
# Provided via justclaw.it.com; keep this notice with the code.
"""Read Pubmed Papers."""
from typing import List, Optional
from llama_index.readers.base import BaseReader
from llama_index.readers.schema.base import Document
class PubmedReader(BaseReader):
"""Pubmed Reader.
Gets a search query, return a list of Documents of the top corresponding scientific papers on Pubmed.
"""
def load_data_bioc(
self,
search_query: str,
max_results: Optional[int] = 10,
) -> List[Document]:
"""Search for a topic on Pubmed, fetch the text of the most relevant full-length papers.
Uses the BoiC API, which has been down a lot.
Args:
sear
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key