get edges by uuids return empty list instead of errors (#308)

* get edges by uuids return empty list instead of errors

* lint

* fix null bugs

* guard rails for null summary

* supress
This commit is contained in:
Preston Rasmussen 2025-03-27 15:00:05 -04:00 committed by GitHub
parent f91570a359
commit f536c4e948
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -26,7 +26,7 @@ from pydantic import BaseModel, Field
from typing_extensions import LiteralString
from graphiti_core.embedder import EmbedderClient
from graphiti_core.errors import EdgeNotFoundError, EdgesNotFoundError, GroupsEdgesNotFoundError
from graphiti_core.errors import EdgeNotFoundError, GroupsEdgesNotFoundError
from graphiti_core.helpers import DEFAULT_DATABASE, parse_db_date
from graphiti_core.models.edges.edge_db_queries import (
COMMUNITY_EDGE_SAVE,
@ -289,8 +289,6 @@ class EntityEdge(Edge):
edges = [get_entity_edge_from_record(record) for record in records]
if len(edges) == 0:
raise EdgesNotFoundError(uuids)
return edges
@classmethod

View file

@ -15,6 +15,7 @@ limitations under the License.
"""
import logging
from contextlib import suppress
from time import time
import pydantic
@ -365,9 +366,13 @@ async def resolve_extracted_node(
extracted_node.summary = node_attributes_response.get('summary', '')
node_attributes = {
key: value if value != 'None' else None for key, value in node_attributes_response.items()
key: value if (value != 'None' or key == 'summary') else None
for key, value in node_attributes_response.items()
}
with suppress(KeyError):
del node_attributes['summary']
extracted_node.attributes.update(node_attributes)
is_duplicate: bool = llm_response.get('is_duplicate', False)