From 0214e8fe996c36c793d9426a37ac1d40fa8d0bb8 Mon Sep 17 00:00:00 2001 From: "jinli.yl" Date: Fri, 19 Jul 2024 20:39:30 +0800 Subject: [PATCH] add en unit test & modify en has time logic --- .../worker/frontend/extract_time_worker.py | 4 +- .../summary/long_contra_repeat_worker.py | 1 + .../worker/summary/update_insight_worker.py | 13 +- .../worker/summary/update_insight_worker.yaml | 16 +- .../worker/write/get_observation_worker.py | 2 + .../memory/worker/write/info_filter_worker.py | 2 +- memory_scope/utils/datetime_handler.py | 33 +++- tests/worker/test_workers_cn.py | 2 +- tests/worker/test_workers_en.py | 161 ++++++++++-------- 9 files changed, 151 insertions(+), 83 deletions(-) diff --git a/memory_scope/memory/worker/frontend/extract_time_worker.py b/memory_scope/memory/worker/frontend/extract_time_worker.py index 76189925..44eba917 100644 --- a/memory_scope/memory/worker/frontend/extract_time_worker.py +++ b/memory_scope/memory/worker/frontend/extract_time_worker.py @@ -15,7 +15,7 @@ class ExtractTimeWorker(MemoryBaseWorker): and storing this extracted data within a shared context. """ - EXTRACT_TIME_PATTERN = r'-\s*(\S+):(\d+)' + EXTRACT_TIME_PATTERN = r"-\s*(\S+)[::]\s*(\S+)" FILE_PATH: str = __file__ def _parse_params(self, **kwargs): @@ -61,5 +61,5 @@ class ExtractTimeWorker(MemoryBaseWorker): for key, value in matches: if key in key_map.keys(): extract_time_dict[key_map[key]] = value - self.logger.info(f"response_text={response_text} filters={extract_time_dict}") + self.logger.info(f"response_text={response_text} matches={matches} filters={extract_time_dict}") self.set_context(EXTRACT_TIME_DICT, extract_time_dict) diff --git a/memory_scope/memory/worker/summary/long_contra_repeat_worker.py b/memory_scope/memory/worker/summary/long_contra_repeat_worker.py index ba7a2918..9f264552 100644 --- a/memory_scope/memory/worker/summary/long_contra_repeat_worker.py +++ b/memory_scope/memory/worker/summary/long_contra_repeat_worker.py @@ -1,3 +1,4 @@ +import time from typing import List, Dict from memory_scope.constants.common_constants import NOT_UPDATED_NODES, MERGE_OBS_NODES diff --git a/memory_scope/memory/worker/summary/update_insight_worker.py b/memory_scope/memory/worker/summary/update_insight_worker.py index 308cd364..0c4a5cde 100644 --- a/memory_scope/memory/worker/summary/update_insight_worker.py +++ b/memory_scope/memory/worker/summary/update_insight_worker.py @@ -1,3 +1,4 @@ +import time from typing import List from memory_scope.constants.common_constants import INSIGHT_NODES, NOT_UPDATED_NODES, NOT_REFLECTED_NODES @@ -48,8 +49,14 @@ class UpdateInsightWorker(MemoryBaseWorker): self.logger.warning(f"insight_key={insight_node.key} is empty!") return insight_node, filtered_nodes, max_score + if not obs_nodes: + self.logger.warning("obs_nodes is empty!") + return insight_node, filtered_nodes, max_score + # Call the ranking model to get scores for each observed node's content against the insight key - response = self.rank_model.call(query=insight_node.key, documents=[x.content for x in obs_nodes]) + documents = [x.content for x in obs_nodes] + self.logger.debug(f"update.insight.rank key={insight_node.key} \n docs={'|'.join(documents)}") + response = self.rank_model.call(query=insight_node.key, documents=documents) if not response.status: return insight_node, filtered_nodes, max_score @@ -75,7 +82,7 @@ class UpdateInsightWorker(MemoryBaseWorker): def update_insight_node(self, insight_node: MemoryNode, insight_value: str): dt_handler = DatetimeHandler() key = self.prompt_handler.insight_string_format.format(name=self.target_name, key=insight_node.key) - content = f"{key}{self.get_language_value(COLON_WORD)}{insight_value}" + content = f"{key}{self.get_language_value(COLON_WORD)} {insight_value}" insight_node.content = content insight_node.value = insight_value insight_node.meta_data.update({k: str(v) for k, v in dt_handler.dt_info_dict.items()}) @@ -166,6 +173,7 @@ class UpdateInsightWorker(MemoryBaseWorker): # Process active insight nodes with corresponding not updated nodes for node in insight_nodes: + time.sleep(1) if node.action_status == ActionStatusEnum.NEW.value: self.submit_thread_task(fn=self.filter_obs_nodes, insight_node=node, @@ -186,6 +194,7 @@ class UpdateInsightWorker(MemoryBaseWorker): # Submit tasks to update insights for the top nodes for insight_node, filtered_nodes, _ in result_sorted: + time.sleep(1) self.submit_thread_task(fn=self.update_insight, insight_node=insight_node, filtered_nodes=filtered_nodes) # Gather the final results from all update tasks diff --git a/memory_scope/memory/worker/summary/update_insight_worker.yaml b/memory_scope/memory/worker/summary/update_insight_worker.yaml index 489afe12..8ecc1830 100644 --- a/memory_scope/memory/worker/summary/update_insight_worker.yaml +++ b/memory_scope/memory/worker/summary/update_insight_worker.yaml @@ -1,14 +1,16 @@ update_insight_system: cn: | - 从下面的句子中提取出给定类别的{user_name}的资料信息,并判断与已有信息是否矛盾,若矛盾以新信息为准。整合已有信息和新信息并输出。 - 请一步步思考,并按如下格式输出: + 从下面的句子中提取出给定类别的{user_name}的资料信息,并判断与已有信息是否矛盾,若矛盾以新信息为准整合已有信息和新信息并输出。若不需要更改,则回答“无”。 + 其中矛盾的形式可以有很多种,可以是逻辑上的矛盾,可以是属性上的变化导致的矛盾,比如不能同时在两个地方工作,同一个时刻不能在两个地点,同一个时刻不能干两件事情等等。 + 请一步步思考,并按如下格式输出, 其中信息一定加<>: 思考: 思考的依据和过程,150字以内。 - {user_name}的资料: <信息>, 一定加<> + {user_name}的资料: <信息> en: | - Extract profile information of {user_name} from the sentences below according to the given category and determine whether it contradicts existing information. If there is a contradiction, the new information should take precedence. Integrate the existing information with the new information and output it. - Please think step-by-step and output in the following format: - Thought: The basis and process of thinking, within 150 words. - {user_name}'s profile: , make sure to enclose it in <>" + Extract the given category of {user_name}'s profile information from the following sentences and determine if it contradicts the existing information. If there is a contradiction, integrate the existing information and the new information, prioritizing the new information, and output the result. If no changes are needed, respond with 'None'. + The contradictions can come in many forms, such as logical contradictions or changes in attributes leading to contradictions, for example, not being able to work in two places simultaneously, being unable to be in two locations at the same time, or being unable to perform two tasks at the same time, etc. + Think step by step, and output in the following format, with information enclosed in <>: + Thoughts: The basis and process of your thinking, within 150 words. + {user_name}'s profile: update_insight_few_shot: diff --git a/memory_scope/memory/worker/write/get_observation_worker.py b/memory_scope/memory/worker/write/get_observation_worker.py index 25aeb19c..e3106d04 100644 --- a/memory_scope/memory/worker/write/get_observation_worker.py +++ b/memory_scope/memory/worker/write/get_observation_worker.py @@ -49,6 +49,8 @@ class GetObservationWorker(MemoryBaseWorker): for msg in self.chat_messages: if not DatetimeHandler.has_time_word(query=msg.content): filter_messages.append(msg) + + self.logger.info(f"after filter_messages.size from {len(self.chat_messages)} to {len(filter_messages)}") return filter_messages def build_message(self, filter_messages: List[Message]) -> List[Message]: diff --git a/memory_scope/memory/worker/write/info_filter_worker.py b/memory_scope/memory/worker/write/info_filter_worker.py index 751c7edb..034e5518 100644 --- a/memory_scope/memory/worker/write/info_filter_worker.py +++ b/memory_scope/memory/worker/write/info_filter_worker.py @@ -58,7 +58,7 @@ class InfoFilterWorker(MemoryBaseWorker): # generate prompt user_query_list = [] for i, msg in enumerate(info_messages): - user_query_list.append(f"{i + 1} {self.target_name}{self.get_language_value(COLON_WORD)}{msg.content}") + user_query_list.append(f"{i + 1} {self.target_name}{self.get_language_value(COLON_WORD)} {msg.content}") self.logger.warning(self.prompt_handler.prompt_dict) system_prompt = self.prompt_handler.info_filter_system.format(batch_size=len(info_messages), user_name=self.target_name) diff --git a/memory_scope/utils/datetime_handler.py b/memory_scope/utils/datetime_handler.py index d596d27e..d386a0a5 100644 --- a/memory_scope/utils/datetime_handler.py +++ b/memory_scope/utils/datetime_handler.py @@ -228,9 +228,9 @@ class DatetimeHandler(object): return getattr(cls, func_name)(input_string=input_string) @classmethod - def has_time_word(cls, query: str) -> bool: + def has_time_word_cn(cls, query: str) -> bool: """ - Check if the input query contains any datetime-related words based on the current language context. + Check if the input query contains any datetime-related words based on the cn language context. Args: query (str): The input string to check for datetime words. @@ -246,6 +246,35 @@ class DatetimeHandler(object): break return contain_datetime + @classmethod + def has_time_word_en(cls, query: str) -> bool: + """ + Check if the input query contains any datetime-related words based on the en language context. + + Args: + query (str): The input string to check for datetime words. + + Returns: + bool: True if the query contains at least one datetime word, False otherwise. + """ + contain_datetime = False + for datetime_word in DATATIME_WORD_LIST[G_CONTEXT.language]: + datetime_word = datetime_word.lower() + # TODO fix strip + if datetime_word in [x.strip().lower().strip(",").strip(".").strip("?").strip(":") + for x in query.split(" ")]: + contain_datetime = True + break + return contain_datetime + + @classmethod + def has_time_word(cls, query: str) -> bool: + func_name = f"has_time_word_{G_CONTEXT.language.value}" + if not hasattr(cls, func_name): + cls.logger.warning(f"language={G_CONTEXT.language.value} needs to complete has_time_word func!") + return False + return getattr(cls, func_name)(query=query) + def datetime_format(self, dt_format: str = "%Y%m%d") -> str: """ Format the stored datetime object into a string based on the provided format. diff --git a/tests/worker/test_workers_cn.py b/tests/worker/test_workers_cn.py index 6bccf649..28843299 100644 --- a/tests/worker/test_workers_cn.py +++ b/tests/worker/test_workers_cn.py @@ -206,7 +206,7 @@ class TestWorkersCn(unittest.TestCase): result = "\n".join(result) worker.logger.info(f"result={result}") - # @unittest.skip + @unittest.skip def test_contra_repeat(self): name = "contra_repeat" diff --git a/tests/worker/test_workers_en.py b/tests/worker/test_workers_en.py index fa3e9d6a..7d7fd14b 100644 --- a/tests/worker/test_workers_en.py +++ b/tests/worker/test_workers_en.py @@ -8,8 +8,8 @@ from memory_scope.enumeration.message_role_enum import MessageRoleEnum from memory_scope.memory.worker.memory_base_worker import MemoryBaseWorker from memory_scope.scheme.memory_node import MemoryNode from memory_scope.scheme.message import Message -from memory_scope.utils import Logger from memory_scope.utils.global_context import G_CONTEXT +from memory_scope.utils.logger import Logger from memory_scope.utils.tool_functions import init_instance_by_config @@ -40,7 +40,7 @@ class TestWorkersEn(unittest.TestCase): context_lock=None, thread_pool=G_CONTEXT.thread_pool) - query = "明天我去上海出差" + query = "I will be on a business trip to Shanghai tomorrow." query_timestamp = int(datetime.datetime.now().timestamp()) worker.set_context(QUERY_WITH_TS, (query, query_timestamp)) worker.run() @@ -62,9 +62,10 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) chat_messages = [ - Message(role=MessageRoleEnum.USER.value, content="我爱吃川菜"), - Message(role=MessageRoleEnum.USER.value, content="我不喜欢吃苹果"), - Message(role=MessageRoleEnum.USER.value, content="明天我要去高考"), + Message(role=MessageRoleEnum.USER.value, content="I love to eat Sichuan cuisine."), + Message(role=MessageRoleEnum.USER.value, content="I don't like eating apples."), + Message(role=MessageRoleEnum.USER.value, + content="I'm going to take the college entrance examination tomorrow."), ] worker.set_context(CHAT_MESSAGES, chat_messages) @@ -88,19 +89,32 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) chat_messages = [ - Message(role=MessageRoleEnum.USER.value, content="你知道北京哪里的海鲜最新鲜吗"), - Message(role=MessageRoleEnum.USER.value, content="有没有推荐的策略游戏?最近想找新的挑战。"), - Message(role=MessageRoleEnum.USER.value, content="听说篮球运动对身体很好,是真的吗?"), - Message(role=MessageRoleEnum.USER.value, content="最近在北京的工作压力太大,有什么放松的建议吗?"), - Message(role=MessageRoleEnum.USER.value, content="说到朋友,我确实有几位很要好的朋友,我们经常一起出去吃饭。"), - Message(role=MessageRoleEnum.USER.value, content="对了,最近想换工作,你觉得北京的哪个区工作机会更多?"), - Message(role=MessageRoleEnum.USER.value, content="听你这么说,我感觉挺有信心的,谢了!"), - Message(role=MessageRoleEnum.USER.value, content="我很喜欢尝试新的美食,有没有推荐的美食应用?"), - Message(role=MessageRoleEnum.USER.value, content="我有时也喜欢自己在家做饭,你有没有好的海鲜菜谱推荐?"), - Message(role=MessageRoleEnum.USER.value, content="听说打篮球可以长高,这是真的吗?"), - Message(role=MessageRoleEnum.USER.value, content="我在北京阿里云园区工作"), - Message(role=MessageRoleEnum.USER.value, content="我是阿里云百炼的工程师"), - Message(role=MessageRoleEnum.USER.value, content="最后一个问题,你知道怎么才能维持广泛的社交关系吗?"), + Message(role=MessageRoleEnum.USER.value, content="Do you know where the freshest seafood is in Beijing?"), + Message(role=MessageRoleEnum.USER.value, + content="Are there any strategy games you would recommend? I'm looking for a new challenge."), + Message(role=MessageRoleEnum.USER.value, + content="I heard that basketball is good for your health, is that true?"), + Message(role=MessageRoleEnum.USER.value, + content="I’ve been under a lot of work pressure in Beijing lately. Do you have any " + "suggestions for relaxing?"), + Message(role=MessageRoleEnum.USER.value, + content="Speaking of friends, I do have a few very good friends and we often go out " + "to eat together."), + Message(role=MessageRoleEnum.USER.value, + content="By the way, I want to change jobs recently. Which district in Beijing do you think " + "has more job opportunities?"), + Message(role=MessageRoleEnum.USER.value, content="Hearing you say that, I feel more confident. Thank you!"), + Message(role=MessageRoleEnum.USER.value, + content="I love trying new food, are there any food apps you would recommend?"), + Message(role=MessageRoleEnum.USER.value, + content="I also like to cook at home sometimes. Do you have any good seafood recipes to " + "recommend?"), + Message(role=MessageRoleEnum.USER.value, + content="I heard that playing basketball can help you grow taller, is this true?"), + Message(role=MessageRoleEnum.USER.value, content="I work at Alibaba Cloud in Beijing"), + Message(role=MessageRoleEnum.USER.value, content="I am an engineer at Alibaba Cloud Bailian"), + Message(role=MessageRoleEnum.USER.value, + content="Last question, do you know how to maintain extensive social relationships?"), ] worker.set_context(CHAT_MESSAGES, chat_messages) @@ -123,20 +137,16 @@ class TestWorkersEn(unittest.TestCase): context_lock=None, thread_pool=G_CONTEXT.thread_pool) + # FIXME Does the appearance of 'am' indicate the presence of a time keyword? chat_messages = [ - Message(role=MessageRoleEnum.USER.value, content="我爱吃川菜"), - Message(role=MessageRoleEnum.USER.value, content="我不喜欢吃苹果"), - Message(role=MessageRoleEnum.USER.value, content="我准备去高考"), - Message(role=MessageRoleEnum.USER.value, content="我不喜欢吃西瓜"), - Message(role=MessageRoleEnum.USER.value, content="我不爱吃西瓜"), - Message(role=MessageRoleEnum.USER.value, content="我在一家叫京东的公司干活"), + Message(role=MessageRoleEnum.USER.value, content="I love Sichuan cuisine"), + Message(role=MessageRoleEnum.USER.value, content="I don't like eating apples"), + Message(role=MessageRoleEnum.USER.value, content="I am preparing for the college entrance examination"), + Message(role=MessageRoleEnum.USER.value, content="I don't like eating watermelon"), + Message(role=MessageRoleEnum.USER.value, content="I don't like watermelon"), + Message(role=MessageRoleEnum.USER.value, content="I work for a company called JD.com"), ] - # chat_messages = [ - # Message(role=MessageRoleEnum.USER.value, content="我不喜欢吃西瓜"), - # Message(role=MessageRoleEnum.USER.value, content="我在一家叫京东的公司干活"), - # ] - worker.set_context(CHAT_MESSAGES, chat_messages) worker.run() @@ -158,15 +168,26 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) chat_messages = [ - Message(role=MessageRoleEnum.USER.value, content="有没有推荐的策略游戏?最近想找新的挑战。"), - Message(role=MessageRoleEnum.USER.value, content="最近在北京的工作压力太大,有什么放松的建议吗?"), - Message(role=MessageRoleEnum.USER.value, content="说到朋友,我确实有几位很要好的朋友,我们经常一起出去吃饭。"), - Message(role=MessageRoleEnum.USER.value, content="对了,最近想换工作,你觉得北京的哪个区工作机会更多?"), - Message(role=MessageRoleEnum.USER.value, content="我很喜欢尝试新的美食,有没有推荐的美食应用?"), - Message(role=MessageRoleEnum.USER.value, content="我有时也喜欢自己在家做饭,你有没有好的海鲜菜谱推荐?"), - Message(role=MessageRoleEnum.USER.value, content="我在北京阿里云园区工作"), - Message(role=MessageRoleEnum.USER.value, content="我是阿里云百炼的工程师"), - Message(role=MessageRoleEnum.USER.value, content="最后一个问题,你知道怎么才能维持广泛的社交关系吗?"), + Message(role=MessageRoleEnum.USER.value, + content="Are there any strategy games you would recommend? I'm looking for a new challenge."), + Message(role=MessageRoleEnum.USER.value, + content="I’ve been under a lot of work pressure in Beijing lately. Do you have any suggestions " + "for relaxing?"), + Message(role=MessageRoleEnum.USER.value, + content="Speaking of friends, I do have a few very good friends and we often go out to " + "eat together."), + Message(role=MessageRoleEnum.USER.value, + content="By the way, I want to change jobs recently. Which district in Beijing do you think has " + "more job opportunities?"), + Message(role=MessageRoleEnum.USER.value, + content="I love trying new food, are there any food apps you would recommend?"), + Message(role=MessageRoleEnum.USER.value, + content="I also like to cook at home sometimes. Do you have any good seafood recipes to " + "recommend?"), + Message(role=MessageRoleEnum.USER.value, content="I work at Alibaba Cloud in Beijing"), + Message(role=MessageRoleEnum.USER.value, content="I am an engineer at Alibaba Cloud Bailian"), + Message(role=MessageRoleEnum.USER.value, + content="Last question, do you know how to maintain extensive social relationships?"), ] worker.set_context(CHAT_MESSAGES, chat_messages) @@ -190,13 +211,16 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) chat_messages = [ - Message(role=MessageRoleEnum.USER.value, content="去年我们一起合作了因果推断技术"), - Message(role=MessageRoleEnum.USER.value, content="上个月我去了杭州旅游"), - Message(role=MessageRoleEnum.USER.value, content="下周我要去高考"), - Message(role=MessageRoleEnum.USER.value, content="明天我去北京出差"), - Message(role=MessageRoleEnum.USER.value, content="前天我把苹果扔掉了"), - Message(role=MessageRoleEnum.USER.value, content="前天我把苹果扔掉了,我不喜欢吃"), - Message(role=MessageRoleEnum.USER.value, content="明天是我生日"), + Message(role=MessageRoleEnum.USER.value, + content="Last year we worked together on causal inference technology."), + Message(role=MessageRoleEnum.USER.value, content="Last month I went to Hangzhou for a trip."), + Message(role=MessageRoleEnum.USER.value, + content="I'm going to take the college entrance examination next week."), + Message(role=MessageRoleEnum.USER.value, content="I'm going to Beijing on a business trip tomorrow."), + Message(role=MessageRoleEnum.USER.value, content="I threw away the apple the day before yesterday."), + Message(role=MessageRoleEnum.USER.value, + content="The day before yesterday I threw away the apple. I don't like eating it."), + Message(role=MessageRoleEnum.USER.value, content="Tomorrow is my birthday."), ] worker.set_context(CHAT_MESSAGES, chat_messages) @@ -220,8 +244,8 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) nodes = [ - MemoryNode(user_name="AI", target_name="用户", content="用户在美团干活"), - MemoryNode(user_name="AI", target_name="用户", content="用户在阿里巴巴工作"), + MemoryNode(user_name="AI", target_name="用户", content="User is working in Meituan"), + MemoryNode(user_name="AI", target_name="用户", content="User works at Alibaba"), ] worker.memory_handler.set_memories(NEW_OBS_NODES, nodes) @@ -230,8 +254,8 @@ class TestWorkersEn(unittest.TestCase): for node in worker.memory_handler.get_memories(MERGE_OBS_NODES)]) nodes = [ - MemoryNode(user_name="AI", target_name="用户", content="用户在京东工作"), - MemoryNode(user_name="AI", target_name="用户", content="用户在美团干活"), + MemoryNode(user_name="AI", target_name="用户", content="User works at JD.com"), + MemoryNode(user_name="AI", target_name="用户", content="Users working in Meituan"), ] worker.memory_handler.set_memories(NEW_OBS_NODES, nodes) @@ -240,8 +264,8 @@ class TestWorkersEn(unittest.TestCase): for node in worker.memory_handler.get_memories(MERGE_OBS_NODES)]) nodes = [ - MemoryNode(user_name="AI", target_name="用户", content="用户在京东工作"), - MemoryNode(user_name="AI", target_name="用户", content="用户在美团干活"), + MemoryNode(user_name="AI", target_name="用户", content="User works at JD.com"), + MemoryNode(user_name="AI", target_name="用户", content="User is working in Meituan"), ] worker.memory_handler.set_memories(NEW_OBS_NODES, nodes) @@ -250,9 +274,9 @@ class TestWorkersEn(unittest.TestCase): for node in worker.memory_handler.get_memories(MERGE_OBS_NODES)]) nodes = [ - MemoryNode(user_name="AI", target_name="用户", content="我喜欢吃西瓜"), - MemoryNode(user_name="AI", target_name="用户", content="用户在阿里巴巴干活"), - MemoryNode(user_name="AI", target_name="用户", content="我不爱吃西瓜"), + MemoryNode(user_name="AI", target_name="用户", content="I like to eat watermelon"), + MemoryNode(user_name="AI", target_name="用户", content="User is working in Alibaba"), + MemoryNode(user_name="AI", target_name="用户", content="I don't like watermelon"), ] worker.memory_handler.set_memories(NEW_OBS_NODES, nodes) @@ -279,16 +303,17 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) nodes = [ - MemoryNode(content="用户对策略游戏感兴趣,寻找新挑战。"), - MemoryNode(content="用户在北京工作,感到压力大,寻求放松方式。"), - MemoryNode(content="用户有要好朋友,常一起外出就餐。"), - MemoryNode(content="用户打算换工作,关心北京的工作机会分布。"), - MemoryNode(content="用户喜爱尝试新美食,求美食应用推荐。"), - MemoryNode(content="用户喜欢在家做饭,寻求海鲜菜谱。"), - MemoryNode(content="用户在北京阿里云园区工作。"), - MemoryNode(content="用户是阿里云百炼的工程师。"), - MemoryNode(content="用户目前的工作是大语言模型的应用开发"), - MemoryNode(content="用户想知道维持广泛社交关系的方法。"), + MemoryNode(content="Users are interested in strategy games and looking for new challenges."), + MemoryNode(content="The user works in Beijing, feels stressed, and is looking for ways to relax."), + MemoryNode(content="The user has good friends and often goes out to eat together."), + MemoryNode(content="The user is planning to change jobs and is concerned about the distribution of job " + "opportunities in Beijing."), + MemoryNode(content="Users love to try new food and ask for food app recommendations."), + MemoryNode(content="Users love to cook at home and seek seafood recipes."), + MemoryNode(content="The user works in the Alibaba Cloud campus in Beijing."), + MemoryNode(content="The user is an engineer at Alibaba Cloud Bailian."), + MemoryNode(content="The user's current job is application development of large language models"), + MemoryNode(content="Users want to know how to maintain extensive social relationships."), ] worker.memory_handler.set_memories(NOT_REFLECTED_NODES, nodes) @@ -316,7 +341,7 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) nodes = [ - MemoryNode(content="用户喜欢打王者荣耀"), + MemoryNode(content="Users like to play King of Glory"), ] worker.memory_handler.set_memories(NOT_UPDATED_NODES, nodes) worker.run() @@ -339,9 +364,9 @@ class TestWorkersEn(unittest.TestCase): thread_pool=G_CONTEXT.thread_pool) nodes = [ - MemoryNode(content="用户对策略游戏感兴趣,寻找新挑战。"), - MemoryNode(content="用户在北京工作,感到压力大,寻求放松方式。"), - MemoryNode(content="用户在上海工作。"), + MemoryNode(content="Users are interested in strategy games and looking for new challenges."), + MemoryNode(content="The user works in Beijing, feels stressed, and is looking for ways to relax."), + MemoryNode(content="User works in Shanghai."), ] worker.memory_handler.set_memories(NOT_UPDATED_NODES, nodes) worker.unit_test_flag = True