Skip to content

fix: bail out of get_provider('local') when sentence-transformers is missing#484

Open
mvanhorn wants to merge 1 commit into
tirth8205:mainfrom
mvanhorn:fix/8205-crg-local-embedding-availability-check
Open

fix: bail out of get_provider('local') when sentence-transformers is missing#484
mvanhorn wants to merge 1 commit into
tirth8205:mainfrom
mvanhorn:fix/8205-crg-local-embedding-availability-check

Conversation

@mvanhorn
Copy link
Copy Markdown

Summary

embed_graph_tool returned {ok: true, embeddings: 0} on workspaces without sentence-transformers because get_provider("local") only caught ImportError from the LocalEmbeddingProvider constructor. The check existed (_check_available()) but wasn't consulted before the constructor ran, so the silent fallback path swallowed the unavailability and returned a no-op provider.

Add an early _check_available() short-circuit at the top of get_provider so the call returns None and surfaces "local provider unavailable" to the caller instead of producing a silent no-op.

Why this matters

#448 (filed today by @nicobailon) reports embed runs that "succeed" with zero embeddings produced. The root cause is exactly the missing precondition: _check_available exists for this purpose but only gets called by EmbeddingStore. Hoisting it into get_provider makes both paths consistent.

Tests: 4 new tests cover both local and embedding-store-with-local paths when _check_available returns False, plus 2 existing tests patched to assert the new precondition path still admits successful constructions. uv run pytest tests/test_embeddings.py -k "TestGetProviderModel or test_local_unavailable or test_embedding_store_unavailable" passes locally.

closes #448

AI was used for assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

embed_graph_tool returns ok but produces 0 embeddings when sentence-transformers is missing (silent fallback in get_provider)

1 participant