reviewer fix

This commit is contained in:
Andrew Ridgway 2026-05-21 22:44:04 +10:00
parent e69b83694c
commit fa611192c8
Signed by: armistace
GPG Key ID: C8D9EAC514B47EF1

View File

@ -91,7 +91,19 @@ class BlogFlow(Flow[BlogFlowState]):
@staticmethod
def _get_chroma_client() -> "chromadb.HttpClient":
import chromadb
# Lazily import chromadb here rather than at module level.
# chromadb unconditionally loads hnswlib (a native C++ library
# compiled with AVX instructions) even when using HttpClient
# to talk to an external ChromaDB server. Deferring the import
# avoids "Illegal instruction" (SIGILL) crashes in environments
# that lack AVX support (e.g. act, older CI runners).
try:
import chromadb
except ImportError as exc:
raise RuntimeError(
"chromadb is required for the editor phase but could not be "
f"imported: {exc}"
) from exc
chroma_port = int(os.environ["CHROMA_PORT"])
return chromadb.HttpClient(host=os.environ["CHROMA_HOST"], port=chroma_port)