experiment pool init

This commit is contained in:
seehi 2024-06-04 11:33:34 +08:00
parent 808d65b4c3
commit d1198dc58d

View file

@ -9,20 +9,13 @@ from metagpt.logs import logger
async def main():
req = "Simple task."
resp = "Simple echo."
# 1. Find experiences.
exps = await exp_manager.query_exps(req)
if exps:
logger.info(f"Experiences already exist for the request `{req}`: {exps}")
return
# 2. Create a new experience if none exist
exp_manager.create_exp(Experience(req=req, resp="Simple echo.", entry_type=EntryType.MANUAL))
exp_manager.create_exp(Experience(req=req, resp=resp, entry_type=EntryType.MANUAL))
logger.info(f"New experience created for the request `{req}`.")
# 3. Find again
exps = await exp_manager.query_exps(req)
logger.info(f"Updated experiences: {exps}")
logger.info(f"Got experiences: {exps}")
if __name__ == "__main__":