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:
-
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.
-
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:
- Do
download_llama_packto load the Self-Discover LlamaPack. - 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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_packs_self_discover-0.4.1.tar.gz.
File metadata
- Download URL: llama_index_packs_self_discover-0.4.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe6c804d3205fa802fc5301d4d842d3a9d60596e8df5b2d101811ad6d9487b22
|
|
| MD5 |
2b42f23ce31df60c577eba434bb98174
|
|
| BLAKE2b-256 |
21971844623612b1cf3c8b9100dc28c3ca9f9cc36f8ba594ca71e950f89a8972
|
File details
Details for the file llama_index_packs_self_discover-0.4.1-py3-none-any.whl.
File metadata
- Download URL: llama_index_packs_self_discover-0.4.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87089726801dbd3688224ef9a9087e3edba586db19c2884d20c31aa72a5cd06a
|
|
| MD5 |
837796e73e8adc7094ec50a2dc5c66b2
|
|
| BLAKE2b-256 |
1758c75f3324c924c98a28387f98b6c8ecee91d4ebb9dd045e8da7269f519b79
|