diff --git a/src/ai_generators/blog_flow.py b/src/ai_generators/blog_flow.py index 6cdc430..aa18110 100644 --- a/src/ai_generators/blog_flow.py +++ b/src/ai_generators/blog_flow.py @@ -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)