Crates.io | llm-chain-tools |
lib.rs | llm-chain-tools |
version | 0.4.0 |
source | src |
created_at | 2023-04-07 22:33:28.53086 |
updated_at | 2023-04-12 07:49:56.5955 |
description | A library for providing Large Language Models with tools (also known as 'actions') that they can trigger |
homepage | |
repository | https://github.com/sobelio/llm-chain/ |
max_upload_size | |
id | 833259 |
size | 31,588 |
llm-chain-tools
is an extension for the llm-chain
crate, providing a collection of tools that can be used to give Large Language Models (LLMs) access to various utilities, such as running Bash commands on your computer or performing web searches.
To help you get started, here is an example demonstrating how to use llm-chain-tools
with llm-chain
. You can find more examples in the examples folder in the repository.
use llm_chain::Parameters;
use llm_chain_tools::create_tool_prompt_segment;
use llm_chain_tools::tools::BashTool;
use llm_chain_tools::ToolCollection;
use std::boxed::Box;
// A simple example generating a prompt with some tools.
fn main() {
let tool_collection = ToolCollection::new(vec![Box::new(BashTool::new())]);
let prompt =
create_tool_prompt_segment(&tool_collection, "Please perform the following task: {}");
println!(
"{}",
prompt.format(&Parameters::new_with_text(
"Find the file GOAL.txt and tell me its content."
))
);
}
To start using llm-chain-tools
, add it as a dependency in your Cargo.toml:
[dependencies]
llm-chain = "0.1.0"
llm-chain-openai = "0.1.0"
llm-chain-tools = "0.1.0"
Then, refer to the documentation and examples to learn how to create and manage tools, integrate them into prompts, and more.