import os from langchain.tools import BaseTool class QAIndexedDocuments(BaseTool): name = "Question Answering Tool for Indexed Documents" description = ( "use this tool when asked to search and find answers in documents. " "If explicitly asked to search in indexed documents, this tool will search in the indexed documents. " "To use the tool you must provide exactly one parameters as follows " "['question']" ) return_direct = True def _run( self, question: str, ): return index.query_with_sources(question) def _arun(self, query: str): raise NotImplementedError("This tool does not support async")