Merge branch 'feature-tool' into 'mgx_ops'

rm tool schema storage

See merge request pub/MetaGPT!278
This commit is contained in:
林义章 2024-08-06 03:05:36 +00:00
commit 5f86247c0d

View file

@ -12,7 +12,6 @@ import os
from collections import defaultdict
from pathlib import Path
import yaml
from pydantic import BaseModel
from metagpt.const import TOOL_SCHEMA_PATH
@ -117,11 +116,8 @@ def register_tool(tags: list[str] = None, schema_path: str = "", **kwargs):
def make_schema(tool_source_object, include, path):
os.makedirs(os.path.dirname(path), exist_ok=True) # Create the necessary directories
try:
schema = convert_code_to_tool_schema(tool_source_object, include=include)
with open(path, "w", encoding="utf-8") as f:
yaml.dump(schema, f, sort_keys=False)
except Exception as e:
schema = {}
logger.error(f"Fail to make schema: {e}")