Giter Club home page Giter Club logo

chatrr's Introduction

Chatrr

Chatrr is a command line chatbot built around the openai api with one special feature: a memory!

How to use it

You need to have set the environment variable OPENAI_API_KEY to be your openai api key. Then:

make build
./bin/chatrr

How it works

When you submit input, it will be embedded and then used to query a sqlite database with the vector similarity search extension. If the results have strong similarity, they will be constructed into a "memory", prepended to your input, and sent to the completions api. This allows the bot to do cool things like remember your name from one conversation to the next or remember details of a project you were discussing. image

If you would like the bot to remember the response it gave to your last prompt type: memorize 1. This tells the bot to remember the last (Prompt, Response) interaction in the conversation. You can tell it to remember however many you like. image

Some problems

  1. I suspect that as conversations carry on for a long time, the bot might become confused. This effect would likely be amplified if you change topics a lot.
  2. Once you've told the bot to memorize a conversation fragment it will be in there unless you delete the database.
  3. This uses embedding + completions for every single prompt.
  4. If you have a long conversation and ask the bot to remember the entire thing, it might exceed the context limit in future conversations (this will probably break the bot).

Future improvements

  • Add timestamps to conversation fragments
  • Fix zero entry query sqlite vss explosion
  • Make completion model configurable
  • Real conversation ids
  • Claude support
    • Model agnostic conversation object (abstract openai.ChatCompletionMessage out)
  • Add feature for bot to ingest documents (stored seperately)
  • Add cli flagging for experimental features
  • API for front end to be built

Experiments

  • Embed entire conversation segment when memorizing (current strategy is ok, but why not just do the whole thing?)
  • Eviction policies for memories
  • During memorization use openai function api to get list of tags summarizing what is being memorized to store the embedding with
  • Research methods for calculating information density
  • Research methods for calculating novelty against an established corpus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.