MCPcopy Create free account
hub / github.com/modelscope/ms-agent / main

Method main

tests/memory/test_default_memory.py:78–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 import asyncio
77
78 async def main():
79 random_id = str(uuid.uuid4())
80 default_memory = OmegaConf.create({
81 'memory': [{
82 'path': f'output/{random_id}',
83 'user_id': random_id
84 }]
85 })
86 agent1 = AgentLoader.build(
87 'ms-agent/simple_agent_code',
88 config=default_memory,
89 trust_remote_code=True)
90 if hasattr(agent1.config.callbacks, 'input_callback'):
91 agent1.config.callbacks.remove('input_callback') # noqa
92 await agent1.run(
93 'I am a vegetarian and I drink coffee every morning.')
94 del agent1
95 print(
96 '========== Data preparation completed, starting test ==========='
97 )
98 agent2 = AgentLoader.build(
99 'ms-agent/simple_agent_code',
100 config=default_memory,
101 trust_remote_code=True)
102 if hasattr(agent2.config.callbacks, 'input_callback'):
103 agent2.config.callbacks.remove('input_callback') # noqa
104 res = await agent2.run(
105 'Please help me plan tomorrow’s three meals.')
106 print(res)
107 assert ('vegetarian' in res[-1].content.lower()
108 or 'vegan' in res[-1].content.lower()
109 ) and 'coffee' in res[-1].content.lower()
110
111 asyncio.run(main())
112

Callers 1

Calls 4

MessageClass · 0.90
ToolCallClass · 0.90
buildMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected