updated extraction for phi3

This commit is contained in:
Storme-bit
2026-04-20 23:13:47 -07:00
parent af04cef307
commit d2352ea48b

View File

@@ -18,33 +18,21 @@ function buildExtractionPrompt(userMessage, aiResponse, knownEntities = []) {
: ''; : '';
return [ return [
'<|im_start|>system', '<|user|>',
'You are an entity extraction assistant. You extract named entities from conversations and return them as a JSON array. You never return empty arrays when entities are present. You only output valid JSON.<|im_end|>', 'Extract all named entities from this conversation as a JSON array. Output only valid JSON, nothing else.',
'<|im_start|>user',
'Extract all named entities from this conversation.',
'', '',
`Valid types: ${ENTITY_TYPES.join(', ')}`, `Valid types: ${ENTITY_TYPES.join(', ')}`,
'', '',
knownBlock, knownBlock,
'Examples of entities to extract:', 'Each item must have:',
'- People: names of individuals',
'- Projects: software projects, systems, tools being built',
'- Technologies: databases, frameworks, languages, hardware',
'- Organizations: companies, teams',
'- Places: locations, servers, infrastructure',
'',
'Return a JSON array where each item has:',
' "name": the entity name (match exactly if already known)', ' "name": the entity name (match exactly if already known)',
' "type": one of the valid types above (match exactly if already known)', ' "type": one of the valid types above',
' "notes": one sentence describing this entity based on the conversation', ' "notes": one sentence describing this entity based on the conversation',
'', '',
'### Conversation:',
`User: ${userMessage}`, `User: ${userMessage}`,
`Assistant: ${aiResponse}`, `Assistant: ${aiResponse}`,
'', '<|end|>',
'### Extracted entities as JSON array:', '<|assistant|>',
'<|im_end|>',
'<|im_start|>assistant',
'[', '[',
].join('\n'); ].join('\n');
} }