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_pack
to load the Self-Discover LlamaPack. - Directly use
SelfDiscoverPack
Using download_llama_pack
from llama_index.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
Hashes for llama_index_packs_self_discover-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f84811ee6d6a5724f196fc4c43675c8f3b21c16c7c65b9fde5737870f63e2f4f |
|
MD5 | 174274a381811cc0bb778bb722bd8758 |
|
BLAKE2b-256 | 1b92300663acef77e8ebd6015f41c3e7d3d2ca1c1bb768209e37ae09c54fbc8b |
Hashes for llama_index_packs_self_discover-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 319e96efeb229799fe072112670c4afb008fb3422f981e2a545255951eb16690 |
|
MD5 | 9d27024d622f114acc9477df90be2404 |
|
BLAKE2b-256 | 7cbc5b63e8c579b36c958f2dfc407342ff7b933fc7768ed0fe9f8675c81cd713 |