Skip to main content

A library for working with LLMs and behavior trees.

Project description

🌳 Dendron

Dendron is a library for building software agents using behavior trees and language models.

News

April 2024: New on arXiv: Behavior Trees Enable Structured Programming of Language Model Agents

Behavior Trees for Structured Programming of LLMs

Behavior trees are a technique for building complex reactive agents by composing simpler behaviors in a principled way. The behavior tree abstraction arose from Robotics and Game AI, but the premise of Dendron is that this abstraction can enable more sophisticated language-based agents.

Here is an example behavior tree that implements a chat agent. This agent listens to a human via microphone, performs automatic speech recognition (ASR), uses a chat model to generate a response, and plays the audio of that response using a text-to-speech (TTS) system. All locally, using models downloaded from Hugging Face:

image

You can build this agent by following the tutorial here.

Installation

To install Dendron, run

pip install dendron

This will automatically install torch, transformers, bitsandbytes, accelerate, and sentencepiece, and protobuf. You should consider installing and using Flash Attention, which is just a pip install, but has prerequisites that you should manually check. It's worth it though - maybe doubling your inference speeds.

Examples

For examples of basic language model node usage, see the example notebooks in this repository. For larger and more interesting examples, see the examples repo.

Documentation

You can find the main documentation for Dendron here. This includes a full tutorial building a chat agent that has text-to-speech and automatic speech recognition capabilities, and an API reference.

The Paper

If you use Dendron in academic research, please cite the paper:

@misc{kelley2024behavior,
      title={Behavior Trees Enable Structured Programming of Language Model Agents}, 
      author={Richard Kelley},
      year={2024},
      eprint={2404.07439},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}

Acknowledgements

This work was supported in part by the Federal Transit Administration and the Regional Transportation Commission of Washoe County.

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

dendron-0.1.6.tar.gz (32.4 kB view hashes)

Uploaded Source

Built Distribution

dendron-0.1.6-py3-none-any.whl (45.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page