Setting up locally
Pre-requisites
- Node.js - You can download it from here (opens in a new tab).
- Python - You can download it from here (opens in a new tab).
Steps to setup the project locally :
Clone the repository
Clone the repository to your local machine using the following command:
git clone https://github.com/Farbyte/lawson.git
Install dependencies
Install the project dependencies:
- For the frontend
npm install
Please setup a venv for the backend. It makes it a lot easier to manage dependencies.
- For the backend
cd backend
python3 -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt
Create a .env
file.
Add the following environment variables to the .env
file:
- For the frontend
// Clerk secrets --------------------------->
// (Clerk API key)(https://clerk.com/docs/get-started)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
// Uploadthing secrets --------------------->
// (Uploadthing API key)(https://uploadthing.com)
UPLOADTHING_SECRET=
UPLOADTHING_APP_ID=
// Supabase secrets ------------------------>
// (Supabase API key)(https://supabase.com)
POSTGRES_URL_NON_POOLING=
POSTGRES_PRISMA_URL=
// Langchain secrets ----------------------->
// (Together AI API key)(https://api.together.ai)
TO_API_KEY=
// System templates ------------------------->
// (System templates)(Prompts for the LLM)
SYSTEM_TEMPLATE =
SYSTEM_TEMPLATE_LONG =
SYSTEM_TEMPLATE_SHORT =
// Pinecone secrets ----------------------->
// (Pinecone API key)(https://www.pinecone.io)
PINECONE_API_KEY=
PINECONE_INDEX_NAME=
// Embedder secrets ----------------------->
EMBEDDER_URL=
EM_API_KEY=
The Embedder API
and the Pinecone API
key must match in the backend and
frontend.
- For the backend (Enter the
Backend
directory first and initialize the virtual environment).
The Embedder URL
is the URL of the backend. The Embedder API
key can be
any random string.
Its important so the Embedder API
key can be any random String
.
Make another .env
file in the backend
directory and add the following environment variables to it:
// Together AI secrets ----------------------->
// (Together AI API key)(https://api.together.ai)
TOGETHER_KEY_1=
TOGETHER_KEY_2=
TOGETHER_KEY_3=
TOGETHER_KEY_4=
// Embedder secrets ----------------------->
// Its the Embedder API key same thing as the one in the frontend
// Have to be set to the same value as the one in the frontend
API_KEY=
// Pinecone secrets ----------------------->
// (Pinecone API key)(https://www.pinecone.io)
// Have to be set to the same value as the one in the frontend
PINECONE_API_KEY=
Start the development server:
Start the development server by running the following command:
- For the frontend
npm run dev
- For the backend
The backend is a FastAPI server. So you need to run it in a separate terminal.
cd backend
fastapi dev main.py
View the project
Open your browser and navigate to http://localhost:3000
to view the project.
The backend is running at http://localhost:8000
.
You can check the endpoints at http://localhost:8000/docs