Skip to content

Commit 785c96d

Browse files
author
yuan.wang
committed
modify code
1 parent 7e485bf commit 785c96d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

evaluation/scripts/utils/client.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,10 @@ def search(self, query, user_id, top_k):
247247
assert json.loads(response.text)["message"] == "ok", response.text
248248
text_mem_res = json.loads(response.text)["data"]["memory_detail_list"]
249249
pref_mem_res = json.loads(response.text)["data"]["preference_detail_list"]
250+
preference_note = json.loads(response.text)["data"]["preference_note"]
250251
for i in text_mem_res:
251252
i.update({"memory": i.pop("memory_value")})
252253

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-
260254
explicit_prefs = [
261255
p["preference"]
262256
for p in pref_mem_res
@@ -280,7 +274,7 @@ def search(self, query, user_id, top_k):
280274
+ "\n".join(f"{i + 1}. {p}" for i, p in enumerate(implicit_prefs))
281275
)
282276

283-
pref_string = "\n".join(pref_parts) + pref_instructions
277+
pref_string = "\n".join(pref_parts) + preference_note
284278

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

0 commit comments

Comments
 (0)