fix: Address reviewer comments on list slicing and prompt clarity
- Fix list slicing bug: change <= to < to avoid gap when exactly 20 elements (previously would skip element 10 when showing 21 elements) - Consolidate redundant prompt phrasing while maintaining clarity (reduced from 3 sentences to 2, keeping essential constraints) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8658bf2949
commit
771d3bdfef
2 changed files with 2 additions and 3 deletions
|
|
@ -167,8 +167,7 @@ def nodes(context: dict[str, Any]) -> list[Message]:
|
||||||
|
|
||||||
Task:
|
Task:
|
||||||
ENTITIES contains {len(context['extracted_nodes'])} entities with IDs 0 through {len(context['extracted_nodes']) - 1}.
|
ENTITIES contains {len(context['extracted_nodes'])} entities with IDs 0 through {len(context['extracted_nodes']) - 1}.
|
||||||
Respond with a JSON object that contains an "entity_resolutions" array with EXACTLY {len(context['extracted_nodes'])} entries - one for each entity in ENTITIES.
|
Your response MUST include EXACTLY {len(context['extracted_nodes'])} resolutions using these exact IDs (0 through {len(context['extracted_nodes']) - 1}). Do not skip IDs or use IDs outside this range.
|
||||||
Your response MUST use only the IDs 0 through {len(context['extracted_nodes']) - 1}. Do not skip any IDs or use IDs outside this range.
|
|
||||||
|
|
||||||
For every entity, return an object with the following keys:
|
For every entity, return an object with the following keys:
|
||||||
{{
|
{{
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ async def _resolve_with_llm(
|
||||||
'Sending %d entities to LLM for deduplication with IDs 0-%d (actual IDs sent: %s)',
|
'Sending %d entities to LLM for deduplication with IDs 0-%d (actual IDs sent: %s)',
|
||||||
len(llm_extracted_nodes),
|
len(llm_extracted_nodes),
|
||||||
len(llm_extracted_nodes) - 1,
|
len(llm_extracted_nodes) - 1,
|
||||||
sent_ids if len(sent_ids) <= 20 else f'{sent_ids[:10]}...{sent_ids[-10:]}',
|
sent_ids if len(sent_ids) < 20 else f'{sent_ids[:10]}...{sent_ids[-10:]}',
|
||||||
)
|
)
|
||||||
if llm_extracted_nodes:
|
if llm_extracted_nodes:
|
||||||
sample_size = min(3, len(extracted_nodes_context))
|
sample_size = min(3, len(extracted_nodes_context))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue