forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
596 B
Python
19 lines
596 B
Python
from typing import List
|
|
|
|
from langchain.schema import BaseRetriever, Document
|
|
from langchain.utilities.pupmed import PubMedAPIWrapper
|
|
|
|
|
|
class PubMedRetriever(BaseRetriever, PubMedAPIWrapper):
|
|
"""
|
|
It is effectively a wrapper for PubMedAPIWrapper.
|
|
It wraps load() to get_relevant_documents().
|
|
It uses all PubMedAPIWrapper arguments without any change.
|
|
"""
|
|
|
|
def get_relevant_documents(self, query: str) -> List[Document]:
|
|
return self.load_docs(query=query)
|
|
|
|
async def aget_relevant_documents(self, query: str) -> List[Document]:
|
|
raise NotImplementedError
|