mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-03 21:02:38 +02:00
fixbug: output_pathname是目录
This commit is contained in:
parent
bd63a7c665
commit
7f3befdf05
7 changed files with 37 additions and 11 deletions
|
|
@ -8,7 +8,7 @@ import json
|
|||
from pathlib import Path
|
||||
|
||||
from metagpt.const import EXAMPLE_DATA_PATH
|
||||
from metagpt.exp_pool import exp_manager
|
||||
from metagpt.exp_pool import get_exp_manager
|
||||
from metagpt.exp_pool.schema import EntryType, Experience, Metric, Score
|
||||
from metagpt.logs import logger
|
||||
from metagpt.utils.common import aread
|
||||
|
|
@ -45,10 +45,10 @@ async def add_exp(req: str, resp: str, tag: str, metric: Metric = None):
|
|||
tag=tag,
|
||||
metric=metric or Metric(score=Score(val=10, reason="Manual")),
|
||||
)
|
||||
|
||||
exp_manager = get_exp_manager()
|
||||
exp_manager.config.exp_pool.enable_write = True
|
||||
exp_manager.create_exp(exp)
|
||||
logger.info(f"New experience created for the request `{req[:10]}`.")
|
||||
logger.info(f"New experience created for the request `{req[:10] if len(req) > 10 else req}`.")
|
||||
|
||||
|
||||
async def add_exps(exps: list, tag: str):
|
||||
|
|
@ -79,7 +79,7 @@ async def add_exps_from_file(tag: str, filepath: Path):
|
|||
|
||||
def query_exps_count():
|
||||
"""Queries and logs the total count of experiences in the pool."""
|
||||
|
||||
exp_manager = get_exp_manager()
|
||||
count = exp_manager.get_exps_count()
|
||||
logger.info(f"Experiences Count: {count}")
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ This script creates a new experience, logs its creation, and then queries for ex
|
|||
|
||||
import asyncio
|
||||
|
||||
from metagpt.exp_pool import exp_manager
|
||||
from metagpt.exp_pool import get_exp_manager
|
||||
from metagpt.exp_pool.schema import EntryType, Experience
|
||||
from metagpt.logs import logger
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ async def main():
|
|||
|
||||
# Add the new experience
|
||||
exp = Experience(req=req, resp=resp, entry_type=EntryType.MANUAL)
|
||||
exp_manager = get_exp_manager()
|
||||
exp_manager.create_exp(exp)
|
||||
logger.info(f"New experience created for the request `{req}`.")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue