Skip to main content

llama-index packs multi_document_agents integration

Project description

Multi-Document Agents Pack

This LlamaPack provides an example of our multi-document agents.

This specific template shows the e2e process of building this. Given a set of documents, the pack will build our multi-document agents architecture.

  • setup a document agent over agent doc (capable of QA and summarization)
  • setup a top-level agent over doc agents
  • During query-time, do "tool retrieval" to return the set of relevant candidate documents, and then do retrieval within each document.

Check out the notebook here.

CLI Usage

You can download llamapacks directly using llamaindex-cli, which comes installed with the llama-index python package:

llamaindex-cli download-llamapack MultiDocumentAgentsPack --download-dir ./multi_doc_agents_pack

You can then inspect the files at ./multi_doc_agents_pack and use them as a template for your own project.

Code Usage

You can download the pack to a the ./multi_doc_agents_pack directory:

from llama_index.core.llama_pack import download_llama_pack

# download and install dependencies
MultiDocumentAgentsPack = download_llama_pack(
    "MultiDocumentAgentsPack", "./multi_doc_agents_pack"
)

From here, you can use the pack, or inspect and modify the pack in ./multi_doc_agents_pack.

Then, you can set up the pack like so:

# imagine documents on different cities
docs = ...

doc_titles = ["Toronto", "Seattle", "Houston", "Chicago"]
doc_descriptions = [
    "<Toronto description>",
    "<Seattle description>",
    "<Houston description>",
    "<Chicago description>",
]

# create the pack
# get documents from any data loader
multi_doc_agents_pack = MultiDocumentAgentsPack(
    docs, doc_titles, doc_descriptions
)

The run() function is a light wrapper around query_engine.query().

response = multi_doc_agents_pack.run(
    "Tell me the demographics of Houston, and then compare with the demographics of Chicago"
)

You can also use modules individually.

# get the top-level agent
top_agent = multi_doc_agents_pack.top_agent

# get the object index (which indexes all document agents, can return top-k
# most relevant document agents as tools given user query)
obj_index = multi_doc_agents_pack.obj_index

# get document agents
doc_agents = multi_doc_agents_pack.agents

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_packs_multi_document_agents-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_packs_multi_document_agents-0.4.1.tar.gz
Algorithm Hash digest
SHA256 aeff946ee6d4a3d5ccef35def3fc677634d8fe10ec04691079830274ef4a5447
MD5 98589b4b48b89221a2a8c2f56ebb0577
BLAKE2b-256 78cd527cba6b75fc0b9c9a67d735ca325aafed3d2816e3beddb80834762d7f15

See more details on using hashes here.

File details

Details for the file llama_index_packs_multi_document_agents-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_packs_multi_document_agents-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03786d22ddafb77ae714117970ca65db51e15e8a63adce760aef847f84746a72
MD5 d1c4f1a189c62727ba53c858a55a7327
BLAKE2b-256 26ec02470683f3bf44b84f5fd401e2988c7a87306da006cb6453b2aefd31959d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page