llama-index packs agents llm compiler
Project description
LLMCompiler Agent Pack
This LlamaPack implements the LLMCompiler agent paper.
A lot of code came from the source repo, we repurposed with LlamaIndex abstractions. All credits to the original authors for a great work!
A full notebook guide can be found here.
CLI Usage
You can download llamapacks directly using llamaindex-cli
, which comes installed with the llama-index
python package:
llamaindex-cli download-llamapack LLMCompilerAgentPack --download-dir ./llm_compiler_agent_pack
You can then inspect the files at ./llm_compiler_agent_pack
and use them as a template for your own project!
Code Usage
You can download the pack to a directory. NOTE: You must specify skip_load=True
- the pack contains multiple files,
which makes it hard to load directly.
We will show you how to import the agent from these files!
from llama_index.core.llama_pack import download_llama_pack
# download and install dependencies
download_llama_pack("LLMCompilerAgentPack", "./llm_compiler_agent_pack")
From here, you can use the pack. You can import the relevant modules from the download folder (in the example below we assume it's a relative import or the directory has been added to your system path).
# setup pack arguments
from llama_index.core.agent import AgentRunner
from llm_compiler_agent_pack.step import LLMCompilerAgentWorker
agent_worker = LLMCompilerAgentWorker.from_tools(
tools, llm=llm, verbose=True, callback_manager=callback_manager
)
agent = AgentRunner(agent_worker, callback_manager=callback_manager)
# start using the agent
response = agent.chat("What is (121 * 3) + 42?")
You can also use/initialize the pack directly.
from llm_compiler_agent_pack.base import LLMCompilerAgentPack
agent_pack = LLMCompilerAgentPack(tools, llm=llm)
The run()
function is a light wrapper around agent.chat()
.
response = pack.run("Tell me about the population of Boston")
You can also directly get modules from the pack.
# use the agent
agent = pack.agent
response = agent.chat("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
Built Distribution
File details
Details for the file llama_index_packs_agents_llm_compiler-0.3.0.tar.gz
.
File metadata
- Download URL: llama_index_packs_agents_llm_compiler-0.3.0.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4f2deede8503d7aecffff6e7581d1fb24e6abecb3977e2cb2b34e13705cf172 |
|
MD5 | e135cd9c6a0e1717b48c8389fcccc7bd |
|
BLAKE2b-256 | 9042d08412eb1b93f4c975c902bbf52a17e19b8d6c097854448e577cbb44371c |
File details
Details for the file llama_index_packs_agents_llm_compiler-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_packs_agents_llm_compiler-0.3.0-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 397e857ff50d36c57247db5977b161f7b6603648145fc53204380e3d1adf29ef |
|
MD5 | 7e91dd1ecdbd29110866477a8c0f34c8 |
|
BLAKE2b-256 | b46d320796ce639f307d7fab699d9cb6fe1c024fdd4ae852acac6e0c44ace03a |