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

File details

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

File metadata

File hashes

Hashes for llama_index_packs_multi_document_agents-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8a94859464ef427c2bf0940c6f5c1e2b1de45c52db3df1934f5fcfdcfd2dc97d
MD5 e11a6e9f4fbfd3941a34a927a3257444
BLAKE2b-256 cc38bf2b5676659b2fee64b1e0ac82a54d2adf58dc722a7af11b00ff0fdafe9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_packs_multi_document_agents-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41282ef1cfaf91f4ad3621b4f014c13494bf3fd0283ee36eb9f04e93ffb2f019
MD5 a2f250a89e55c1e3f9c3aa7c13badaa9
BLAKE2b-256 8302dc803e1337373fadff2e09abe9fbd57a22d29f32e4deedc3157ed11fe108

See more details on using hashes here.

Supported by

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