This project uses the BuilderBot SDK to create a chatbot with Baileys. Follow the instructions below to install and configure it.
- Node.js version 22.8.0 or higher
- MongoDB version 6.6.1 or higher
- Imgur API key
- OpenAI API key
- Rust and Cargo installed
- Updated OpenSSL version (OpenSSL 3.0.12 24 Oct 2023 (Library: OpenSSL 3.0.12 24 Oct 2023))
It is advisable to check first the veoveo repository to ensure all the requirements are met.
-
Clone and set up the veoveo repository:
mkdir -p ~/vertex && cd ~/vertex git clone https://github.com/VertexStudio/veoveo cd veoveo
-
Start SurrealDB:
surreal start --user root --pass root surrealkv:assets/vv_db
-
Run the required services (each in a separate terminal):
cargo run -p rerank cargo run -p embeddings cargo run -p vv_vision ./run.sh cargo run --release -p asset_pipeline -- --comfy
-
Clone and set up the bioma repository:
cd ~/vertex git clone https://github.com/VertexStudio/bioma cd bioma docker compose up reranker
-
Clone this repository:
cd ~/vertex git clone https://github.com/VertexStudio/vertex-bot-wsp cd vertex-bot-wsp
-
Configure the .env file:
Copy the
.env.example
file to.env
and fill in the required values:cp .env.example .env
Then edit the
.env
file with your specific values:- ASSISTANT_ID=
- OPENAI_API_KEY=
- MONGODB_URI=
- IMGUR_CLIENT_ID=
- MODEL= (Optional, default is "llama3.1")
- etc...
-
Install dependencies and start the bot:
pnpm i pnpm dev
-
Scan the QR code from the bot.qr.png file with WhatsApp
- Copy the groupsValidationFeature/index.cjs
- Paste and replace on node_modules/@builderbot/provider-baileys/dist/index.cjs
Ensure the following services are running:
- vv_vision
- ComfyUI
- vv_db
- Ollama
- Reranker service
- Embeddings service
sequenceDiagram
participant U as User
participant W as WhatsApp
participant VB as Vertex Bot
participant DB as VV DB (SurrealDB)
participant O as Ollama
participant RA as Rerank Actor
U->>W: Send message
W->>VB: Forward message
VB->>DB: Fetch conversation
alt Conversation exists
DB->>VB: Return conversation
else Conversation doesn't exist
VB->>DB: Create new conversation
DB->>VB: Return new conversation
end
VB->>O: Generate embeddings for user query
O->>VB: Return embeddings
alt More than 10 messages in conversation
VB->>VB: Rerank older messages using cosine similarity
end
alt Company facts exist
VB->>RA: Rerank facts based on user query
RA->>VB: Return relevant facts
end
VB->>VB: Build prompt with relevant facts
VB->>O: Send built prompt
O->>VB: Generate response
VB->>O: Create embeddings for new messages
O->>VB: Return new embeddings
VB->>DB: Save messages, embeddings, and relationships
VB->>W: Send response
W->>U: Deliver response