You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
I'm using the LLM Compiler Agent Cookbook with some mods so that it reads pdf files instead of Wikipedia. Aside from how the pdfs are parsed, the bones of the application remain the same. The code executes until the very end when the "response = agent.chat(...)" statement which causes the "ValueError: Tool search not found" error.
from llama_index import ServiceContext
from llama_index.llms import OpenAI
from llama_index.callbacks import CallbackManager
Define Toolset
from llama_index.readers import PDFReader
from llama_index import load_index_from_storage, StorageContext
from llama_index.node_parser import SentenceSplitter
from llama_index.tools import QueryEngineTool, ToolMetadata
from llama_index import VectorStoreIndex
Setup LLMCompilerAgent
from llama_hub.llama_packs.agents.llm_compiler.step import LLMCompilerAgentWorker
from llama_index.agent import AgentRunner
Setup Data
data_folder = "./data" # Path to the folder containing the PDF files
Bug Description
I'm using the LLM Compiler Agent Cookbook with some mods so that it reads pdf files instead of Wikipedia. Aside from how the pdfs are parsed, the bones of the application remain the same. The code executes until the very end when the "response = agent.chat(...)" statement which causes the "ValueError: Tool search not found" error.
You can download a SEC 10-K pdf from this website: https://stocklight.com/stocks/us/nyse-rog/rogers/annual-reports
Version
version 0.9.34
Steps to Reproduce
import os
from dotenv import load_dotenv
Setup LLM + Service Context
from llama_index import ServiceContext
from llama_index.llms import OpenAI
from llama_index.callbacks import CallbackManager
Define Toolset
from llama_index.readers import PDFReader
from llama_index import load_index_from_storage, StorageContext
from llama_index.node_parser import SentenceSplitter
from llama_index.tools import QueryEngineTool, ToolMetadata
from llama_index import VectorStoreIndex
Setup LLMCompilerAgent
from llama_hub.llama_packs.agents.llm_compiler.step import LLMCompilerAgentWorker
from llama_index.agent import AgentRunner
Setup Data
data_folder = "./data" # Path to the folder containing the PDF files
Set OpenAI API key as an environment variable
load_dotenv()
llm = OpenAI(model="gpt-3.5-turbo", openai_api_key=os.getenv("OPENAI_API_KEY"))
node_parser = SentenceSplitter()
service_context = ServiceContext.from_defaults(llm=llm)
callback_manager = CallbackManager([])
Build agents dictionary
query_engine_tools = []
Define the directory for storing vector indexes
vector_index_dir = "./vector_indexes"
Iterate through the PDF files in the data folder
for filename in os.listdir(data_folder):
if filename.endswith(".pdf"):
file_path = os.path.join(data_folder, filename)
pdf_reader = PDFReader()
pdf_data = pdf_reader.load_data(file_path)
llm = OpenAI(model="gpt-3.5-turbo")
agent_worker = LLMCompilerAgentWorker.from_tools(
query_engine_tools,
llm=llm,
verbose=True,
callback_manager=callback_manager,
)
agent = AgentRunner(agent_worker, callback_manager=callback_manager)
Test out Queries
response = agent.chat(
"Tell me about Rogers Corp and the industries they serve."
)
print(str(response))
Relevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: