0.3.6 • Published 4 months ago

@aigne/example-memory v0.3.6

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

Memory Example

This example demonstrates how to create a chatbot with memory capabilities using the AIGNE Framework and AIGNE CLI. The example utilizes the FSMemory plugin to provide persistence across chat sessions.

Prerequisites

  • Node.js and npm installed on your machine
  • An OpenAI API key for interacting with OpenAI's services
  • Optional dependencies (if running the example from source code):
    • Pnpm for package management
    • Bun for running unit tests & examples

Quick Start (No Installation Required)

export OPENAI_API_KEY=YOUR_OPENAI_API_KEY # Set your OpenAI API key

# Run the chatbot with memory
npx -y @aigne/example-memory

Installation

Clone the Repository

git clone https://github.com/AIGNE-io/aigne-framework

Install Dependencies

cd aigne-framework/examples/memory

pnpm install

Setup Environment Variables

Setup your OpenAI API key in the .env.local file:

OPENAI_API_KEY="" # Set your OpenAI API key here

Run the Example

pnpm start

How Memory Works

This example uses the FSMemory plugin from @aigne/agent-library to persist conversation history. The memory is stored in files within the memories directory, allowing the chatbot to remember previous interactions across different chat sessions.

Key features of the memory implementation:

  • Conversations are stored in a file system for persistence
  • The chatbot can recall previous interactions even after restarting
  • You can test this by chatting with the bot, closing the session, and starting a new one

Example Usage

Try using the chatbot in these ways to test its memory capabilities:

  1. Introduce yourself to the chatbot
  2. Ask it a question or have a conversation
  3. Close the session and restart the chatbot
  4. Ask the chatbot if it remembers your previous conversation

The chatbot should be able to recall information from your previous interactions.

0.3.6

4 months ago

0.3.5

4 months ago

0.3.4

4 months ago

0.3.3

4 months ago

0.3.2

4 months ago

0.3.1

4 months ago

0.3.0

4 months ago

0.2.2

4 months ago

0.2.1

4 months ago

0.2.0

5 months ago

0.1.1

5 months ago

0.1.0

5 months ago