Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prem Integration to support self-hosted open-source models. #60

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ PINECONE_INDEX=ai****

# Supabase related environment variables
SUPABASE_URL=https://****
SUPABASE_PRIVATE_KEY=eyJ****
SUPABASE_PRIVATE_KEY=eyJ****

# Prem related environment variables
STABLE_DIFFUSION_BASE_URL=http://****:9224/v1
CHAT_MODEL_BASE_URL=http://****:8228/v1
EMBEDDINGS_MODEL_BASE_URL=http://****:8444/v1
REDIS_BASE_URL=redis://****:6379
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ yarn-error.log*
next-env.d.ts

/.env.prod
/fly.toml
/fly.toml

.env
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

- Auth: [Clerk](https://clerk.com/)
- App logic: [Next.js](https://nextjs.org/)
- VectorDB: [Pinecone](https://www.pinecone.io/) / [Supabase pgvector](https://supabase.com/docs/guides/database/extensions/pgvector)
- VectorDB: [Pinecone](https://www.pinecone.io/) / [Supabase pgvector](https://supabase.com/docs/guides/database/extensions/pgvector) / [Redis](https://redis.io/)
- LLM Orchestration: [Langchain.js](https://js.langchain.com/docs/)
- Image Model: [Replicate](https://replicate.com/)
- Text Model: [OpenAI](https://platform.openai.com/docs/models)
- Text Model: [OpenAI](https://platform.openai.com/docs/models) / [Prem](https://premai.io/)
- Text streaming: [ai sdk](https://github.com/vercel-labs/ai)
- Deployment: [Fly](https://fly.io/)

Expand Down Expand Up @@ -92,6 +92,24 @@ In `QAModel.tsx`, replace `/api/qa-pinecone` with `/api/qa-pg-vector`. Then run
npm run generate-embeddings-supabase
```

## Use Prem as AI Models Backend

### Install and Run Prem

Follow the instructions [here](https://premai.io/docs/getting-started/installation) to install and run Prem in your local environment or infrastructure.

### Start Prem Services

You can check [here](https://www.youtube.com/watch?v=XixH46Ysl5A&t=604s) for more details on how to start Prem AI Services.

filopedraz marked this conversation as resolved.
Show resolved Hide resolved
#### Generate embeddings and store them in Redis vectorstore
In `QAModel.tsx`, replace `/api/qa-pinecone` with `/api/qa-redis`. Then run the following command to generate embeddings and store them in Redis:

```bash
npm run generate-embeddings-redis
```
#### Use Self Hosted Stable Diffusion Model
In `TextToImgModal.tsx`, replace `/api/text-to-img` with `/api/text-to-img-prem`.

### 5. Run app locally

Expand Down
Loading