Building Production-Ready LLM Apps With LlamaIndex: Recursive Document Agents for Dynamic Retrieval

<p>Let&rsquo;s continue our exploration on building production-ready LLM apps with LlamaIndex. This time let&rsquo;s focus on recursive document agents, developed by LlamaIndex co-founder and CEO&nbsp;<a href="https://twitter.com/jerryjliu0/status/1693421308674289822" rel="noopener ugc nofollow" target="_blank">Jerry Liu</a>.</p> <h1>Recursive Document Agent</h1> <p>We explored data agent in our previous article&nbsp;<a href="https://betterprogramming.pub/low-code-and-no-code-task-automation-with-llamaindex-data-agents-zapier-nla-snowflake-85f2ab6144fe?sk=f7f94ba7844c8268b6e708f6d4c7b6c1" rel="noopener ugc nofollow" target="_blank">Low-Code and No-Code Task Automation With LlamaIndex Data Agents, Zapier NLA, Snowflake, and Streamlit</a>. Document agent in many ways is similar to data agent. It calls LlamaIndex&rsquo;s&nbsp;<code>OpenAIAgent</code>&nbsp;<code>from_tools</code>&nbsp;to construct the agent. The difference is that document agent, indicated by its name, deals mainly with documents.</p> <p>As we learned from our previous article&nbsp;<a href="https://betterprogramming.pub/experimenting-llamaindex-routerqueryengine-with-document-management-19b17f2e3a32?sk=9d6d717b2efcda5e049a0c9ecfe597a3" rel="noopener ugc nofollow" target="_blank">Experimenting LlamaIndex RouterQueryEngine with Document Management</a>, different indexes serve different purposes. For example:</p> <ul> <li>List index is better suited for summarization.</li> <li>Vector store index is more fitting for question-answering.</li> </ul> <p>It&rsquo;s obvious that in order to serve the different types of queries/summarization, it&rsquo;s best to create multiple indexes for each document. Document agent then acts as the dispatcher to direct traffic based on the question to the right index via query engines to retrieve the accurate answer. This works well for one document.</p> <p><a href="https://betterprogramming.pub/building-production-ready-llm-apps-with-llamaindex-recursive-document-agents-for-dynamic-retrieval-1f4b25287918">Visit Now</a></p>