Skip to main content

llama-index packs self_discover paper implementation

Project description

Self-Discover LlamaPack

This LlamaPack implements Self-Discover: Large Language Models Self-Compose Reasoning Structures 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

CLI Usage

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

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

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

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?

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

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

llama_index_packs_self_discover-0.3.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file llama_index_packs_self_discover-0.3.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_packs_self_discover-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6fa77821f73888fc0732f2330980ad93c70b221ce85309b8778ea3abf2889f03
MD5 b923e0a1f86a76b6f07cca6875d1ad15
BLAKE2b-256 a81501566229c247a3692593229509d5719a0cc760a0f9ebe339c0bfbfe46413

See more details on using hashes here.

File details

Details for the file llama_index_packs_self_discover-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_packs_self_discover-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c4d09872abebb70bb17c48d968579f77f4b5588b992337c0931036cfc04829f
MD5 ba14de5fdb2ac9923d3f2e6ad41ae4c9
BLAKE2b-256 88742c60cb0433884297ac56694d994d07267831b3820bedf3ad5d9b71686380

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