Skip to content

Commit

Permalink
Merge pull request #415 from SaujanyaV/fix-entity-name-string
Browse files Browse the repository at this point in the history
Fix: Ensure entity_or_relation_name is a string in _handle_entity_relation_summary
  • Loading branch information
LarFii authored Dec 9, 2024
2 parents ffa95e0 + 71af341 commit e083854
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/graph_visual_with_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# Convert NetworkX graph to Pyvis network
net.from_nx(G)


# Add colors and title to nodes
for node in net.nodes:
node["color"] = "#{:06x}".format(random.randint(0, 0xFFFFFF))
Expand Down
1 change: 0 additions & 1 deletion lightrag/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ async def jina_embedding(
data_list = await fetch_data(url, headers, data)
return np.array([dp["embedding"] for dp in data_list])


@wrap_embedding_func_with_attrs(embedding_dim=2048, max_token_size=512)
@retry(
stop=stop_after_attempt(3),
Expand Down
4 changes: 2 additions & 2 deletions lightrag/operate.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ async def _merge_edges_then_upsert(
},
)
description = await _handle_entity_relation_summary(
(src_id, tgt_id), description, global_config
f"({src_id}, {tgt_id})", description, global_config
)
await knowledge_graph_inst.upsert_edge(
src_id,
Expand Down Expand Up @@ -572,7 +572,6 @@ async def kg_query(
mode=query_param.mode,
),
)

return response


Expand Down Expand Up @@ -1104,6 +1103,7 @@ async def naive_query(
response = await use_model_func(
query,
system_prompt=sys_prompt,
mode=query_param.mode,
)

if len(response) > len(sys_prompt):
Expand Down
2 changes: 1 addition & 1 deletion lightrag/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ async def get_best_cached_response(
except Exception as e: # Catch all possible exceptions
logger.warning(f"LLM similarity check failed: {e}")
return None # Return None directly when LLM check fails

prompt_display = (
best_prompt[:50] + "..." if len(best_prompt) > 50 else best_prompt
)
Expand Down

0 comments on commit e083854

Please sign in to comment.