Skip to content

Commit

Permalink
fix: update UUID generation and message handling (#123)
Browse files Browse the repository at this point in the history
* chore: Update uuid generation + service fixes

* chore: Version bump
  • Loading branch information
paul-paliychuk committed Sep 18, 2024
1 parent db376c6 commit 529a1aa
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion graphiti_core/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


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
Expand Down
2 changes: 1 addition & 1 deletion graphiti_core/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def from_str(episode_type: str):


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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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>",
Expand Down
1 change: 1 addition & 0 deletions server/graph_service/routers/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
3 changes: 2 additions & 1 deletion server/graph_service/routers/retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 529a1aa

Please sign in to comment.