Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion code_review_graph/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ def _get_model(self):
if self._model is None:
try:
from sentence_transformers import SentenceTransformer
self._model = SentenceTransformer(self._model_name)
self._model = SentenceTransformer(
self._model_name,
trust_remote_code=True,
model_kwargs={"trust_remote_code": True},
)
except ImportError:
raise ImportError(
"sentence-transformers not installed. "
Expand Down
6 changes: 4 additions & 2 deletions code_review_graph/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def _embedding_search(
store: GraphStore,
query: str,
limit: int = 50,
model: str | None = None,
) -> list[tuple[int, float]]:
"""Run a vector similarity search using the embedding store.

Expand All @@ -180,7 +181,7 @@ def _embedding_search(
return []

try:
emb_store = EmbeddingStore(store.db_path)
emb_store = EmbeddingStore(store.db_path, model=model)
try:
if not emb_store.available or emb_store.count() == 0:
return []
Expand Down Expand Up @@ -264,6 +265,7 @@ def hybrid_search(
kind: Optional[str] = None,
limit: int = 20,
context_files: Optional[list[str]] = None,
model: Optional[str] = None,
) -> list[dict[str, Any]]:
"""Hybrid search combining FTS5 BM25 and vector embeddings via RRF.

Expand Down Expand Up @@ -301,7 +303,7 @@ def hybrid_search(
logger.warning("FTS5 unavailable, will use fallback: %s", e)

# Try embedding search
emb_results = _embedding_search(store, query, limit=fetch_limit)
emb_results = _embedding_search(store, query, limit=fetch_limit, model=model)

# ------ Phase 2: Merge via RRF or fallback ------
if fts_results or emb_results:
Expand Down
1 change: 1 addition & 0 deletions code_review_graph/tools/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def semantic_search_nodes(
try:
results = hybrid_search(
store, query, kind=kind, limit=limit, context_files=context_files,
model=model,
)

search_mode = "hybrid"
Expand Down