Basic Tools for Alhazen

Simple tools to demonstrate utility and ‘agentic’ functionality.

Available Tools:

Building, Describing, and Deleting Collections:

  1. AddCollectionFromEPMCTool: Execute a query against the European PMC, creating a collection, downloading available full-text papers and saving expressions, items, and fragments to the database to denote that publication.
  2. DescribeCollectionCompositionTool: Describe the composition of a collection in the database.
  3. DeleteCollectionTool: Delete a collection from the database.

Searching for papers in collections:

  1. **List__Paged_Expressions_CollectionCTool**: Delete a collection from the database.

Tools under development:

  1. Develop queries across external data sources
  2. Extract information from a collection using an LLM-based analysis to create Notes
  3. Filter a collection by an LLM-based analysis by tagging fragments with Notes
  4. Report on the state of the database in terms of numbers of collections, expressions, items, and fragments
  5. Prepare a report over a core research question by collecting a number of notes and synthesizing them into a report

source

IntrospectionToolMixin

 IntrospectionToolMixin
                         (agent:Optional[langchain.agents.agent.RunnableAg
                         ent]=None)

Base class for providing information about Alhazen’s capabilities.


source

AlhazenToolMixin

 AlhazenToolMixin (db:alhazen.utils.ceifns_db.Ceifns_LiteratureDb, llm:Opt
                   ional[langchain_core.language_models.chat_models.BaseCh
                   atModel]=None, slm:Optional[langchain_core.language_mod
                   els.chat_models.BaseChatModel]=None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

IntrospectionTool

 IntrospectionTool (name:str='introspect', description:str='This tool
                    permits Alhazen to answer questions how its agent
                    would plan to answer specific questions.', args_schema
                    :Type[__main__.IntrospectionToolSchema]=<class
                    '__main__.IntrospectionToolSchema'>,
                    return_direct:bool=False, verbose:bool=False, callback
                    s:Union[List[langchain_core.callbacks.base.BaseCallbac
                    kHandler],langchain_core.callbacks.base.BaseCallbackMa
                    nager,NoneType]=None, callback_manager:Optional[langch
                    ain_core.callbacks.base.BaseCallbackManager]=None,
                    tags:Optional[List[str]]=None,
                    metadata:Optional[Dict[str,Any]]=None, handle_tool_err
                    or:Union[bool,str,Callable[[langchain_core.tools.ToolE
                    xception],str],NoneType]=False, handle_validation_erro
                    r:Union[bool,str,Callable[[pydantic.v1.error_wrappers.
                    ValidationError],str],NoneType]=False, agent:Optional[
                    langchain.agents.agent.RunnableAgent]=None)

Base class for providing information about Alhazen’s capabilities.


source

IntrospectionToolSchema

 IntrospectionToolSchema (input:str)

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.


source

AddCollectionFromEPMCTool

 AddCollectionFromEPMCTool (name:str='add_collection_from_epmc_query',
                            description:str='This tool constructs a
                            collection in the database from an external
                            source based on a search query .', args_schema
                            :Type[__main__.AddCollectionFromEPMCToolSchema
                            ]=<class
                            '__main__.AddCollectionFromEPMCToolSchema'>,
                            return_direct:bool=True, verbose:bool=False, c
                            allbacks:Union[List[langchain_core.callbacks.b
                            ase.BaseCallbackHandler],langchain_core.callba
                            cks.base.BaseCallbackManager,NoneType]=None, c
                            allback_manager:Optional[langchain_core.callba
                            cks.base.BaseCallbackManager]=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_validation_error:Union[bool,str,Calla
                            ble[[pydantic.v1.error_wrappers.ValidationErro
                            r],str],NoneType]=False, db:alhazen.utils.ceif
                            ns_db.Ceifns_LiteratureDb, llm:Optional[langch
                            ain_core.language_models.chat_models.BaseChatM
                            odel]=None, slm:Optional[langchain_core.langua
                            ge_models.chat_models.BaseChatModel]=None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

AddCollectionFromEPMCToolSchema

 AddCollectionFromEPMCToolSchema (id:str, name:str, query:str)

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.


source

ListCollectionsTool

 ListCollectionsTool (name:str='list_collections', description:str='This
                      tool lists available collections in the database.', 
                      args_schema:Type[__main__.ListCollectionsToolSchema]
                      =<class '__main__.ListCollectionsToolSchema'>,
                      return_direct:bool=True, verbose:bool=False, callbac
                      ks:Union[List[langchain_core.callbacks.base.BaseCall
                      backHandler],langchain_core.callbacks.base.BaseCallb
                      ackManager,NoneType]=None, callback_manager:Optional
                      [langchain_core.callbacks.base.BaseCallbackManager]=
                      None, tags:Optional[List[str]]=None,
                      metadata:Optional[Dict[str,Any]]=None, handle_tool_e
                      rror:Union[bool,str,Callable[[langchain_core.tools.T
                      oolException],str],NoneType]=False, handle_validatio
                      n_error:Union[bool,str,Callable[[pydantic.v1.error_w
                      rappers.ValidationError],str],NoneType]=False,
                      db:alhazen.utils.ceifns_db.Ceifns_LiteratureDb, llm:
                      Optional[langchain_core.language_models.chat_models.
                      BaseChatModel]=None, slm:Optional[langchain_core.lan
                      guage_models.chat_models.BaseChatModel]=None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

ListCollectionsToolSchema

 ListCollectionsToolSchema (name_filter:str)

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.


source

AddCollectionFromOpenAlexTool

 AddCollectionFromOpenAlexTool
                                (name:str='add_collection_from_openalex_do
                                is', description:str='This tool constructs
                                a collection in the database from an
                                external source based on a list of dois.',
                                args_schema:Type[__main__.AddCollectionFro
                                mOpenAlexToolSchema]=<class '__main__.AddC
                                ollectionFromOpenAlexToolSchema'>,
                                return_direct:bool=True,
                                verbose:bool=False, callbacks:Union[List[l
                                angchain_core.callbacks.base.BaseCallbackH
                                andler],langchain_core.callbacks.base.Base
                                CallbackManager,NoneType]=None, callback_m
                                anager:Optional[langchain_core.callbacks.b
                                ase.BaseCallbackManager]=None,
                                tags:Optional[List[str]]=None,
                                metadata:Optional[Dict[str,Any]]=None, han
                                dle_tool_error:Union[bool,str,Callable[[la
                                ngchain_core.tools.ToolException],str],Non
                                eType]=False, handle_validation_error:Unio
                                n[bool,str,Callable[[pydantic.v1.error_wra
                                ppers.ValidationError],str],NoneType]=Fals
                                e, db:alhazen.utils.ceifns_db.Ceifns_Liter
                                atureDb, llm:Optional[langchain_core.langu
                                age_models.chat_models.BaseChatModel]=None
                                , slm:Optional[langchain_core.language_mod
                                els.chat_models.BaseChatModel]=None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

AddCollectionFromOpenAlexToolSchema

 AddCollectionFromOpenAlexToolSchema (id:str, name:str, dois:List[str])

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.


source

AddAuthorsToCollectionTool

 AddAuthorsToCollectionTool (name:str='add_authors_to_collection_query',
                             description:str='This tool adds authors to a
                             collection.', args_schema:Type[__main__.AddAu
                             thorsToCollectionToolSchema]=<class
                             '__main__.AddAuthorsToCollectionToolSchema'>,
                             return_direct:bool=True, verbose:bool=False, 
                             callbacks:Union[List[langchain_core.callbacks
                             .base.BaseCallbackHandler],langchain_core.cal
                             lbacks.base.BaseCallbackManager,NoneType]=Non
                             e, callback_manager:Optional[langchain_core.c
                             allbacks.base.BaseCallbackManager]=None,
                             tags:Optional[List[str]]=None,
                             metadata:Optional[Dict[str,Any]]=None, handle
                             _tool_error:Union[bool,str,Callable[[langchai
                             n_core.tools.ToolException],str],NoneType]=Fa
                             lse, handle_validation_error:Union[bool,str,C
                             allable[[pydantic.v1.error_wrappers.Validatio
                             nError],str],NoneType]=False, db:alhazen.util
                             s.ceifns_db.Ceifns_LiteratureDb, llm:Optional
                             [langchain_core.language_models.chat_models.B
                             aseChatModel]=None, slm:Optional[langchain_co
                             re.language_models.chat_models.BaseChatModel]
                             =None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

AddAuthorsToCollectionToolSchema

 AddAuthorsToCollectionToolSchema (id:str)

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.


source

CheckExpressionTool

 CheckExpressionTool (name:str='describe_expression_in_local_database',
                      description:str='This tool searches for a paper in
                      the database and reports if we have full text
                      version of it.', args_schema:Type[__main__.CheckExpr
                      essionToolSchema]=<class
                      '__main__.CheckExpressionToolSchema'>,
                      return_direct:bool=True, verbose:bool=False, callbac
                      ks:Union[List[langchain_core.callbacks.base.BaseCall
                      backHandler],langchain_core.callbacks.base.BaseCallb
                      ackManager,NoneType]=None, callback_manager:Optional
                      [langchain_core.callbacks.base.BaseCallbackManager]=
                      None, tags:Optional[List[str]]=None,
                      metadata:Optional[Dict[str,Any]]=None, handle_tool_e
                      rror:Union[bool,str,Callable[[langchain_core.tools.T
                      oolException],str],NoneType]=False, handle_validatio
                      n_error:Union[bool,str,Callable[[pydantic.v1.error_w
                      rappers.ValidationError],str],NoneType]=False,
                      db:alhazen.utils.ceifns_db.Ceifns_LiteratureDb, llm:
                      Optional[langchain_core.language_models.chat_models.
                      BaseChatModel]=None, slm:Optional[langchain_core.lan
                      guage_models.chat_models.BaseChatModel]=None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

CheckExpressionToolSchema

 CheckExpressionToolSchema (query:str)

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.


source

DescribeCollectionCompositionTool

 DescribeCollectionCompositionTool
                                    (name:str='describe_collection_in_loca
                                    l_database', description:str='This
                                    tool describes the contents of a
                                    Collection, in terms of counts of
                                    papers', args_schema:Type[__main__.Des
                                    cribeCollectionCompositionToolSchema]=
                                    <class '__main__.DescribeCollectionCom
                                    positionToolSchema'>,
                                    return_direct:bool=True,
                                    verbose:bool=False, callbacks:Union[Li
                                    st[langchain_core.callbacks.base.BaseC
                                    allbackHandler],langchain_core.callbac
                                    ks.base.BaseCallbackManager,NoneType]=
                                    None, callback_manager:Optional[langch
                                    ain_core.callbacks.base.BaseCallbackMa
                                    nager]=None,
                                    tags:Optional[List[str]]=None,
                                    metadata:Optional[Dict[str,Any]]=None,
                                    handle_tool_error:Union[bool,str,Calla
                                    ble[[langchain_core.tools.ToolExceptio
                                    n],str],NoneType]=False, handle_valida
                                    tion_error:Union[bool,str,Callable[[py
                                    dantic.v1.error_wrappers.ValidationErr
                                    or],str],NoneType]=False, db:alhazen.u
                                    tils.ceifns_db.Ceifns_LiteratureDb, ll
                                    m:Optional[langchain_core.language_mod
                                    els.chat_models.BaseChatModel]=None, s
                                    lm:Optional[langchain_core.language_mo
                                    dels.chat_models.BaseChatModel]=None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

DescribeCollectionCompositionToolSchema

 DescribeCollectionCompositionToolSchema (id:str)

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.


source

DeleteCollectionTool

 DeleteCollectionTool (name:str='delete_collection', description:str='This
                       deletes a collection from the database based on an
                       collection_id value.', args_schema:Type[__main__.De
                       leteCollectionToolSchema]=<class
                       '__main__.DeleteCollectionToolSchema'>,
                       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,
                       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)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

DeleteCollectionToolSchema

 DeleteCollectionToolSchema (collection_id:str)

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.


source

RetrieveFullTextToolForACollection

 RetrieveFullTextToolForACollection
                                     (name:str='retrieve_full_text_for_pap
                                     ers_in_collection',
                                     description:str='This retrieves all
                                     full text papers in a given
                                     collection.', args_schema:Type[__main
                                     __.RetrieveFullTextToolForACollection
                                     Schema]=<class '__main__.RetrieveFull
                                     TextToolForACollectionSchema'>,
                                     return_direct:bool=True,
                                     verbose:bool=False, callbacks:Union[L
                                     ist[langchain_core.callbacks.base.Bas
                                     eCallbackHandler],langchain_core.call
                                     backs.base.BaseCallbackManager,NoneTy
                                     pe]=None, callback_manager:Optional[l
                                     angchain_core.callbacks.base.BaseCall
                                     backManager]=None,
                                     tags:Optional[List[str]]=None, metada
                                     ta:Optional[Dict[str,Any]]=None, hand
                                     le_tool_error:Union[bool,str,Callable
                                     [[langchain_core.tools.ToolException]
                                     ,str],NoneType]=False, handle_validat
                                     ion_error:Union[bool,str,Callable[[py
                                     dantic.v1.error_wrappers.ValidationEr
                                     ror],str],NoneType]=False, db:alhazen
                                     .utils.ceifns_db.Ceifns_LiteratureDb,
                                     llm:Optional[langchain_core.language_
                                     models.chat_models.BaseChatModel]=Non
                                     e, slm:Optional[langchain_core.langua
                                     ge_models.chat_models.BaseChatModel]=
                                     None)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

RetrieveFullTextToolForACollectionSchema

 RetrieveFullTextToolForACollectionSchema (collection_id:str)

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.


source

RetrieveFullTextTool

 RetrieveFullTextTool (name:str='retrieve_full_text_for_paper_id',
                       description:str='This retrieves a full text paper
                       based on its doi, copies it to local disk, and adds
                       it the database.', args_schema:Type[__main__.Retrie
                       veFullTextToolSchema]=<class
                       '__main__.RetrieveFullTextToolSchema'>,
                       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,
                       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)

Base tool for interacting with an Alhazen CEIFNS (pron. ‘SAI-FiNS’) database (CEIFNS = Collection-Expression-Item-Fragment-Note-Summary).


source

RetrieveFullTextToolSchema

 RetrieveFullTextToolSchema (paper_id:str)

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.