Find answers from the community

Updated 9 months ago

I need help with this issue

I need help with this issue

Plain Text
 100 callback_manager = callback_manager_from_settings_or_context(
    101     Settings, service_context
    102 )
    103 if len(query_engine_tools) > 0:
--> 104     callback_manager = query_engine_tools[0].query_engine.callback_manager
    106 llm = llm or llm_from_settings_or_context(Settings, service_context)
    107 if question_gen is None:
n
W
3 comments
main code

Plain Text
def main():

    folder_name = input("Enter the name of the folder: ")
    if Path("./data").is_dir():
        docs = process_pdf_files("./data/" + folder_name)
        print(docs.keys())
        
        if len(source_Docs) > 0:
           res = processVectorStore_and_createQueryEngine(source_Docs, folder_name)
           query_engine_tools = [
                    QueryEngineTool(
                                query_engine=res[key].as_query_engine(),
                                metadata=ToolMetadata(
                                    name=f"{key}",
                                    description=f"Provides information about financials of {key}",
                                ),
                            )
                        for key in res.keys()
                        ]
           print("--------------------------------------------------------------")
           print("query engine tools array ",query_engine_tools)
           sub_question_query_engine = SubQuestionQueryEngine.from_defaults(query_engine_tools=res)
           response = sub_question_query_engine.query("what is the data about ?")
           print(response)
        else:
            print("No PDF files found in the folder.")

    else:
        print("Folder not found. Please enter a valid folder name.")

# Run the async function
main()
Can you share the full error traceback
Thanks!, i solved it ... iwas reading the index in the queryenginetools parameter instead of query engine tools
Add a reply
Sign up and join the conversation on Discord