mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-14 15:25:17 +02:00
add scorer example
This commit is contained in:
parent
f7514632d9
commit
790ff55981
3 changed files with 27 additions and 2 deletions
25
examples/exp_pool/scorer.py
Normal file
25
examples/exp_pool/scorer.py
Normal 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())
|
||||
Loading…
Add table
Add a link
Reference in a new issue