-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Description
run below code raise import error
import os
import asyncio
from agentscope.message import Msg
from agentscope.memory import InMemoryMemory, Mem0LongTermMemory
from agentscope.agent import ReActAgent
from agentscope.embedding import DashScopeTextEmbedding
from agentscope.formatter import DashScopeChatFormatter
from agentscope.model import DashScopeChatModel
from agentscope.tool import Toolkit
# 创建 mem0 长期记忆实例
long_term_memory = Mem0LongTermMemory(
agent_name="Friday",
user_name="user_123",
model=DashScopeChatModel(
model_name="qwen-max-latest",
api_key=os.environ.get("DASHSCOPE_API_KEY"),
stream=False,
),
embedding_model=DashScopeTextEmbedding(
model_name="text-embedding-v2",
api_key=os.environ.get("DASHSCOPE_API_KEY"),
),
on_disk=False,
)
# 基本使用示例
async def basic_usage():
"""基本使用示例"""
# 记录记忆
await long_term_memory.record([Msg("user", "我喜欢住民宿", "user")])
# 检索记忆
results = await long_term_memory.retrieve(
[Msg("user", "我的住宿偏好", "user")],
)
print(f"检索结果: {results}")
asyncio.run(basic_usage())
if __name__ == '__main__':
passerror
检索结果: 喜欢住民宿
Exception ignored in: <function QdrantClient.__del__ at 0x00000213D53CDEE0>
Traceback (most recent call last):
File "G:\software\Python\Python312\Lib\site-packages\qdrant_client\qdrant_client.py", line 163, in __del__
File "G:\software\Python\Python312\Lib\site-packages\qdrant_client\qdrant_client.py", line 172, in close
File "G:\software\Python\Python312\Lib\site-packages\qdrant_client\local\qdrant_local.py", line 88, in close
File "G:\software\Python\Python312\Lib\site-packages\portalocker\portalocker.py", line 339, in unlock
File "G:\software\Python\Python312\Lib\site-packages\portalocker\portalocker.py", line 244, in unlock
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function QdrantClient.__del__ at 0x00000213D53CDEE0>
Traceback (most recent call last):
File "G:\software\Python\Python312\Lib\site-packages\qdrant_client\qdrant_client.py", line 163, in __del__
File "G:\software\Python\Python312\Lib\site-packages\qdrant_client\qdrant_client.py", line 172, in close
File "G:\software\Python\Python312\Lib\site-packages\qdrant_client\local\qdrant_local.py", line 88, in close
File "G:\software\Python\Python312\Lib\site-packages\portalocker\portalocker.py", line 339, in unlock
File "G:\software\Python\Python312\Lib\site-packages\portalocker\portalocker.py", line 244, in unlock
ImportError: sys.meta_path is None, Python is likely shutting down
Metadata
Metadata
Assignees
Labels
No labels