add scorer example

This commit is contained in:
seehi 2024-06-07 18:15:23 +08:00
parent f7514632d9
commit 790ff55981
3 changed files with 27 additions and 2 deletions

View file

@ -0,0 +1,25 @@
import asyncio
from metagpt.exp_pool.scorers import SimpleScorer
from metagpt.logs import logger
def echo(req: str):
"""Echo from req."""
return req
async def simple():
scorer = SimpleScorer()
score = await scorer.evaluate(echo, "data", ("data",))
logger.info(f"The score is: {score}")
async def main():
await simple()
if __name__ == "__main__":
asyncio.run(main())