From 875d0bf083a3549c20b9efae305eb967457c89c6 Mon Sep 17 00:00:00 2001 From: Daniel Chalef <131175+danielchalef@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:56:39 -0700 Subject: [PATCH] Address terminology consistency and edge case logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update Pydantic field descriptions to use 'idx' instead of 'ids' for consistency - Fix debug logging to handle empty list edge case (avoid 'idx 0--1' display) Note on review feedback: - Validation is intentionally non-redundant: warnings provide visibility, list comprehensions ensure robustness - WARNING level is appropriate for LLM output issues (not system errors) - Existing test coverage is sufficient for this defensive logging addition 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- graphiti_core/prompts/dedupe_edges.py | 4 ++-- .../utils/maintenance/edge_operations.py | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/graphiti_core/prompts/dedupe_edges.py b/graphiti_core/prompts/dedupe_edges.py index b60dd1b9..49743fcd 100644 --- a/graphiti_core/prompts/dedupe_edges.py +++ b/graphiti_core/prompts/dedupe_edges.py @@ -25,11 +25,11 @@ from .prompt_helpers import to_prompt_json class EdgeDuplicate(BaseModel): duplicate_facts: list[int] = Field( ..., - description='List of ids of any duplicate facts. If no duplicate facts are found, default to empty list.', + description='List of idx values of any duplicate facts. If no duplicate facts are found, default to empty list.', ) contradicted_facts: list[int] = Field( ..., - description='List of ids of facts that should be invalidated. If no facts should be invalidated, the list should be empty.', + description='List of idx values of facts that should be invalidated. If no facts should be invalidated, the list should be empty.', ) fact_type: str = Field(..., description='One of the provided fact types or DEFAULT') diff --git a/graphiti_core/utils/maintenance/edge_operations.py b/graphiti_core/utils/maintenance/edge_operations.py index 5637e1c3..fccbbbfd 100644 --- a/graphiti_core/utils/maintenance/edge_operations.py +++ b/graphiti_core/utils/maintenance/edge_operations.py @@ -506,13 +506,14 @@ async def resolve_extracted_edge( 'ensure_ascii': ensure_ascii, } - logger.debug( - 'Resolving edge: sent %d EXISTING FACTS (idx 0-%d) and %d INVALIDATION CANDIDATES (idx 0-%d)', - len(related_edges), - len(related_edges) - 1, - len(existing_edges), - len(existing_edges) - 1, - ) + if related_edges or existing_edges: + logger.debug( + 'Resolving edge: sent %d EXISTING FACTS%s and %d INVALIDATION CANDIDATES%s', + len(related_edges), + f' (idx 0-{len(related_edges) - 1})' if related_edges else '', + len(existing_edges), + f' (idx 0-{len(existing_edges) - 1})' if existing_edges else '', + ) llm_response = await llm_client.generate_response( prompt_library.dedupe_edges.resolve_edge(context),