fix: update UUID generation and message handling (#123)

* chore: Update uuid generation + service fixes

* chore: Version bump
This commit is contained in:
Pavlo Paliychuk 2024-09-18 12:48:44 -04:00 committed by GitHub
parent db376c64c3
commit 529a1aaecf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 4 deletions

View file

@ -33,7 +33,7 @@ logger = logging.getLogger(__name__)
class Edge(BaseModel, ABC):
uuid: str = Field(default_factory=lambda: uuid4().hex)
uuid: str = Field(default_factory=lambda: str(uuid4()))
group_id: str | None = Field(description='partition of the graph')
source_node_uuid: str
target_node_uuid: str

View file

@ -68,7 +68,7 @@ class EpisodeType(Enum):
class Node(BaseModel, ABC):
uuid: str = Field(default_factory=lambda: uuid4().hex)
uuid: str = Field(default_factory=lambda: str(uuid4()))
name: str = Field(description='name of the node')
group_id: str | None = Field(description='partition of the graph')
labels: list[str] = Field(default_factory=list)

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "graphiti-core"
version = "0.3.2"
version = "0.3.3"
description = "A temporal graph building library"
authors = [
"Paul Paliychuk <paul@getzep.com>",

View file

@ -55,6 +55,7 @@ async def add_messages(
):
async def add_messages_task(m: Message):
await graphiti.add_episode(
uuid=m.uuid,
group_id=request.group_id,
name=m.name,
episode_body=f"{m.role or ''}({m.role_type}): {m.content}",

View file

@ -29,7 +29,8 @@ async def search(query: SearchQuery, graphiti: ZepGraphitiDep):
@router.get('/entity-edge/{uuid}', status_code=status.HTTP_200_OK)
async def get_entity_edge(uuid: str, graphiti: ZepGraphitiDep):
return await graphiti.get_entity_edge(uuid)
entity_edge = await graphiti.get_entity_edge(uuid)
return get_fact_result_from_edge(entity_edge)
@router.get('/episodes/{group_id}', status_code=status.HTTP_200_OK)