# 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](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/multi_document_agents/multi_document_agents.ipynb).
## CLI Usage
You can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:
```bash
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:
```python
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:
```python
# 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()`.
```python
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.
```python
# 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
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-packs-multi-document-agents",
"maintainer": "jerryjliu",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "agents, document, multi",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/cc/38/bf2b5676659b2fee64b1e0ac82a54d2adf58dc722a7af11b00ff0fdafe9f/llama_index_packs_multi_document_agents-0.4.0.tar.gz",
"platform": null,
"description": "# Multi-Document Agents Pack\n\nThis LlamaPack provides an example of our multi-document agents.\n\nThis specific template shows the e2e process of building this. Given a set\nof documents, the pack will build our multi-document agents architecture.\n\n- setup a document agent over agent doc (capable of QA and summarization)\n- setup a top-level agent over doc agents\n- During query-time, do \"tool retrieval\" to return the set of relevant candidate documents, and then do retrieval within each document.\n\nCheck out the [notebook here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/multi_document_agents/multi_document_agents.ipynb).\n\n## CLI Usage\n\nYou can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:\n\n```bash\nllamaindex-cli download-llamapack MultiDocumentAgentsPack --download-dir ./multi_doc_agents_pack\n```\n\nYou can then inspect the files at `./multi_doc_agents_pack` and use them as a template for your own project.\n\n## Code Usage\n\nYou can download the pack to a the `./multi_doc_agents_pack` directory:\n\n```python\nfrom llama_index.core.llama_pack import download_llama_pack\n\n# download and install dependencies\nMultiDocumentAgentsPack = download_llama_pack(\n \"MultiDocumentAgentsPack\", \"./multi_doc_agents_pack\"\n)\n```\n\nFrom here, you can use the pack, or inspect and modify the pack in `./multi_doc_agents_pack`.\n\nThen, you can set up the pack like so:\n\n```python\n# imagine documents on different cities\ndocs = ...\n\ndoc_titles = [\"Toronto\", \"Seattle\", \"Houston\", \"Chicago\"]\ndoc_descriptions = [\n \"<Toronto description>\",\n \"<Seattle description>\",\n \"<Houston description>\",\n \"<Chicago description>\",\n]\n\n# create the pack\n# get documents from any data loader\nmulti_doc_agents_pack = MultiDocumentAgentsPack(\n docs, doc_titles, doc_descriptions\n)\n```\n\nThe `run()` function is a light wrapper around `query_engine.query()`.\n\n```python\nresponse = multi_doc_agents_pack.run(\n \"Tell me the demographics of Houston, and then compare with the demographics of Chicago\"\n)\n```\n\nYou can also use modules individually.\n\n```python\n# get the top-level agent\ntop_agent = multi_doc_agents_pack.top_agent\n\n# get the object index (which indexes all document agents, can return top-k\n# most relevant document agents as tools given user query)\nobj_index = multi_doc_agents_pack.obj_index\n\n# get document agents\ndoc_agents = multi_doc_agents_pack.agents\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index packs multi_document_agents integration",
"version": "0.4.0",
"project_urls": null,
"split_keywords": [
"agents",
" document",
" multi"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8302dc803e1337373fadff2e09abe9fbd57a22d29f32e4deedc3157ed11fe108",
"md5": "a2f250a89e55c1e3f9c3aa7c13badaa9",
"sha256": "41282ef1cfaf91f4ad3621b4f014c13494bf3fd0283ee36eb9f04e93ffb2f019"
},
"downloads": -1,
"filename": "llama_index_packs_multi_document_agents-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2f250a89e55c1e3f9c3aa7c13badaa9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4257,
"upload_time": "2024-11-18T02:01:21",
"upload_time_iso_8601": "2024-11-18T02:01:21.590229Z",
"url": "https://files.pythonhosted.org/packages/83/02/dc803e1337373fadff2e09abe9fbd57a22d29f32e4deedc3157ed11fe108/llama_index_packs_multi_document_agents-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cc38bf2b5676659b2fee64b1e0ac82a54d2adf58dc722a7af11b00ff0fdafe9f",
"md5": "e11a6e9f4fbfd3941a34a927a3257444",
"sha256": "8a94859464ef427c2bf0940c6f5c1e2b1de45c52db3df1934f5fcfdcfd2dc97d"
},
"downloads": -1,
"filename": "llama_index_packs_multi_document_agents-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "e11a6e9f4fbfd3941a34a927a3257444",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 3883,
"upload_time": "2024-11-18T02:01:23",
"upload_time_iso_8601": "2024-11-18T02:01:23.105468Z",
"url": "https://files.pythonhosted.org/packages/cc/38/bf2b5676659b2fee64b1e0ac82a54d2adf58dc722a7af11b00ff0fdafe9f/llama_index_packs_multi_document_agents-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-18 02:01:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-packs-multi-document-agents"
}