extraction error logging
This commit is contained in:
@@ -27,6 +27,10 @@ function buildExtractionPrompt(userMessage, aiResponse, knownEntities = []) {
|
|||||||
'For each entity found, provide: name, type, and a one-sentence notes field.',
|
'For each entity found, provide: name, type, and a one-sentence notes field.',
|
||||||
'Return your answer as: { "entities": [ ... ] }',
|
'Return your answer as: { "entities": [ ... ] }',
|
||||||
'For each entity found, you MUST provide a non-empty notes field describing it based on the conversation.',
|
'For each entity found, you MUST provide a non-empty notes field describing it based on the conversation.',
|
||||||
|
'For each entity found, provide:',
|
||||||
|
' "name": short proper noun only (max 4 words, e.g. "Sydney", "NexusAI", "Tim")',
|
||||||
|
' "type": one of the valid types',
|
||||||
|
' "notes": one specific sentence about this entity based on the conversation (not generic)',
|
||||||
'',
|
'',
|
||||||
knownBlock,
|
knownBlock,
|
||||||
'--- CONVERSATION ---', // clear delimiter helps smaller models
|
'--- CONVERSATION ---', // clear delimiter helps smaller models
|
||||||
|
|||||||
@@ -32,12 +32,11 @@ async function searchEpisodes( vector, {limit = ORCHESTRATION.RECENT_EPISODE_LIM
|
|||||||
async function searchEntities(vector, { limit = ORCHESTRATION.ENTITIES_LIMIT, scoreThreshold = ORCHESTRATION.ENTITIES_THRESHOLD, projectId = undefined } = {}) {
|
async function searchEntities(vector, { limit = ORCHESTRATION.ENTITIES_LIMIT, scoreThreshold = ORCHESTRATION.ENTITIES_THRESHOLD, projectId = undefined } = {}) {
|
||||||
const body = { vector, limit, score_threshold: scoreThreshold, with_payload: true };
|
const body = { vector, limit, score_threshold: scoreThreshold, with_payload: true };
|
||||||
|
|
||||||
if (projectId !== undefined) {
|
if (projectId !== null && projectId !== undefined) {
|
||||||
body.filter = {
|
body.filter = {
|
||||||
must: [{ key: 'projectId', match: { value: projectId ?? null } }]
|
must: [{ key: 'projectId', match: { value: projectId } }]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${BASE_URL}/collections/${COLLECTIONS.ENTITIES}/points/search`,
|
`${BASE_URL}/collections/${COLLECTIONS.ENTITIES}/points/search`,
|
||||||
{
|
{
|
||||||
@@ -47,7 +46,11 @@ async function searchEntities(vector, { limit = ORCHESTRATION.ENTITIES_LIMIT, sc
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!res.ok) throw new Error(`Qdrant error: ${res.status}`);
|
if (!res.ok) {
|
||||||
|
const body = await res.text();
|
||||||
|
throw new Error(`Qdrant error: ${res.status} - ${body}`);
|
||||||
|
}
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
return data.result;
|
return data.result;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
packages/source.zip
Normal file
BIN
packages/source.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user