Home

Awesome

AI Getting Started

Live Demo (deployed on fly.io)

Join our community Discord: AI Stack Devs

<img width="1305" alt="Screen Shot 2023-06-20 at 1 30 56 PM" src="https://github.com/a16z-infra/ai-getting-started/assets/3489963/bcc762d2-68f5-4c4e-8c49-14602bee4995">

Stack

Overview

Quickstart

The simplest way to try out this stack is to test it out locally and traverse through code files to understand how each component work. Here are the steps to get started.

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]/ai-getting-started.git

2. Install dependencies

cd ai-getting-started
npm install 

3. Fill out secrets

cp .env.local.example .env.local

a. Clerk Secrets

Go to https://dashboard.clerk.com/ -> "Add Application" -> Fill in Application name/select how your users should sign in -> Create Application Now you should see both NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY on the screen <img width="1011" alt="clerk" src="https://github.com/a16z-infra/ai-getting-started/assets/3489963/6ce72263-4e83-406d-838e-08a95ea79023">

b. OpenAI API key

Visit https://platform.openai.com/account/api-keys to get your OpenAI API key

c. Replicate API key

Visit https://replicate.com/account/api-tokens to get your Replicate API key

NOTE: By default, this template uses Pinecone as vector store, but you can turn on Supabase pgvector easily. This means you only need to fill out either Pinecone API key or Supabase API key.

d. Pinecone API key

e. Supabase API key

f. Arcjet key

Visit https://app.arcjet.com to sign up for free and get your Arcjet key.

4. Generate embeddings

There are a few markdown files under /blogs directory as examples so you can do Q&A on them. To generate embeddings and store them in the vector database for future queries, you can run the following command:

If using Pinecone

Run the following command to generate embeddings and store them in Pinecone:

npm run generate-embeddings-pinecone

If using Supabase pgvector

In QAModel.tsx, replace /api/qa-pinecone with /api/qa-pg-vector. Then run the following command to generate embeddings and store them in Supabase pgvector:

npm run generate-embeddings-supabase

5. 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.

6. Deploy the app

Deploy to fly.io

Other deployment options

How to contribute to this repo

Code contribution workflow

You can fork this repo, make changes, and create a PR. Add @ykhli or @timqian as reviewers.

If you are new to contributing on github, here is a step-by-step guide:

  1. Clcik on Fork on the top right of this page

  2. Work on your change and push it to your forked repo. Now when you navigate to the forked repo's UI, you should see something like the following:

    <img width="904" alt="pr-preview" src="https://github.com/a16z-infra/ai-getting-started/assets/3489963/631e5f45-39ec-4b54-b9d1-b963e279dcc6">
  3. Click on "Contribute" -> "Open Pull Request".

  4. Once you have a PR, you can add reviewers.

Other contributions

Feel free to open feature requests, bug reports etc under Issues.

Refs