mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-20 15:38:09 +02:00
update ltm unittest
This commit is contained in:
parent
94a0699ec4
commit
6a65639cd7
2 changed files with 25 additions and 11 deletions
|
|
@ -5,6 +5,8 @@
|
|||
@Modified By: mashenquan, 2023/8/20. Remove global configuration `CONFIG`, enable configuration support for business isolation.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from metagpt.actions import UserRequirement
|
||||
from metagpt.config import CONFIG
|
||||
from metagpt.memory.longterm_memory import LongTermMemory
|
||||
|
|
@ -14,11 +16,11 @@ from metagpt.schema import Message
|
|||
|
||||
def test_ltm_search():
|
||||
assert hasattr(CONFIG, "long_term_memory") is True
|
||||
openai_api_key = CONFIG.openai_api_key
|
||||
assert len(openai_api_key) > 20
|
||||
os.environ.setdefault("OPENAI_API_KEY", CONFIG.openai_api_key)
|
||||
assert len(CONFIG.openai_api_key) > 20
|
||||
|
||||
role_id = "UTUserLtm(Product Manager)"
|
||||
rc = RoleContext(watch=[UserRequirement])
|
||||
rc = RoleContext(watch={"metagpt.actions.add_requirement.UserRequirement"})
|
||||
ltm = LongTermMemory()
|
||||
ltm.recover_memory(role_id, rc)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue