@@ -324,17 +324,18 @@ def _post_process_pref_mem(
324324 memories_result : list [dict [str , Any ]],
325325 pref_formatted_mem : list [dict [str , Any ]],
326326 mem_cube_id : str ,
327- handle_pref_mem : bool ,
327+ include_preference : bool ,
328328):
329- if handle_pref_mem :
329+ if include_preference :
330330 memories_result ["pref_mem" ].append (
331331 {
332332 "cube_id" : mem_cube_id ,
333333 "memories" : pref_formatted_mem ,
334334 }
335335 )
336- pref_instruction : str = instruct_completion (pref_formatted_mem )
336+ pref_instruction , pref_note = instruct_completion (pref_formatted_mem )
337337 memories_result ["pref_string" ] = pref_instruction
338+ memories_result ["pref_note" ] = pref_note
338339
339340 return memories_result
340341
@@ -354,7 +355,7 @@ def search_memories(search_req: APISearchRequest):
354355 "act_mem" : [],
355356 "para_mem" : [],
356357 "pref_mem" : [],
357- "pref_string " : "" ,
358+ "pref_note " : "" ,
358359 }
359360
360361 search_mode = search_req .mode
@@ -382,7 +383,7 @@ def _search_pref():
382383 return []
383384 results = naive_mem_cube .pref_mem .search (
384385 query = search_req .query ,
385- top_k = search_req .top_k ,
386+ top_k = search_req .pref_top_k ,
386387 info = {
387388 "user_id" : search_req .user_id ,
388389 "session_id" : search_req .session_id ,
@@ -405,7 +406,10 @@ def _search_pref():
405406 )
406407
407408 memories_result = _post_process_pref_mem (
408- memories_result , pref_formatted_memories , search_req .mem_cube_id , search_req .handle_pref_mem
409+ memories_result ,
410+ pref_formatted_memories ,
411+ search_req .mem_cube_id ,
412+ search_req .include_preference ,
409413 )
410414
411415 return SearchResponse (
0 commit comments