llama-index-packs-self-discover


Namellama-index-packs-self-discover JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
Summaryllama-index packs self_discover paper implementation
upload_time2025-07-30 21:32:36
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.9
licenseNone
keywords discover self self-discover task
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Self-Discover LlamaPack

This LlamaPack implements [Self-Discover: Large Language Models Self-Compose Reasoning Structures](https://arxiv.org/abs/2402.03620) paper.

It has two stages for the given task:

1. STAGE-1:

   a. SELECT: Selects subset of reasoning Modules.

   b. ADAPT: Adapts selected reasoning modules to the task.

   c. IMPLEMENT: It gives reasoning structure for the task.

2. STAGE-2: Uses the generated reasoning structure for the task to generate an answer.

The implementation is inspired from the [codebase](https://github.com/catid/self-discover)

## CLI Usage

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

```bash
llamaindex-cli download-llamapack SelfDiscoverPack --download-dir ./self_discover_pack
```

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

## Code Usage

There are two ways using LlamaPack:

1. Do `download_llama_pack` to load the Self-Discover LlamaPack.
2. Directly use `SelfDiscoverPack`

### Using `download_llama_pack`

```python
from llama_index.core.llama_pack import download_llama_pack

# download and install dependencies
SelfDiscoverPack = download_llama_pack(
    "SelfDiscoverPack", "./self_discover_pack"
)

self_discover_pack = SelfDiscoverPack(verbose=True, llm=llm)
```

### Directly use `SelfRAGPack`

```python
from llama_index.packs.self_discover import SelfDiscoverPack

self_discover_pack = SelfRAGPack(llm=llm, verbose=True)
```

The run() function serves as a concise wrapper that implements the logic outlined in the "self-discover" paper, applying it to a sample task as illustrated below.

`Emma needs to prepare 50 invitations for her upcoming birthday party. She can handwrite 10 invitations in an hour. After working for 2 hours, she takes a break for 30 minutes. If she resumes writing at the same pace, how long will it take her to complete all 50 invitations?`

```python
output = pack.run("<task>")
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-packs-self-discover",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "discover, self, self-discover, task",
    "author": null,
    "author_email": "Ravi Theja <ravi03071991@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b1/c8/40c3dcf8b10d59c664d5a444249624401a5927dea565bf0e6b2c8c2a3916/llama_index_packs_self_discover-0.4.0.tar.gz",
    "platform": null,
    "description": "# Self-Discover LlamaPack\n\nThis LlamaPack implements [Self-Discover: Large Language Models Self-Compose Reasoning Structures](https://arxiv.org/abs/2402.03620) paper.\n\nIt has two stages for the given task:\n\n1. STAGE-1:\n\n   a. SELECT: Selects subset of reasoning Modules.\n\n   b. ADAPT: Adapts selected reasoning modules to the task.\n\n   c. IMPLEMENT: It gives reasoning structure for the task.\n\n2. STAGE-2: Uses the generated reasoning structure for the task to generate an answer.\n\nThe implementation is inspired from the [codebase](https://github.com/catid/self-discover)\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 SelfDiscoverPack --download-dir ./self_discover_pack\n```\n\nYou can then inspect the files at `./self_discover_pack` and use them as a template for your own project!\n\n## Code Usage\n\nThere are two ways using LlamaPack:\n\n1. Do `download_llama_pack` to load the Self-Discover LlamaPack.\n2. Directly use `SelfDiscoverPack`\n\n### Using `download_llama_pack`\n\n```python\nfrom llama_index.core.llama_pack import download_llama_pack\n\n# download and install dependencies\nSelfDiscoverPack = download_llama_pack(\n    \"SelfDiscoverPack\", \"./self_discover_pack\"\n)\n\nself_discover_pack = SelfDiscoverPack(verbose=True, llm=llm)\n```\n\n### Directly use `SelfRAGPack`\n\n```python\nfrom llama_index.packs.self_discover import SelfDiscoverPack\n\nself_discover_pack = SelfRAGPack(llm=llm, verbose=True)\n```\n\nThe run() function serves as a concise wrapper that implements the logic outlined in the \"self-discover\" paper, applying it to a sample task as illustrated below.\n\n`Emma needs to prepare 50 invitations for her upcoming birthday party. She can handwrite 10 invitations in an hour. After working for 2 hours, she takes a break for 30 minutes. If she resumes writing at the same pace, how long will it take her to complete all 50 invitations?`\n\n```python\noutput = pack.run(\"<task>\")\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "llama-index packs self_discover paper implementation",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [
        "discover",
        " self",
        " self-discover",
        " task"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "69fa61668c2a3c6814b7f46c81cd9fd5f90be79235a5a44dc0af5ccf652b0e72",
                "md5": "de786370260e4b7471e97f987150789f",
                "sha256": "578a3a975efacfd0971dd2b0d4091555b6f3157934c86db692f912ac8a3e341a"
            },
            "downloads": -1,
            "filename": "llama_index_packs_self_discover-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "de786370260e4b7471e97f987150789f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 6705,
            "upload_time": "2025-07-30T21:32:35",
            "upload_time_iso_8601": "2025-07-30T21:32:35.237370Z",
            "url": "https://files.pythonhosted.org/packages/69/fa/61668c2a3c6814b7f46c81cd9fd5f90be79235a5a44dc0af5ccf652b0e72/llama_index_packs_self_discover-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b1c840c3dcf8b10d59c664d5a444249624401a5927dea565bf0e6b2c8c2a3916",
                "md5": "f148e28be7549728e51e92cb9f2cb7d7",
                "sha256": "7fb80df80c9047297773e2f0a22183ce6ee607ffa2e807e2e87faa840d880f4c"
            },
            "downloads": -1,
            "filename": "llama_index_packs_self_discover-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f148e28be7549728e51e92cb9f2cb7d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 6998,
            "upload_time": "2025-07-30T21:32:36",
            "upload_time_iso_8601": "2025-07-30T21:32:36.128323Z",
            "url": "https://files.pythonhosted.org/packages/b1/c8/40c3dcf8b10d59c664d5a444249624401a5927dea565bf0e6b2c8c2a3916/llama_index_packs_self_discover-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-30 21:32:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-packs-self-discover"
}
        
Elapsed time: 0.54827s