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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eadd35f4db327c3c8b157b1fda2d6cb74e7a8af93ba08015f59a6c99bb13e1b |
|
MD5 | b39e247837cf8f9af0f5d38c3145c44d |
|
BLAKE2b-256 | 08df66996350dca26db88edd678e6371c9107bd108b1d35a3f23958299864e22 |
Hashes for llama_index_packs_self_discover-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 042f96835ffd106a24aae0f62563d8b3fc2d5ad6ead5f4c1e1342b6722c8d8af |
|
MD5 | 6110e552be4cae6523389459e17caf11 |
|
BLAKE2b-256 | 55b6fd7d4c42c79f3037f6ae16486f71888c882c9398f3a742d540217b18f609 |