Skip to content

About

Semantic search over simulated embedded-system logs using Ollama embeddings, FAISS, FastAPI and Next.js

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmbeddingSystemUseCase

A small semantic search demo over simulated embedded-system logs. A FastAPI backend embeds each log line with a local Ollama model, indexes the vectors in FAISS, and returns the most similar logs for a free-text query. A Next.js frontend provides a search box and a results table.

Features

  • Loads sample logs (date, log) from backend/data/logs.csv (sensor readings, CPU/memory/disk usage, network metrics, etc.).
  • Generates embeddings at startup with the nomic-embed-text model through Ollama.
  • Normalizes vectors and builds a FAISS IndexFlatIP index, so inner product equals cosine similarity.
  • POST /search/ takes {"text": "..."} and returns the top 3 matches with date, log text and similarity score.
  • GET / returns a simple status message.
  • Frontend page with a search input, Search and Clear buttons, and a table showing key, date, log and similarity percentage.

Tech stack

  • Backend: Python, FastAPI, Uvicorn, pandas, NumPy, FAISS, Ollama Python client
  • Frontend: Next.js 15, React 18, HeroUI, Tailwind CSS, TypeScript

Project structure

backend/
  main.py            FastAPI app, embedding and FAISS search
  data/logs.csv      Sample log data
  requirements.txt
frontend/
  app/page.tsx       Search UI
  ...                Next.js / HeroUI template config

Getting started

Prerequisites: Python 3, Node.js, and Ollama running locally.

  1. Pull the embedding model:

    ollama pull nomic-embed-text
  2. Start the backend (from backend/, since the CSV path is relative):

    cd backend
    python -m venv .venv && source .venv/bin/activate
    pip install -r requirements.txt
    pip install faiss-cpu
    fastapi dev main.py   # serves on http://localhost:8000

    Note: requirements.txt does not list FAISS, so it is installed separately here (faiss-cpu is an assumption; any FAISS build providing the faiss module works).

  3. Start the frontend:

    cd frontend
    npm install
    npm run dev   # http://localhost:3000

The frontend calls http://localhost:8000/search/ (hardcoded in frontend/app/page.tsx), and the backend CORS settings allow http://localhost:3000.

Context

Personal use-case project exploring text embeddings and vector search. The frontend is built on the HeroUI Next.js app template.

License

See the LICENSE file.

About

Semantic search over simulated embedded-system logs using Ollama embeddings, FAISS, FastAPI and Next.js

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages