fix: update UUID generation and message handling (#123)
* chore: Update uuid generation + service fixes * chore: Version bump
This commit is contained in:
parent
db376c64c3
commit
529a1aaecf
5 changed files with 6 additions and 4 deletions
|
|
@ -33,7 +33,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Edge(BaseModel, ABC):
|
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')
|
group_id: str | None = Field(description='partition of the graph')
|
||||||
source_node_uuid: str
|
source_node_uuid: str
|
||||||
target_node_uuid: str
|
target_node_uuid: str
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class EpisodeType(Enum):
|
||||||
|
|
||||||
|
|
||||||
class Node(BaseModel, ABC):
|
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')
|
name: str = Field(description='name of the node')
|
||||||
group_id: str | None = Field(description='partition of the graph')
|
group_id: str | None = Field(description='partition of the graph')
|
||||||
labels: list[str] = Field(default_factory=list)
|
labels: list[str] = Field(default_factory=list)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "graphiti-core"
|
name = "graphiti-core"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
description = "A temporal graph building library"
|
description = "A temporal graph building library"
|
||||||
authors = [
|
authors = [
|
||||||
"Paul Paliychuk <paul@getzep.com>",
|
"Paul Paliychuk <paul@getzep.com>",
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ async def add_messages(
|
||||||
):
|
):
|
||||||
async def add_messages_task(m: Message):
|
async def add_messages_task(m: Message):
|
||||||
await graphiti.add_episode(
|
await graphiti.add_episode(
|
||||||
|
uuid=m.uuid,
|
||||||
group_id=request.group_id,
|
group_id=request.group_id,
|
||||||
name=m.name,
|
name=m.name,
|
||||||
episode_body=f"{m.role or ''}({m.role_type}): {m.content}",
|
episode_body=f"{m.role or ''}({m.role_type}): {m.content}",
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ async def search(query: SearchQuery, graphiti: ZepGraphitiDep):
|
||||||
|
|
||||||
@router.get('/entity-edge/{uuid}', status_code=status.HTTP_200_OK)
|
@router.get('/entity-edge/{uuid}', status_code=status.HTTP_200_OK)
|
||||||
async def get_entity_edge(uuid: str, graphiti: ZepGraphitiDep):
|
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)
|
@router.get('/episodes/{group_id}', status_code=status.HTTP_200_OK)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue