Skip to content

Commit f70bb73

Browse files
committed
fix: narrow exception handling and fix float cast in hybrid search
- CoordinodePropertyGraphStore.__init__: set supports_vector_queries per instance based on callable(getattr(client, "vector_search", None)) so injected clients without vector_search() correctly advertise False instead of the unconditional class-level True - refresh_schema(): add debug logging before _parse_schema() fallback so the swallowed exception remains observable; expand comment explaining why broad Exception is intentional (no hard grpc dependency in langchain package) - hybrid_text_vector_search(): cast vector elements via [float(v) for v in vector] to match vector_search() and text_vector_search() convention; prevents breakage with numpy/decimal callers
1 parent 64e45dd commit f70bb73

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

  • coordinode/coordinode
  • langchain-coordinode/langchain_coordinode
  • llama-index-coordinode/llama_index/graph_stores/coordinode

coordinode/coordinode/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ async def hybrid_text_vector_search(
642642
req = HybridTextVectorSearchRequest(
643643
label=label,
644644
text_query=text_query,
645-
vector=list(vector),
645+
vector=[float(v) for v in vector],
646646
limit=limit,
647647
text_weight=text_weight,
648648
vector_weight=vector_weight,

langchain-coordinode/langchain_coordinode/graph.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44

55
import hashlib
66
import json
7+
import logging
78
import re
89
from collections.abc import Sequence
910
from typing import Any
1011

12+
logger = logging.getLogger(__name__)
13+
1114
from langchain_community.graphs.graph_store import GraphStore
1215

1316
from coordinode import CoordinodeClient
@@ -119,6 +122,15 @@ def refresh_schema(self) -> None:
119122
# or another gRPC error if the schema service is not available in the
120123
# deployed version. Fall back to text-based schema parsing to avoid
121124
# surfacing an unhandled exception to the caller.
125+
# We catch broad Exception (rather than grpc.RpcError specifically)
126+
# because langchain-coordinode does not take a hard grpc dependency —
127+
# clients may be non-gRPC (e.g. coordinode-embedded LocalClient).
128+
# The exception is logged at DEBUG so it remains observable without
129+
# cluttering production output.
130+
logger.debug(
131+
"get_labels()/get_edge_types() failed — falling back to _parse_schema()",
132+
exc_info=True,
133+
)
122134
structured = _parse_schema(self._schema)
123135
else:
124136
structured = _parse_schema(self._schema)

llama-index-coordinode/llama_index/graph_stores/coordinode/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ def __init__(
8181
raise TypeError("client must provide a callable cypher() method")
8282
self._owns_client = client is None
8383
self._client = client if client is not None else CoordinodeClient(addr, timeout=timeout)
84+
# Advertise vector capability based on what the actual client exposes.
85+
# Injected clients (e.g. bare coordinode-embedded LocalClient) may not
86+
# implement vector_search(); claiming True unconditionally would mislead
87+
# LlamaIndex into passing vector queries that silently return no results.
88+
self.supports_vector_queries = callable(getattr(self._client, "vector_search", None))
8489

8590
# ── Node operations ───────────────────────────────────────────────────
8691

0 commit comments

Comments
 (0)