Skip to content

Example implementation of VectorMap-Index for laptop recommendation using KD-Tree + local hash + Ollama embeddings.

License

Notifications You must be signed in to change notification settings

NeaByteLab/VectorMap-Index

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 VectorMap Index

A fast and modular laptop recommendation system using KD-Tree + local hash + Ollama embedding.

⚠️ This is an example implementation of VectorMap-Index. It is provided for educational and demonstration purposes only.

✨ Features

  • 100 laptops with unique, rich descriptions
  • KD-Tree + local hash for ultra-fast nearest neighbor search
  • Embedding powered by local Ollama LLM
  • Clean, modular, and extendable codebase
  • Ready for: top-N search, distance score output, REST API

⚡ Usage

1️⃣ Generate Laptop Data

Run:

node generate-product.js

✅ Generates data.json with laptop names, unique descriptions, and embedding vectors.


2️⃣ Search by Description

Run:

node index.js

✅ Runs batch search queries and prints matched product names and descriptions.

Example query list inside index.js:

[
  'powerful fast laptop',
  'high resolution laptop',
  'durable grade laptop',
  'long battery laptop',
  'dedicated gpu laptop'
]

3️⃣ Ollama Requirements

Make sure Ollama is running:

ollama serve

Ensure the embedding model is pulled:

ollama pull nomic-embed-text

✅ Example Output

Query: powerful fast laptop
Matched: Laptop Model 42 - Laptop Model 42 fast boot time with NVMe SSD
---
Query: high resolution laptop
Matched: Laptop Model 50 - Laptop Model 50 high refresh rate display for gamers
---
Query: durable grade laptop
Matched: Laptop Model 52 - Laptop Model 52 durable keys rated for 20 million presses
---
Query: long battery laptop
Matched: Laptop Model 21 - Laptop Model 21 AI-enhanced battery management system
---
Query: dedicated gpu laptop
Matched: Laptop Model 44 - Laptop Model 44 VR ready specs for immersive gaming
---

📂 Project Structure

.
├── .gitignore                  # Git ignore rules
├── data.json                   # Generated laptop data with embedding vectors
├── generate-product.js         # Generates 100 laptops with unique descriptions and vectors
├── helpers/
│   ├── Ollama.js               # Embedding helper using Ollama
│   └── VectorMap.js            # KD-Tree + local hash VectorMapIndex class
├── index.js                    # Batch search runner
├── package.json                # Node.js project config

📄 License

MIT License © 2025 NeaByteLab

About

Example implementation of VectorMap-Index for laptop recommendation using KD-Tree + local hash + Ollama embeddings.

Topics

Resources

License

Stars

Watchers

Forks