https://github.com/siavol/local-first-semantic-search
This small demo demonstrates how to implement in-browser semantic search with pglite and transformers
https://github.com/siavol/local-first-semantic-search
embeddings local-first pglite semantic-search transformers wasm
Last synced: about 1 month ago
JSON representation
This small demo demonstrates how to implement in-browser semantic search with pglite and transformers
- Host: GitHub
- URL: https://github.com/siavol/local-first-semantic-search
- Owner: siavol
- License: mit
- Created: 2025-08-17T20:12:09.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-09-04T20:44:16.000Z (about 1 month ago)
- Last Synced: 2025-09-04T22:25:52.414Z (about 1 month ago)
- Topics: embeddings, local-first, pglite, semantic-search, transformers, wasm
- Language: JavaScript
- Homepage: https://siavol.github.io/local-first-semantic-search/
- Size: 48.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Local-First Semantic Search Demo
A browser-based semantic search demo that runs entirely client-side using WebAssembly.
Search through documents using natural language queries powered by transformer-based embeddings.## Technology Stack
- [Transformers.js](https://huggingface.co/docs/transformers.js/index) - ML models running in the browser
- [PGlite](https://pglite.dev/) - Postgres database running in browser using WASM## Getting Started
1. Run HTTP server
```shell
npx http-server . -p 3000
```
2. Open `http://localhost:3000` in your browser## How It Works
1. Documents are stored in a local PGlite database
2. Each document's text is converted to embeddings using the MiniLM model
3. Search queries are converted to embeddings using the same model
4. Cosine similarity is used to find the most relevant documents
5. Results are ranked by similarity score