Paper QA Emulation Tool

We here emulate the workflow of the PaperQA system by Andrew White (https://thewhitelab.org/). This is a Retrieval Augmented Generation (RAG) application using a Map-Reduce model where we query our embedded index for based on a question, we then write summaries for each returned document based on relevance to the underlying question. Finally, we synthesize each summary into an essay presented as an answer to the original question.

source

PaperQAEmulationTool

 PaperQAEmulationTool (db:alhazen.utils.ceifns_db.Ceifns_LiteratureDb, llm
                       :Optional[langchain_core.language_models.chat_model
                       s.BaseChatModel]=None, slm:Optional[langchain_core.
                       language_models.chat_models.BaseChatModel]=None,
                       name:str='simple_qa_over_papers',
                       description:str='Runs a Map-Reduce model where we
                       write a short essay to answer a scientific question
                       based on a set of supporting documents.', args_sche
                       ma:Optional[Type[pydantic.v1.main.BaseModel]]=None,
                       return_direct:bool=True, verbose:bool=False, callba
                       cks:Union[List[langchain_core.callbacks.base.BaseCa
                       llbackHandler],langchain_core.callbacks.base.BaseCa
                       llbackManager,NoneType]=None, callback_manager:Opti
                       onal[langchain_core.callbacks.base.BaseCallbackMana
                       ger]=None, tags:Optional[List[str]]=None,
                       metadata:Optional[Dict[str,Any]]=None, handle_tool_
                       error:Union[bool,str,Callable[[langchain_core.tools
                       .ToolException],str],NoneType]=False, handle_valida
                       tion_error:Union[bool,str,Callable[[pydantic.v1.err
                       or_wrappers.ValidationError],str],NoneType]=False)

Write a short essay to answer a scientific question based documents from a preset collection.


source

PaperQAEmulationToolSchema

 PaperQAEmulationToolSchema (question:str,
                             n_sample_size:Optional[int]=None,
                             n_summary_size:Optional[int]=None,
                             collection_id:Optional[int]=None)

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.