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:
+13
-1
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user