mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-03 21:02:38 +02:00
feat: merge mgx_ops
This commit is contained in:
commit
547bddd79a
8 changed files with 42 additions and 17 deletions
|
|
@ -46,6 +46,7 @@ async def add_exp(req: str, resp: str, tag: str, metric: Metric = None):
|
|||
metric=metric or Metric(score=Score(val=10, reason="Manual")),
|
||||
)
|
||||
exp_manager = get_exp_manager()
|
||||
exp_manager.config.exp_pool.enabled = True
|
||||
exp_manager.config.exp_pool.enable_write = True
|
||||
exp_manager.create_exp(exp)
|
||||
logger.info(f"New experience created for the request `{req[:10]}`.")
|
||||
|
|
@ -59,8 +60,10 @@ async def add_exps(exps: list, tag: str):
|
|||
tag: A tag for categorizing the experiences.
|
||||
|
||||
"""
|
||||
|
||||
tasks = [add_exp(req=json.dumps(exp["req"]), resp=exp["resp"], tag=tag) for exp in exps]
|
||||
tasks = [
|
||||
add_exp(req=exp["req"] if isinstance(exp["req"], str) else json.dumps(exp["req"]), resp=exp["resp"], tag=tag)
|
||||
for exp in exps
|
||||
]
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ async def main():
|
|||
# Define the simple request and response
|
||||
req = "Simple req"
|
||||
resp = "Simple resp"
|
||||
exp_manager = get_exp_manager()
|
||||
|
||||
# Add the new experience
|
||||
exp = Experience(req=req, resp=resp, entry_type=EntryType.MANUAL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue