Skip to main content

An extension of the ralf toolkit with convenient primitives for building LLM-based dialogue agents.

Project description

ralf-dialogue_logo

ralf-dialogue

Documentation PyPI version License

ralf-dialogue is a Python framework for quickly prototyping dialogue agents that leverage large language models (LLMs), like ChatGPT or GPT-4. It lives in the broader RALF ecosystem, and assumes the use of the ralf library, which provides primitives, constructs, and other utilities for building complex systems around large language models using a desingn paradigm that some parts of the community have begun to call composability.

A word on the broader RALF ecosystem

ralf is a Python library intended to assist developers in creating applications that involve calls to Large Language Models (LLMs). A core concept in ralf is the idea of composability, which allows chaining together LLM calls such that the output of one call can be used to form the prompt of another. ralf makes it easy to chain together both LLM-based and Python-based actions— enabling developers to construct complex information processing pipelines composed of simpler building blocks. Using LLMs in this way can lead to more capable, robust, steerable and inspectable applications.

A general framework for building applications -- including conversational AIs -- that rely on a mix of prompted large language models (LLMs) and conventional Python code and services. This can be considered a powerful form of neuro-symbolic AI. Other frameworks -- such as this one, ralf-dialogue -- build on the core ralf library, adding primatives and components for building conversational agents (or "chatbots") that can interact with users in natural language, leveraging context and accessing external knowledge stores or reasoning engines. Many of these components are still under active construction, and we're always looking for talented contributors.

Quickstart Guide

This quickstart guide is intended to get you up and running with ralf within a few minutes.

Installation

We recommend creating a Conda environment before installing the package:

conda create -n ralf python=3.10
conda activate ralf

Install from PyPI

You may install ralf-dialogue from PyPI using pip:

pip install ralf-dialogue-jhuapl

Install from Source

Alternatively, you can build the package from source. First, clone the Github repository:

git clone https://github.com/jhuapl-fomo/ralf-dialogue.git

Next, install the requirements using pip:

cd ralf-dialogue
pip install -r requirements.txt

Then, build the package using flit and install it using pip:

flit build
pip install .

Or if you would like an editable installation, you can instead use:

pip install -e .

OpenAI Configuration

ralf currently relies on language models provided by OpenAI. In order to access the models, you must store your OpenAI API key as an environment variable by executing the following in bash:

echo "export OPENAI_API_KEY='yourkey'" >> ~/.bashrc
source ~/.bashrc

Running the Demos

To test if installation was successful, try running the demo scripts:

cd demos
python simple_chat.py

This demo script will allow you to converse with a chatbot created using ralf-dialogue. Next, you can delve deeper and explore other features of the library:

python analyze_conversation.py

If the scripts execute successfully, you are good to go!

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

ralf-dialogue-jhuapl-0.0.4.tar.gz (192.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ralf_dialogue_jhuapl-0.0.4-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file ralf-dialogue-jhuapl-0.0.4.tar.gz.

File metadata

  • Download URL: ralf-dialogue-jhuapl-0.0.4.tar.gz
  • Upload date:
  • Size: 192.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for ralf-dialogue-jhuapl-0.0.4.tar.gz
Algorithm Hash digest
SHA256 502faf192c5ae23fa10e9db8882bb2c8ff290d9e81e133c582df08ee8cd8f27c
MD5 1f87f7d6083bd3d95baf5d4fc304f5ed
BLAKE2b-256 ad85ee2109366f4b441aa9eb9d50ff71f229d96f3e11a7de022eef76df51ff34

See more details on using hashes here.

File details

Details for the file ralf_dialogue_jhuapl-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for ralf_dialogue_jhuapl-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a884769983a69a40ff3a6bd57353cd64e19a6d9a93c03b971ccbff4dbf6ad14f
MD5 46208e19f912059901a122b5f2b548b7
BLAKE2b-256 1a76e7517b73ee952708e7dfdfa7b0cee3adcae3f7391f6caf9fb4ab1fea2cc5

See more details on using hashes here.

Supported by

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