fix function formatter
This commit is contained in:
parent
ddd48ce8ab
commit
35aef8b287
|
@ -44,9 +44,9 @@ class FunctionFormatter:
|
||||||
def __call__(self, content: str) -> List[Union[str, Dict[str, str]]]:
|
def __call__(self, content: str) -> List[Union[str, Dict[str, str]]]:
|
||||||
try:
|
try:
|
||||||
function = json.loads(content)
|
function = json.loads(content)
|
||||||
name = json.dumps(function["name"], ensure_ascii=False)
|
name = function["name"]
|
||||||
arguments = json.dumps(function["arguments"], ensure_ascii=False)
|
arguments = json.dumps(function["arguments"], ensure_ascii=False)
|
||||||
except json.JSONDecodeError:
|
except Exception:
|
||||||
name, arguments = "", ""
|
name, arguments = "", ""
|
||||||
|
|
||||||
elements = []
|
elements = []
|
||||||
|
@ -98,5 +98,5 @@ class ToolFormatter:
|
||||||
|
|
||||||
if self.type == "default":
|
if self.type == "default":
|
||||||
return [self._default(tools)]
|
return [self._default(tools)]
|
||||||
except json.JSONDecodeError:
|
except Exception:
|
||||||
return [""]
|
return [""]
|
||||||
|
|
Loading…
Reference in New Issue