Merge pull request #415 from SaujanyaV/fix-entity-name-string

Fix: Ensure entity_or_relation_name is a string in _handle_entity_relation_summary
This commit is contained in:
zrguo
2024-12-09 17:36:06 +08:00
committed by GitHub
4 changed files with 4 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ net = Network(height="100vh", notebook=True)
# Convert NetworkX graph to Pyvis network # Convert NetworkX graph to Pyvis network
net.from_nx(G) net.from_nx(G)
# Add colors and title to nodes # Add colors and title to nodes
for node in net.nodes: for node in net.nodes:
node["color"] = "#{:06x}".format(random.randint(0, 0xFFFFFF)) node["color"] = "#{:06x}".format(random.randint(0, 0xFFFFFF))

View File

@@ -616,7 +616,6 @@ async def jina_embedding(
data_list = await fetch_data(url, headers, data) data_list = await fetch_data(url, headers, data)
return np.array([dp["embedding"] for dp in data_list]) return np.array([dp["embedding"] for dp in data_list])
@wrap_embedding_func_with_attrs(embedding_dim=2048, max_token_size=512) @wrap_embedding_func_with_attrs(embedding_dim=2048, max_token_size=512)
@retry( @retry(
stop=stop_after_attempt(3), stop=stop_after_attempt(3),

View File

@@ -222,7 +222,7 @@ async def _merge_edges_then_upsert(
}, },
) )
description = await _handle_entity_relation_summary( 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( await knowledge_graph_inst.upsert_edge(
src_id, src_id,
@@ -572,7 +572,6 @@ async def kg_query(
mode=query_param.mode, mode=query_param.mode,
), ),
) )
return response return response
@@ -1104,6 +1103,7 @@ async def naive_query(
response = await use_model_func( response = await use_model_func(
query, query,
system_prompt=sys_prompt, system_prompt=sys_prompt,
mode=query_param.mode,
) )
if len(response) > len(sys_prompt): if len(response) > len(sys_prompt):

View File

@@ -383,7 +383,7 @@ async def get_best_cached_response(
except Exception as e: # Catch all possible exceptions except Exception as e: # Catch all possible exceptions
logger.warning(f"LLM similarity check failed: {e}") logger.warning(f"LLM similarity check failed: {e}")
return None # Return None directly when LLM check fails return None # Return None directly when LLM check fails
prompt_display = ( prompt_display = (
best_prompt[:50] + "..." if len(best_prompt) > 50 else best_prompt best_prompt[:50] + "..." if len(best_prompt) > 50 else best_prompt
) )