MinSomai / local-ai-stack

A starter kit to build *local-only* AI apps that cost $0 to run -- starting with document Q&A. Written in Javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Local AI Stack

Make it possible for anyone to run a simple AI app that can do document Q&A 100% locally without having to swipe a credit card 💳. Based on AI Starter Kit.

Screen Shot 2023-10-30 at 10 20 17 PM

Have questions? Join AI Stack devs and find me in #local-ai-stack channel.

Stack

Quickstart

1. Fork and Clone repo

Fork the repo to your Github account, then run the following command to clone the repo:

git clone git@github.com:[YOUR_GITHUB_ACCOUNT_NAME]/local-ai-stack.git

2. Install dependencies

cd local-ai-stack
npm install

3. Install Ollama

Instructions are here

4. Run Supabase locally

  1. Install Supabase CLI
brew install supabase/tap/supabase
  1. Start Supabase

Make sure you are under /local-ai-stack directory and run:

supabase start

5. Fill in secrets

cp .env.local.example .env.local

Then get SUPABASE_PRIVATE_KEY by running

supabase status

Copy anon key and save it as SUPABASE_PRIVATE_KEY in .env.local

6. Generate embeddings

node src/scripts/indexBlogLocal.mjs

This script takes in all files from /blogs, generate embeddings using transformers.js, and store embeddings as well as metadata in Supabase.

7. Run app locally

Now you are ready to test out the app locally! To do this, simply run npm run dev under the project root and visit http://localhost:3000.

8. Deploy the app

If you want to take the local-only app to the next level, feel free to follow instructions on AI Starter Kit for using Clerk, Pinecone/Supabase, OpenAI, Replicate and other cloud-based vendors.

Refs & Credits

About

A starter kit to build *local-only* AI apps that cost $0 to run -- starting with document Q&A. Written in Javascript

License:MIT License


Languages

Language:TypeScript 73.9%Language:JavaScript 20.7%Language:PLpgSQL 3.8%Language:CSS 1.7%