Address terminology consistency and edge case logging
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
296287d076
commit
875d0bf083
2 changed files with 10 additions and 9 deletions
|
|
@ -25,11 +25,11 @@ from .prompt_helpers import to_prompt_json
|
||||||
class EdgeDuplicate(BaseModel):
|
class EdgeDuplicate(BaseModel):
|
||||||
duplicate_facts: list[int] = Field(
|
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(
|
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')
|
fact_type: str = Field(..., description='One of the provided fact types or DEFAULT')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -506,13 +506,14 @@ async def resolve_extracted_edge(
|
||||||
'ensure_ascii': ensure_ascii,
|
'ensure_ascii': ensure_ascii,
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(
|
if related_edges or existing_edges:
|
||||||
'Resolving edge: sent %d EXISTING FACTS (idx 0-%d) and %d INVALIDATION CANDIDATES (idx 0-%d)',
|
logger.debug(
|
||||||
len(related_edges),
|
'Resolving edge: sent %d EXISTING FACTS%s and %d INVALIDATION CANDIDATES%s',
|
||||||
len(related_edges) - 1,
|
len(related_edges),
|
||||||
len(existing_edges),
|
f' (idx 0-{len(related_edges) - 1})' if related_edges else '',
|
||||||
len(existing_edges) - 1,
|
len(existing_edges),
|
||||||
)
|
f' (idx 0-{len(existing_edges) - 1})' if existing_edges else '',
|
||||||
|
)
|
||||||
|
|
||||||
llm_response = await llm_client.generate_response(
|
llm_response = await llm_client.generate_response(
|
||||||
prompt_library.dedupe_edges.resolve_edge(context),
|
prompt_library.dedupe_edges.resolve_edge(context),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue