Skip to content

Commit

Permalink
Merge pull request #274 from tigergraph/GML-1876-hnsw-overlap-improve…
Browse files Browse the repository at this point in the history
…ment

updates to hnsw overlap
  • Loading branch information
parkererickson-tg authored Sep 6, 2024
2 parents 1d8e9b8 + 2efc5d1 commit fbd5ea3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions common/gsql/supportai/retrievers/HNSW_Overlap_Search.gsql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ CREATE OR REPLACE DISTRIBUTED QUERY HNSW_Overlap_Search(Set<STRING> v_types, STR
start = SELECT s FROM start:s POST-ACCUM s.@num_times_seen += 1;

FOREACH i IN RANGE[0, num_hops-1] DO
start = SELECT t FROM start:s -(:e)- :t
start = SELECT t FROM start:s -((RELATIONSHIP|
CONTAINS_ENTITY|
IS_AFTER|
reverse_CONTAINS_ENTITY|
IS_HEAD_OF|
HAS_TAIL):e)- :t
ACCUM @@edges += e
POST-ACCUM t.@num_times_seen += 1;
END;
Expand All @@ -40,7 +45,11 @@ CREATE OR REPLACE DISTRIBUTED QUERY HNSW_Overlap_Search(Set<STRING> v_types, STR
IF s.type == "Relationship" THEN
@@relationship_info += (s.id -> s.definition)
ELSE IF s.type == "Entity" THEN
@@entity_info += (s.id -> s.definition)
STRING tmp_dsc = s.definition,
FOREACH dsc IN s.description DO
tmp_dsc = tmp_dsc + dsc +";"
END,
@@entity_info += (s.id -> tmp_dsc)
ELSE IF s.type == "DocumentChunk" THEN
@@to_retrieve_content += s
END;
Expand Down
4 changes: 2 additions & 2 deletions eventual-consistency-service/app/graphrag/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ async def check_vertex_exists(conn, v_id: str):
res.raise_for_status()
return res.json()
except Exception as e:
logger.error(f"Check err:\n{e}\n{res.text}")
return {"error": True, "message": res.text}
logger.error(f"Check err:\n{e}\n{e}")
return {"error": True, "message": e}


async def upsert_edge(
Expand Down

0 comments on commit fbd5ea3

Please sign in to comment.