Building a code search engine with Turso
Codemogger is an open-source code indexer and search engine for AI agents, built on a single local Turso (SQLite-compatible) file using native vector columns and full-text search. Tree-sitter splits code into function and struct chunks, which are embedded locally with all-MiniLM-L6-v2 and stored as int8-quantized vector8(384) columns (395 vs 1,536 bytes per vector). Brute-force cosine search over 40,000 TypeScript compiler chunks takes about 240ms on an M2, and BM25 keyword search with name/signature weights takes 1-4ms. Results are merged with Reciprocal Rank Fusion (0.6 vector, 0.4 FTS), and a TypeScript SDK accepts any embedding function and indexes incrementally by file hash.
Related posts
- Building a Retrieval Pipeline with Turso and Voyage AI
Turso mediumAdeptTurso's SQLite-compatible engine with native vector columns, paired with Voyage AI embedding and reranking models, replaces a multi-service RAG stack with a single embeddable database for agent retrieval and memory. Documents are indexed with voyage-4-large and queried with voyage-4-lite in a shared embedding space. Candidates are retrieved via a DiskANN index (vector_top_k) or an exact vector_distance_cos scan, then reranked with instruction-following rerank-2.5. Matryoshka dimensions and int8/binary quantization map onto Turso's F32/F16/1-bit blob columns to cut storage and scan cost 4–32x. The main caveat: Turso's MVCC concurrent-write mode doesn't yet support the DiskANN index, so write-heavy agent memory should use exact scan under MVCC.
- How Hugging Face Inference Endpoints, Jobs, and Buckets Power Search on Papers with Code
Hugging Face mediumAdeptPapers with Code search combines PostgreSQL full-text search with pgvector semantic search over Qwen3-Embedding-0.6B vectors, fused by weighted reciprocal rank fusion (k=60), with exact-title, arXiv-ID and navigational matches pinned on top. Hugging Face Jobs build the full corpus on an L4 GPU from checksummed snapshots stored in immutable run prefixes in Storage Buckets. A scale-to-zero TEI Inference Endpoint embeds live queries and hourly incremental updates. A strict versioned embedding contract (pinned revision, 256-dim Matryoshka vectors, query/document prompts, content hashes) keeps generations reproducible, and pilot tests showed 0.9955 Recall@20 at ~1.3 ms p50 with 27% of the 1024-dim storage. A one-second timeout and circuit breaker fall back to lexical search when the endpoint is cold or unhealthy.
- Local RAG with Ollama, Mistral, and Turso
Turso mediumAdeptA local retrieval-augmented generation pipeline can be built in TypeScript using Ollama's Mistral model for both embeddings and generation, with libSQL storing documents and 4096-dimension F32_BLOB vectors in a single SQLite file indexed via libsql_vector_idx. Similarity search uses vector_distance_cos in a SQL query, and the top matches are injected as context into a prompt for Ollama's chat API. The setup runs fully offline with no extensions to install, and can be pointed at a Turso URL with embedded replicas to sync vectors across devices.
- How to Generate & Store OpenAI Vector Embeddings with Turso
Turso mediumAdeptTurso's beta vector support stores OpenAI text-embedding-ada-002 embeddings in a libSQL F32_BLOB(1536) column, whose size matches the model's 1536 dimensions. A DiskANN index with a cosine metric, declared through libsql_vector_idx, handles similarity search. The walkthrough covers creating a vector-enabled group and database with the Turso CLI, generating embeddings with the OpenAI Node SDK, and inserting them as Float32Array buffers in batches of 50 via db.batch transactions. Larger documents such as PDFs need to be chunked before embedding to stay within API limits.
- Building AI Agents That Remember with Mastra and Turso Vector
Turso mediumAdeptMastra, a TypeScript AI agent framework, can use Turso's libSQL (a SQLite fork with native vector search) as a single database for agent memory, telemetry and vector embeddings. The walkthrough configures LibSQLStore and LibSQLVector, enables Mastra's semanticRecall with OpenAI embeddings, registers multiple named vector stores, and builds a RAG ingestion workflow (recursive chunking at 512 tokens with 50 overlap, embedMany, upsert) plus a vector query tool for a weather agent. Turso's vector support covers six types from FLOAT32 down to 1-bit, giving up to 32x compression, and vectors of up to 65,536 dimensions, with no extensions required.