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:
parent
f91570a359
commit
f536c4e948
2 changed files with 7 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ from pydantic import BaseModel, Field
|
||||||
from typing_extensions import LiteralString
|
from typing_extensions import LiteralString
|
||||||
|
|
||||||
from graphiti_core.embedder import EmbedderClient
|
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.helpers import DEFAULT_DATABASE, parse_db_date
|
||||||
from graphiti_core.models.edges.edge_db_queries import (
|
from graphiti_core.models.edges.edge_db_queries import (
|
||||||
COMMUNITY_EDGE_SAVE,
|
COMMUNITY_EDGE_SAVE,
|
||||||
|
|
@ -289,8 +289,6 @@ class EntityEdge(Edge):
|
||||||
|
|
||||||
edges = [get_entity_edge_from_record(record) for record in records]
|
edges = [get_entity_edge_from_record(record) for record in records]
|
||||||
|
|
||||||
if len(edges) == 0:
|
|
||||||
raise EdgesNotFoundError(uuids)
|
|
||||||
return edges
|
return edges
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from contextlib import suppress
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
import pydantic
|
import pydantic
|
||||||
|
|
@ -365,9 +366,13 @@ async def resolve_extracted_node(
|
||||||
|
|
||||||
extracted_node.summary = node_attributes_response.get('summary', '')
|
extracted_node.summary = node_attributes_response.get('summary', '')
|
||||||
node_attributes = {
|
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)
|
extracted_node.attributes.update(node_attributes)
|
||||||
|
|
||||||
is_duplicate: bool = llm_response.get('is_duplicate', False)
|
is_duplicate: bool = llm_response.get('is_duplicate', False)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue