Skip to content

Commit 7e485bf

Browse files
author
yuan.wang
committed
pre comimt
1 parent 670a92e commit 7e485bf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

evaluation/scripts/utils/client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,13 @@ def search(self, query, user_id, top_k):
250250
for i in text_mem_res:
251251
i.update({"memory": i.pop("memory_value")})
252252

253+
pref_instructions = """
254+
# Note:
255+
Plaintext memory are summaries of facts, while preference memories are summaries of user preferences.
256+
Your response must not violate any of the user's preferences, whether explicit or implicit, and briefly explain why you answer this way to avoid conflicts.
257+
When encountering preference conflicts, the priority is: explicit preference > implicit preference > plaintext memory.
258+
"""
259+
253260
explicit_prefs = [
254261
p["preference"]
255262
for p in pref_mem_res
@@ -273,7 +280,7 @@ def search(self, query, user_id, top_k):
273280
+ "\n".join(f"{i + 1}. {p}" for i, p in enumerate(implicit_prefs))
274281
)
275282

276-
pref_string = "\n".join(pref_parts)
283+
pref_string = "\n".join(pref_parts) + pref_instructions
277284

278285
return {"text_mem": [{"memories": text_mem_res}], "pref_string": pref_string}
279286
except Exception as e:

0 commit comments

Comments
 (0)