Back to Practice

In-process embeddings (FastEmbed)

Full
rag

Implement a Python function create_embed_model that builds an in-process FastEmbed embedding model (bge-small, 384-dim) exactly as the make_embed function from the provided source does: process-cached per model name, respecting optional environment variables EMBED_MODEL, EMBED_THREADS, and EMBED_CACHE_DIR. Then, using this function, embed a list of strings into 384-dimensional vectors. The solution must not make any external API calls – it relies on local ONNX weights downloaded by FastEmbed. Write the function and a usage example that prints the shape of the resulting embeddings.

Your code
Sources
  • roadmap-kg/kg/llm.py:156-200
  • roadmap-kg/kg/ground_content.py:264-308
  • roadmap-kg/kg/memory_common.py:577-606