Files
wehub-resource-sync 2cab53bc94
Docker Publish / Build and Push Docker Images (map[description:Skill Seekers CLI - Convert documentation to AI skills dockerfile:Dockerfile name:skill-seekers]) (push) Waiting to run
Docker Publish / Build and Push Docker Images (map[description:Skill Seekers MCP Server - 25 tools for AI assistants dockerfile:Dockerfile.mcp name:skill-seekers-mcp]) (push) Waiting to run
Docker Publish / Test Docker Images (push) Blocked by required conditions
Test Vector Database Adaptors / Test chroma Adaptor (push) Waiting to run
Test Vector Database Adaptors / Test faiss Adaptor (push) Waiting to run
Test Vector Database Adaptors / Test qdrant Adaptor (push) Waiting to run
Test Vector Database Adaptors / Test weaviate Adaptor (push) Waiting to run
Test Vector Database Adaptors / Test MCP Vector DB Tools (push) Waiting to run
Tests / Code Quality (Ruff & Mypy) (push) Waiting to run
Tests / Fast Unit Tests (parallel) (macos-latest, 3.11) (push) Waiting to run
Tests / Fast Unit Tests (parallel) (macos-latest, 3.12) (push) Waiting to run
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.10) (push) Waiting to run
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.11) (push) Waiting to run
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.12) (push) Waiting to run
Tests / Tests (push) Blocked by required conditions
Tests / Serial / Integration / E2E Tests (push) Blocked by required conditions
Tests / MCP Server Tests (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 12:46:28 +08:00
..

FAISS Vector Database Example

Facebook AI Similarity Search (FAISS) is a library for efficient similarity search of dense vectors. Perfect for large-scale semantic search.

Quick Start

# 1. Install dependencies
pip install -r requirements.txt

# 2. Generate skill
python 1_generate_skill.py

# 3. Build FAISS index (requires OpenAI API key)
export OPENAI_API_KEY=sk-...
python 2_build_faiss_index.py

# 4. Query the index
python 3_query_example.py

What's Different About FAISS?

  • No database server: Pure Python library
  • Blazing fast: Optimized C++ implementation
  • Scales to billions: Efficient for massive datasets
  • Requires embeddings: You must generate vectors (we use OpenAI)

Key Features

Generate Embeddings

FAISS doesn't generate embeddings - you must provide them:

from openai import OpenAI
client = OpenAI()

# Generate embedding
response = client.embeddings.create(
    model="text-embedding-ada-002",
    input="Your text here"
)
embedding = response.data[0].embedding  # 1536-dim vector

Build Index

import faiss
import numpy as np

# Create index (L2 distance)
dimension = 1536  # OpenAI ada-002
index = faiss.IndexFlatL2(dimension)

# Add vectors
vectors = np.array(embeddings).astype('float32')
index.add(vectors)

# Save to disk
faiss.write_index(index, "skill.index")
# Load index
index = faiss.read_index("skill.index")

# Query (returns distances + indices)
distances, indices = index.search(query_vector, k=5)

Cost Estimate

OpenAI embeddings: ~$0.10 per 1M tokens

  • 20 documents (~10K tokens): < $0.001
  • 1000 documents (~500K tokens): ~$0.05

Files Structure

  • 1_generate_skill.py - Package for FAISS
  • 2_build_faiss_index.py - Generate embeddings & build index
  • 3_query_example.py - Search queries

Resources


Note: FAISS is best for advanced users who need maximum performance at scale. For simpler use cases, try ChromaDB or Weaviate.