Usage

Welcome to Chatformers, a Python library that leverages advanced language models for chatbot creation and interaction with built-in memory management using vector stores. Chatformers simplify integrating large language models (LLMs) into your applications, supporting configurable memory through providers like Chroma, Qdrant, Pggvector, OpenAI, Groq, Ollama, Mem0AI, etc.

Table of Contents

  • Installation

  • Getting Started

  • Configuration

  • Usage Example

  • Optional Features

    • Adding Memories

    • Retrieving Memories

  • Documentation

  • License

Installation

Before using the library, ensure you have the necessary dependencies installed.

pip install chatformers

Additionally, ensure that you have the required API key from GROQ API, OpenAI, or any OpenAI compatible library.

Getting Started

Step 1: Importing the Library

To begin, import the necessary modules and set up the API key.

Set your GROQ_API_KEY environment variable:

Step 2: Initializing the OpenAI Client

Configure the OpenAI client to communicate with the GROQ LLM service.

Step 3: Setting Up Chatbot Character

You can configure the chatbot character with specific attributes.

Step 4: Configuring Chatformers

Chatformers use mem0ai for memory management. Refer to the mem0 documentation for more details.

Step 5: Creating the Chatbot Instance

Initialize the chatbot with the OpenAI client, model name, character configuration, and memory configuration.

Usage Example

Basic Chat Interaction

Below is an example of a chatbot conversation where the user asks the bot a question and receives a response based on previous chats.

Output

The chatbot responds based on previous conversations stored in memory and any additional context provided by the user.

Optional Features

Adding Memories

Chatformers allow you to embed memories directly into the vector database, making future interactions more contextual.

Retrieving Memories

You can retrieve the memories associated with a specific user to understand the context better.

You can also query for related memories based on specific prompts.

Documentation

For further details on the configuration and advanced features of Chatformers, refer to the following resources:

License

Chatformers is open-source software licensed under the MIT License.

Last updated