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 [
'<|im_start|>system',
'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|>',
'<|im_start|>user',
'Extract all named entities from this conversation.',
'<|user|>',
'Extract all named entities from this conversation as a JSON array. Output only valid JSON, nothing else.',
'',
`Valid types: ${ENTITY_TYPES.join(', ')}`,
'',
knownBlock,
'Examples of entities to extract:',
'- 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:',
'Each item must have:',
' "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',
'',
'### Conversation:',
`User: ${userMessage}`,
`Assistant: ${aiResponse}`,
'',
'### Extracted entities as JSON array:',
'<|im_end|>',
'<|im_start|>assistant',
'<|end|>',
'<|assistant|>',
'[',
].join('\n');
}