Git Product home page Git Product logo

bitcoin-pal's Introduction



Bitcoin-PAL

📚 Personal Learning Assistant for Bitcoin


Problem

Where do users go for trusted Bitcoin educational resources? In the ever-changing and evolving world of Bitcoin, false information, distrust, and confusion about complex topics is common. This makes navigating the Bitcoin landscape challenging for many, especially for new users.

Solution

We believe open-source LLMs will develop exponentially faster than closed-source LLMs. In light of this our team created Bitcoin-PAL, a bitcoin focused AI chatbot coupled with an incentivized crowd-sourcing platform to train LLMs with bitcoin.

Using Bitcoin-PAL, bitcoiners can rely on and contribute to trusted and vetted bitcoin documentation rather than query the general internet and GPT models.

Bitcoin-PAL is a proof of concept and was built during the #Ai4ALL Hackathon presented by Bolt.fun, which ran from July 1 - August 1, 2023. The project also were the winners of the Training Track!

Resources

  1. Project Charter and User Stories
  2. Backend Documentation
  3. Project Board
  4. Figma designs
  5. GitHub Actions
  6. Demo Video
  7. Presentation Deck

Demo and Presentation Video

Bitcoin-PAL Demo

Setup

Back End - Console

The backend can be used as a standalone console or a python flask based webservice.

Install and Usage - General

  1. git clone this repo

  2. pip3 install -r requirements.txt - install python dependencies

  3. Then, download the LLM model and place it in a directory of your choice:

    • LLM: default to ggml-gpt4all-j-v1.3-groovy.bin. If you prefer a different GPT4All-J compatible model, just download it and reference it in your .env file.
  4. Copy the example.env template into .env

    cp example.env .env

    and edit the variables appropriately in the .env file.

    MODEL_TYPE: supports LlamaCpp or GPT4All
    PERSIST_DIRECTORY: is the folder you want your vectorstore in
    MODEL_PATH: Path to your GPT4All or LlamaCpp supported LLM
    MODEL_N_CTX: Maximum token limit for the LLM model
    MODEL_N_BATCH: Number of tokens in the prompt that are fed into the model at a time. Optimal value differs a lot depending on the model (8 works well for GPT4All, and 1024 is better for LlamaCpp)
    EMBEDDINGS_MODEL_NAME: SentenceTransformers embeddings model name (see https://www.sbert.net/docs/pretrained_models.html)
    TARGET_SOURCE_CHUNKS: The amount of chunks (sources) that will be used to answer a question
    

    Note: because of the way langchain loads the SentenceTransformers embeddings, the first time you run the script it will require internet connection to download the embeddings model itself.

Usage - Ingestion

To ingest custom documentation the source_documents folder must be populated first and ingestion must be ran.

  1. python3 ingest.py

A console based AI document ingestion tool

Usage - Console

  1. python3 bitcoinPAL.py
  2. Ask your question on the command line

A console based AI chat tool for bitcoin education

Usage - Server

  1. python3 server.py
  2. Ask a question by submitting a curl command with a json payload to localhost:8000 curl -X POST -H "Content-Type: application/json" -d '{"query":"What is bitcoin?"}' http://localhost:8000

A console based curl query to the back end server

Front End - Client

The back end server is required to be running also in order for the front end to talk to API for querying.

Install and Usage - Console

  1. git clone this repo
  2. cd to this repo directory
  3. cd frontend - change directory to the front end
  4. npm install - installs all node modules
  5. npm start- starts front end on localhost:3000
  6. Navigate to http://localhost:3000 and ask your question

Screenshot

A react based front end for querying user input

Standing on the shoulders of giants

In addition to the libraries listed in requirements.txt and npm packages, this project also uses:

Note

This software has no guarantees and was created during a hackathon. All software should be considered beta unless otherwise explicitly specified. The user assumes all risk by executing any code contained in this repository.

License

Bitcoin PAL is released under the terms of the MIT license. See LICENSE for more information or see https://opensource.org/licenses/MIT

bitcoin-pal's People

Contributors

anthony-albertina avatar ecurrencyhodler avatar niku-singh avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

ronaldstoner

bitcoin-pal's Issues

Create website for bitcoin education chatbot

Requirements

Below are general requirements that aren't super designed. Let's have Niku take a first pass at it and we can provide feedback in figma. Comment below if I missed anything and we can update the issue.

Structure

  • Designed for desktop only (Chrome preferred. Then firefox if possible)
  • Margin checked for 4px spacing.
  • Padding checked for 4px spacing.

Chatbot

  • Title text that is the name of the bitcoin education chatbot
  • Rectangular area for users to type a question to the chatbot
  • Area where response is displayed to the user (maybe this is expanded after a question is submitted).

Chatbot States

  • KNOWN: If chatbot knows the answer, response is displayed.
  • UNKNOWN: If chatbot doesn't know the answer, error message is displayed and CTA to potentially suggest data to LLM
  • THINKING: While chatbot is thinking, show a pending logo/icon. (Stretch goal: image of a person thinking or bitcoin logo thinking that's animated)

CTA to submit

  • A button below the chatbot users can click. Title of CTA is "Submit New Data". This will bring up a pop-up for our data submission portal.

Footer

  • Include link to our github.

Create front end to submit data to LLM and pay out

Requirements

Below are general requirements that aren't super designed. Let's have Niku take a first pass at it and we can provide feedback in figma. Comment below if I missed anything and we can update the issue.

Structure

  • Designed for desktop only (Chrome preferred. Then firefox if possible)
  • Margin checked for 4px spacing.
  • Padding checked for 4px spacing.

Train the model

  • This section should include an area to submit a text or a pdf to the LLM.
  • A section to submit lightning address.
  • A button to submit data. Data + lightning address should be filled prior to being allowed to submit.

States

  • NO DATA: Default state of the website where user sees options to submit data.
  • DATA LOADED: State where user submits either a text/pdf and lightning address. User should not be allowed to submit until both are provided.
  • PENDING: LLM is reviewing the submission.
  • ACCEPTED: Data is accepted. Congratulation message + confirmation payment has been sent.
  • REJECTED: Data is not accepted. Message explaining failure. Include link to our github to raise an issue.

Create branding and logo

The name of our project will be the crowd-sourced data submission platform. But we must still choose a loose name for the bitcoin education chatbot.

Tasks

  • Choose name for bitcoin education chatbot
  • Choose name for new data submission platform
  • Create banner for new data submission platform

Train LLM

Goals

There are two goals of this training:

  1. Teach it to answer technical bitcoin questions
  2. Teach it how to filter data

Answer technical bitcoin questions

Initial data we feed should include bitcoin optech glossary, BIP’s, LIP’s, and current version of bitcoin core.

Filter criteria

As an LLM, I want to use various criteria to filter the data so that it doesn’t skew my current work.
The criteria includes:

  • Verifying acceptable sources such as: stack exchange (must have at least 50 votes and will accept the highest answer), bitcoin optech, BIP’s, LIP’s, old versions of bitcoin core, and updated versions of bitcoin core
  • Must be above 50% relevancy with current database wrt to how related it is. (AI can provide % guesstimate)

Data exclusions

We should exclude information about ARK. This will be the question we submit to the chatbot during our demo and the chatbot will say they don't know anything about it. We will the submit info about ARK to the chatbot and the chatbot will then be able to return a correct response.

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.