Skip to main content
Version: 0.11

Godot: Embeddings & Search

Embeddings, vector search, and hybrid search in Godot. For the concepts behind each step see the guide pages on Embedding Models, Vector Search, and Hybrid & Lexical Search.

Godot exposes the engine through nodes: AtelicoCoreNode for embedding, AtelicoKvStoreNode for searching a store, and AtelicoVectorMemoryStore for writable in-engine memory.

Embed text

embed lives on AtelicoCoreNode:

@onready var core: AtelicoCoreNode = $AtelicoCore

func embed_one(text: String) -> Array:
var resp := JSON.parse_string(core.embed(JSON.stringify({
"model": "in-memory::sentence-transformers/all-MiniLM-L6-v2",
"input": text,
})))
return resp.data[0].embedding # 384-dim Array[float]

Search a KV store

AtelicoKvStoreNode creates and searches a store (vector, lexical, and hybrid), with embed_dim matching your model (384 for MiniLM/bge-small):

@onready var kv: AtelicoKvStoreNode = $AtelicoKvStore

func _ready() -> void:
kv.kvstore_create(JSON.stringify({
"store_id": "lore",
"db_path": "./data/lore",
"embed_dim": 384,
}))

func search(query_text: String) -> Array:
var qv: Array = embed_one(query_text)
return JSON.parse_string(kv.kvstore_query("lore", JSON.stringify({
"query_embedding": qv,
"limit": 5,
})))

:::note Writing entries AtelicoKvStoreNode is read/search-only — it has no insert. Populate the store from another binding (Python/Rust/C FFI) or the HTTP server sharing the same db_path — ideal for read-only lore you ship with the game. For memory your game writes at runtime, use AtelicoVectorMemoryStore below. :::

Writable memory: AtelicoVectorMemoryStore

For NPC memory the game records as it plays, AtelicoVectorMemoryStore is a LanceDB-backed node you can write to and query directly:

@onready var mem: AtelicoVectorMemoryStore = $AtelicoVectorMemoryStore

func _ready() -> void:
mem.connect_to_db("./data/npc-memory")

func remember(node: Dictionary) -> void:
mem.write_memory("memories", node)

func recall(filter: String) -> Array:
return mem.query_memory(...) # see the Godot API Reference for the exact args

See the Godot API Reference for the exact write_memory / query_memory dictionary fields, and kvstore_create_fts_index / kvstore_hybrid_query on AtelicoKvStoreNode for hybrid search.