Skip to main content

Command Palette

Search for a command to run...

VectorMind - Introduction

My little Sunday project

Published
3 min read
VectorMind - Introduction

I had a piece of Go code lying around on my drive for months. This code used Redis vectors for a RAG demo in a generative AI application. And for months I've been telling myself I could turn it into a more generic utility that could serve me in other projects.

Today, it's done! I started early this morning, step by step, interspersed with coffee breaks, Sunday family meals and a few naps. After a few hours of work, I created VectorMind!

My initial need was to have a simple REST API to be able to:

  • Easily create embeddings from text (and persist them).
  • Do similarity search.

My main usage is to use it locally with generative AI Agents, but nothing prevents deploying it on a remote machine if needed (but you'll have to wait until I add a security layer - it's planned, but VectorMind is barely a day old!).

Here's a quick overview of how it works.

REST API + MCP

Once VectorMind is started, you can interact with it very simply via HTTP requests:

Create embeddings:

curl -X POST http://localhost:8080/embeddings \
    -H "Content-Type: application/json" \
    -d '{
        "content": "Birds fly in the sky",
        "label": "animals",
        "metadata": "something about birds"
    }'

Search for similar embeddings:

curl -X POST http://localhost:8080/search \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Where are the birds?",
    "max_count": 3,
    "distance_threshold": 0.7
  }'
  • max_count is the maximum number of results to return.
  • distance_threshold is the similarity threshold (the lower the value, the more similar the results).

Search for similar embeddings with label filtering:

curl -X POST http://localhost:8080/search_with_label \
  -H "Content-Type: application/json" \
  -d '{
    "text": "What helps with communication?",
    "label": "technology",
    "max_count": 5,
    "distance_threshold": 0.5
  }'

As you can see, it's very simple to use! I took the opportunity to transform VectorMind into an MCP server (Model Context Protocol) with Streamable HTTP transport and I expose the following 3 tools (which do the same thing as the REST endpoints above):

  1. create_embedding
  2. similarity_search
  3. similarity_search_with_label

VectorMind Architecture

VectorMind consists of:

  • Redis Server: Stores embeddings and provides vector search capabilities via RediSearch
  • VectorMind Service: Go application that handles embedding generation and exposes APIs
  • Embedding Model: For example, it uses ai/mxbai-embed-large model for text embeddings and search (configurable), served via Docker Model Runner.

Starting VectorMind

To start VectorMind, you'll need Docker and Docker Compose installed on your machine. I chose to use Docker Agentic Compose to simplify the deployment of all necessary components.

You just need to create a compose.yml file with the following content:

services:

  redis-server:
    image: redis:8.2.3-alpine3.22
    environment:
      - REDIS_ARGS=--save 30 1
    ports:
      - 6379:6379
    volumes:
      - ./data:/data

  vectormind-tests:
    image: k33g/vectormind:0.0.2
    ports:
      - 9090:9090
      - 8080:8080
    environment:
      REDIS_INDEX_NAME: vectormind_index
      REDIS_ADDRESS: redis-server:6379
      REDIS_PASSWORD: ""

      MCP_HTTP_PORT: 9090
      API_REST_PORT: 8080

    models:
      embedding-model:
        endpoint_var: MODEL_RUNNER_BASE_URL
        model_var: EMBEDDING_MODEL

    depends_on:
      redis-server:
        condition: service_started

models:

  embedding-model:
    model: ai/mxbai-embed-large

Then, just run the following command to start the services:

docker compose up -d

This will start:

  • Redis server on port 6379
  • VectorMind MCP server on port 9090
  • VectorMind REST API on port 8080

If you're interested in using VectorMind, don't hesitate to check out the GitHub repository: https://github.com/RecallFlow/VectorMind