mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-14 23:58:11 +08:00
fix function formatter
Former-commit-id: 363a87376ad8fe4149b387f7ccd60f31f2a5fdf7
This commit is contained in:
parent
42a13fec46
commit
9b390c4bea
@ -44,9 +44,9 @@ class FunctionFormatter:
|
||||
def __call__(self, content: str) -> List[Union[str, Dict[str, str]]]:
|
||||
try:
|
||||
function = json.loads(content)
|
||||
name = json.dumps(function["name"], ensure_ascii=False)
|
||||
name = function["name"]
|
||||
arguments = json.dumps(function["arguments"], ensure_ascii=False)
|
||||
except json.JSONDecodeError:
|
||||
except Exception:
|
||||
name, arguments = "", ""
|
||||
|
||||
elements = []
|
||||
@ -98,5 +98,5 @@ class ToolFormatter:
|
||||
|
||||
if self.type == "default":
|
||||
return [self._default(tools)]
|
||||
except json.JSONDecodeError:
|
||||
except Exception:
|
||||
return [""]
|
||||
|
Loading…
x
Reference in New Issue
Block a user