chore: Format edge_operations.py and update lock file

- Minor formatting fix in edge_operations.py list comprehension
- Update uv.lock with version bump to 0.21.0rc8

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Daniel Chalef 2025-10-01 08:59:58 -07:00
parent 36356f491b
commit 34e69e6d36
3 changed files with 21 additions and 29 deletions

View file

@ -23,23 +23,17 @@ from .prompt_helpers import to_prompt_json
class Edge(BaseModel):
relation_type: str = Field(
..., description="FACT_PREDICATE_IN_SCREAMING_SNAKE_CASE"
)
source_entity_id: int = Field(
..., description="The id of the source entity of the fact."
)
target_entity_id: int = Field(
..., description="The id of the target entity of the fact."
)
fact: str = Field(..., description="")
relation_type: str = Field(..., description='FACT_PREDICATE_IN_SCREAMING_SNAKE_CASE')
source_entity_id: int = Field(..., description='The id of the source entity of the fact.')
target_entity_id: int = Field(..., description='The id of the target entity of the fact.')
fact: str = Field(..., description='')
valid_at: str | None = Field(
None,
description="The date and time when the relationship described by the edge fact became true or was established. Use ISO 8601 format (YYYY-MM-DDTHH:MM:SS.SSSSSSZ)",
description='The date and time when the relationship described by the edge fact became true or was established. Use ISO 8601 format (YYYY-MM-DDTHH:MM:SS.SSSSSSZ)',
)
invalid_at: str | None = Field(
None,
description="The date and time when the relationship described by the edge fact stopped being true or ended. Use ISO 8601 format (YYYY-MM-DDTHH:MM:SS.SSSSSSZ)",
description='The date and time when the relationship described by the edge fact stopped being true or ended. Use ISO 8601 format (YYYY-MM-DDTHH:MM:SS.SSSSSSZ)',
)
@ -66,13 +60,13 @@ class Versions(TypedDict):
def edge(context: dict[str, Any]) -> list[Message]:
return [
Message(
role="system",
content="You are an expert fact extractor that extracts fact triples from text. "
"1. Extracted fact triples should also be extracted with relevant date information."
"2. Treat the CURRENT TIME as the time the CURRENT MESSAGE was sent. All temporal information should be extracted relative to this time.",
role='system',
content='You are an expert fact extractor that extracts fact triples from text. '
'1. Extracted fact triples should also be extracted with relevant date information.'
'2. Treat the CURRENT TIME as the time the CURRENT MESSAGE was sent. All temporal information should be extracted relative to this time.',
),
Message(
role="user",
role='user',
content=f"""
<FACT TYPES>
{context['edge_types']}
@ -157,19 +151,19 @@ Given the above MESSAGES, list of EXTRACTED ENTITIES entities, and list of EXTRA
determine if any facts haven't been extracted.
"""
return [
Message(role="system", content=sys_prompt),
Message(role="user", content=user_prompt),
Message(role='system', content=sys_prompt),
Message(role='user', content=user_prompt),
]
def extract_attributes(context: dict[str, Any]) -> list[Message]:
return [
Message(
role="system",
content="You are a helpful assistant that extracts fact properties from the provided text.",
role='system',
content='You are a helpful assistant that extracts fact properties from the provided text.',
),
Message(
role="user",
role='user',
content=f"""
<MESSAGE>
@ -195,7 +189,7 @@ def extract_attributes(context: dict[str, Any]) -> list[Message]:
versions: Versions = {
"edge": edge,
"reflexion": reflexion,
"extract_attributes": extract_attributes,
'edge': edge,
'reflexion': reflexion,
'extract_attributes': extract_attributes,
}

View file

@ -480,9 +480,7 @@ async def resolve_extracted_edge(
start = time()
# Prepare context for LLM
related_edges_context = [
{'id': i, 'fact': edge.fact} for i, edge in enumerate(related_edges)
]
related_edges_context = [{'id': i, 'fact': edge.fact} for i, edge in enumerate(related_edges)]
invalidation_edge_candidates_context = [
{'id': i, 'fact': existing_edge.fact} for i, existing_edge in enumerate(existing_edges)

2
uv.lock generated
View file

@ -783,7 +783,7 @@ wheels = [
[[package]]
name = "graphiti-core"
version = "0.21.0rc7"
version = "0.21.0rc8"
source = { editable = "." }
dependencies = [
{ name = "diskcache" },