Skip to content
/ lairad Public

local artificial intelligence research and development

License

Notifications You must be signed in to change notification settings

th-neu/lairad

Repository files navigation

Issues MIT License Tests Ruff

lairad - local artificial intelligence research and development


Explore the docs »
*Report Bug *Request Feature *Discussion

Table of Contents
  1. About The Project
  2. Getting Started
  3. Docker container
  4. Usage
  5. Roadmap
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

lairad is a local artificial intelligence research and development tool. Same input, same output is a goal. Enabling local independent research to better understand the possibilities of local run/deployed large language models. LLM Models that work well are the 13B vicuna series. More research and data collection is needed here. When ever possible docker containers are used.

  • MariaDB for User / Project / Prompt storage
  • whoogle-search to have better search control
  • gogs to store files and have a commit history

Works will with the gpt4-x-vicuna-13B.ggml.q5_1.bin and WizardLM-30B-Uncensored.ggmlv3.q4_0.bin

!!! This is work in Progress !!!

Bug and issues are expected.

(back to top)

Built With

  • Python
  • Flask
  • Bootstrap

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

Working python installation and pip.

Installation Linux

  1. Clone the repo
    git clone https://github.com/th-neu/lairad.git
  2. Install python3 virtual environment (if not installed)
    sudo apt-get install python3-venv
  3. setup the virtual environment
    cd lairad && python3 -m venv lairad
  4. activate the new virtual environment
    source ~/venv/lairad/bin/activate
  5. Install pip packages
    pip install -r requirements.txt
  6. Copy env.example to .env
    cp env.example .env
  7. edit the .env file
    <your favorite editor here> .env
  8. run app.py
    python3 app.py

(back to top)

Installation Windows

  1. Clone the repo
    git clone https://github.com/th-neu/lairad.git
  2. setup the virtual environment
    cd lairad && python -m venv lairad
  3. activate the new virtual environment
    lairad\Scripts\activate.bat
  4. Install pip packages
    pip install -r requirements.txt
  5. Copy env.example to .env
    copy env.example .env
  6. edit the .env file
    <your favorite editor here> .env
  7. run app.py
    python app.py

(back to top)

Using docker

Use the installation steps with a virtual environment. Remove # app.py line 224,225 and add # at line 223. Using --rm to remove the container for testing.

  1. Build the image
     docker build -t your-name/image-name .
  2. Run the container
     docker run --rm -p 5000:5000 your-name/image-name

For armv7 use the Dockerfile.armv7. Remove # app.py line 224,225 and add # at line 223. Using --rm to remove the container for testing.

  1. Pull the docker image
    docker pull ghcr.io/th-neu/docker-py-mariadbc-armhf:latest
  2. Build the image
     docker build -t your-name/image-name -f Dockerfile.armv7 .
  3. Run the container
     docker run --rm -p 5000:5000 your-name/image-name

(back to top)

Environment File Settings

Settings for the database (sqlite3 or mariadb at the moment).
Settings for API Endpoint for llama-cpp-python.

## Secret App key
secret_key=<Secret_Key>

## Database connection
# sqlite3 configuration
DB_TYPE=sqlite
DATABASE=example.db
# mariadb configuration
# DB_TYPE=mariadb
# DB_USER=root
# DB_PASSWORD=
# DB_HOST=
# DB_PORT=3306
# DB_NAME=lairad

## Endpoint for llama-cpp-python Python API
# LLAMA_CCP_API_URL=http://localhost:8000/v1/completions
LLAMA_CCP_API_URL=http://localhost:8000/v1/completions
## LLAMA_CCP_API_Schema
LLAMA_TEMPERATURE=0.8
LLAMA_STOP=[}}}, ###]
LLAMA_MAX_TOKEN=300
LLAMA_ECHO=true

The Secret Key is not to be shared."It should be a long random string of bytes, although unicode is accepted too." One can use python (windows example):

python -c "import os; print(os.urandom(16))"

or a Password manager to generate a long random string.

(back to top)

Docker container

This is my choice of container. You can build your own images or install the software directly onto a host system. Docker is recommenced.

whoogle-search docker installation
MariaDB knowledge base
gogs docker installation

(back to top)

Usage

Navigate your web browser to localhost:5000 (replace with IP for docker / none localhost installation) and use admin/admin to login.

(back to top)

Roadmap

  • Deploy tests (flask web front end, db back end, python basic logic)
  • Rewrite Code with proper python structure.
  • Working task management (call LLM with goals and act on it [search, write file]).
  • Localization Support
    • English
    • German

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

lairad@runbox.com

Project Link: https://github.com/th-neu/lairad

(back to top)

Acknowledgments

(back to top)