Enhance observation parsing and querying functionality

- Filter out observation type from concepts array in parseObservations function to ensure types and concepts are treated as separate dimensions. Added logging for removed types.
- Update prompts documentation to clarify that the observation type must not be included in the concepts array.
- Modify search-server to provide clearer guidance on result limits, emphasizing starting with smaller limits to avoid exceeding token limits.
- Refactor SessionSearch methods to accept options for limit, offset, and orderBy parameters, improving flexibility in querying observations by concept and type.
This commit is contained in:
Alex Newman
2025-10-21 19:01:11 -04:00
parent e9bcb7e9db
commit 02bce8a6e6
6 changed files with 78 additions and 38 deletions
+13 -1
View File
@@ -68,13 +68,25 @@ export function parseObservations(text: string, correlationId?: string): ParsedO
continue;
}
// Filter out type from concepts array (types and concepts are separate dimensions)
const cleanedConcepts = concepts.filter(c => c !== type.trim());
if (cleanedConcepts.length !== concepts.length) {
logger.warn('PARSER', 'Removed observation type from concepts array', {
correlationId,
type: type.trim(),
originalConcepts: concepts,
cleanedConcepts
});
}
observations.push({
type: type.trim(),
title,
subtitle,
facts,
narrative,
concepts,
concepts: cleanedConcepts,
files_read,
files_modified
});