bitflicker64 commented on code in PR #412:
URL: https://github.com/apache/hugegraph-ai/pull/412#discussion_r4580998002


##########
hugegraph-llm/src/hugegraph_llm/indices/vector_index/milvus_vector_store.py:
##########
@@ -166,14 +158,15 @@ def search(self, query_vector: List[float], top_k: int, 
dis_threshold: float = 0
             ret = []
             for hits in results:
                 for hit in hits:
-                    if hit.distance < dis_threshold:
-                        prop_str = hit.entity.get("property")
-                        prop = self._serialize_property(prop_str)
-                        ret.append(prop)
+                    if hit.distance <= dis_threshold:
+                        # Property strings round-trip verbatim: decoding 
JSON-shaped
+                        # chunk text ("123", '{"a": 1}') would change its type 
and
+                        # make downstream consumers drop it as malformed.
+                        ret.append(hit.entity.get("property"))

Review Comment:
   Important: the `gremlin_examples` index stores `{"query", "gremlin"}` dicts 
as JSON text, so this returns a `str` and 
`GremlinGenerateSynthesize._format_examples` raises `TypeError` on 
`example['query']`, breaking Text2Gremlin and the GraphRAG gremlin path on 
Milvus. Decode string hits with `json.loads` in 
`GremlinExampleIndexQuery._get_match_result` and add a Milvus dict round-trip 
test.



##########
hugegraph-llm/src/hugegraph_llm/api/models/rag_requests.py:
##########
@@ -48,10 +48,11 @@ class RAGRequest(BaseModel):
     # Graph Configs
     max_graph_items: int = Query(30, description="Maximum number of items for 
GQL queries in graph.")
     topk_return_results: int = Query(20, description="Number of sorted results 
to return finally.")
-    vector_dis_threshold: float = Query(
-        0.9,
-        description="Threshold for vector similarity\
-                                         (results greater than this will be 
ignored).",
+    vector_dis_threshold: Optional[float] = Query(
+        None,
+        description="Distance threshold override for this request, applied to 
chunk retrieval and \

Review Comment:
   Minor: this description says the field applies to chunk retrieval, but 
`VectorQueryNode` no longer forwards it, so chunk retrieval always uses 
`CHUNK_DIS_THRESHOLD`. Describe it as the keyword-to-vertex override falling 
back to `VECTOR_DIS_THRESHOLD`, here and in `GraphRAGRequest`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to