diff --git a/src/llamafactory/data/formatter.py b/src/llamafactory/data/formatter.py index 0e51acae..99a4a8b4 100644 --- a/src/llamafactory/data/formatter.py +++ b/src/llamafactory/data/formatter.py @@ -113,7 +113,7 @@ class FunctionFormatter(Formatter): functions.append((tool_call["name"], json.dumps(tool_call["arguments"], ensure_ascii=False))) except json.JSONDecodeError: - raise RuntimeError("Invalid JSON format in function message: {}".format(content)) + raise RuntimeError("Invalid JSON format in function message: {}".format(str([content]))) # flat string elements = [] for name, arguments in functions: @@ -141,7 +141,7 @@ class ToolFormatter(Formatter): tools = json.loads(content) return [self.tool_utils.tool_formatter(tools) if len(tools) != 0 else ""] except json.JSONDecodeError: - raise RuntimeError("Invalid JSON format in tool description: {}".format(content)) + raise RuntimeError("Invalid JSON format in tool description: {}".format(str([content]))) # flat string @override def extract(self, content: str) -> Union[str, List["FunctionCall"]]: