Feast (Feature Store) is an open-source feature store for production ML.
You define your features once and Feast handles validation, materialisation and low-latency online look-ups.
Installation
pip install feast surrealdb openai # swap OpenAI for any embedder you like
Configuring Feast with SurrealDB
Feast lets you plug in a custom online store by pointing to a Python class.
Create surreal_online_store.py in your repo:
classSurrealOnlineStore(OnlineStore): """ Minimal SurrealDB-backed online store for embedding vectors. Stores one table per feature view: <project>__<entity>. """
result=awaitdb.query( """ SELECT id, vector::distance::cosine(embedding, $vec) AS score FROM $table WHERE embedding <|$k|> $vec ORDER BY score ASC """, { "table": table, "vec": query_vector, "k": top_k } ) returnresult[0]["result"]
# ---------- internals --------------------------------------------- asyncdef_ensure_table(self,db: AsyncSurreal,table: str): awaitdb.query( """ DEFINE TABLE $table SCHEMALESS; DEFINE FIELD id ON $table TYPE string; DEFINE FIELD embedding ON $table TYPE array; DEFINE INDEX IF NOT EXISTS ${table}_vec ON $table FIELDS embedding HNSW DIMENSION 384 DIST COSINE; """, {"table": table} )
Simple, declarative top-K semantics for online reads
Document / table / graph in one engine
Store scalar features and embeddings side-by-side
Going further
HNSW tune-ups – adjust EF/M parameters in the DEFINE INDEX … line to trade search speed vs. recall.
Multi-vector features – SurrealQL supports named vectors; simply add another embedding₂ field and index.
SQL + vector filters – mix Boolean predicates with similarity (WHERE metadata.region = 'EU' AND embedding <|…|>).
Streaming updates – SurrealDB's live queries let downstream services react instantly when features change.
With these few steps, Feast can serve scalar features and high-dimensional embeddings straight out of SurrealDB—zero micro-services, one binary. Happy feasting!