#llm-chain #language-model #llm #chatgpt #chain #langchain

llm-chain-tools

A library for providing Large Language Models with tools (also known as 'actions') that they can trigger

5 releases

0.4.0 Apr 12, 2023
0.1.4 Apr 9, 2023
0.1.3 Apr 9, 2023
0.1.2 Apr 9, 2023
0.1.1 Apr 7, 2023

#676 in Machine learning

Download history 6/week @ 2024-02-25 76/week @ 2024-03-31

76 downloads per month

MIT license

215KB
4K SLoC

llm-chain-tools 🛠️

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.

Examples 💡

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."
        ))
    );
}

Features 🌟

  • Tool management: Easily create and integrated a collection of tools that LLMs can use to perform various tasks.
  • Prompt integration: Seamlessly integrate tool descriptions into LLM prompts for more effective interactions.
  • Pre-defined tools: A submodule providing a variety of pre-defined tools for common tasks, ready for use.
  • Extensibility: Designed with extensibility in mind, making it easy to integrate additional tools as needed.

Getting Started 🚀

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.

Dependencies

~5–7MB
~132K SLoC