@app.post("/add-sources/") async def create_file(file: UploadFile): print(file.filename) loader = SimpleDirectoryReader("") print("Processing PDF files...") source_doc = loader.load_data(file=file) return {"file_size": file.filename}
from llama_index.agent.openai import OpenAIAgent from llama_index.llms.openai import OpenAI # import and define tools ... # initialize llm llm = OpenAI(model="gpt-3.5-turbo-0613") # initialize openai agent agent = OpenAIAgent.from_tools(tools, llm=llm, verbose=True)
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: