llama-index-packs-multi-document-agents


Namellama-index-packs-multi-document-agents JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
Summaryllama-index packs multi_document_agents integration
upload_time2024-08-22 17:38:13
maintainerjerryjliu
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8.1
licenseMIT
keywords agents document multi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.8.1",
    "maintainer_email": null,
    "keywords": "agents, document, multi",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/af/46/b3ef260bf91d79ba7cb542d67504804df63fd223307aab54d7cc6fa0f60e/llama_index_packs_multi_document_agents-0.3.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.3.0",
    "project_urls": null,
    "split_keywords": [
        "agents",
        " document",
        " multi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d39eac7073fd0e0d5aa03c6849977f82542e58ebb5743703678bc7507e810cb3",
                "md5": "2b0c9e4856853cea62a21db32d858888",
                "sha256": "bd89695cc74c23007cdf7f34c8c98933ff04d5eca800c26690204a5a9357c3de"
            },
            "downloads": -1,
            "filename": "llama_index_packs_multi_document_agents-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b0c9e4856853cea62a21db32d858888",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 4260,
            "upload_time": "2024-08-22T17:38:12",
            "upload_time_iso_8601": "2024-08-22T17:38:12.321389Z",
            "url": "https://files.pythonhosted.org/packages/d3/9e/ac7073fd0e0d5aa03c6849977f82542e58ebb5743703678bc7507e810cb3/llama_index_packs_multi_document_agents-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af46b3ef260bf91d79ba7cb542d67504804df63fd223307aab54d7cc6fa0f60e",
                "md5": "e091ff1d3a9348015bd63554b771f3dd",
                "sha256": "d7db3cd0a156163bbb1637aa71777dab248f74a4079892eea1c2fcdcb9176c5b"
            },
            "downloads": -1,
            "filename": "llama_index_packs_multi_document_agents-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e091ff1d3a9348015bd63554b771f3dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 3888,
            "upload_time": "2024-08-22T17:38:13",
            "upload_time_iso_8601": "2024-08-22T17:38:13.973811Z",
            "url": "https://files.pythonhosted.org/packages/af/46/b3ef260bf91d79ba7cb542d67504804df63fd223307aab54d7cc6fa0f60e/llama_index_packs_multi_document_agents-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 17:38:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-packs-multi-document-agents"
}
        
Elapsed time: 0.30189s