mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-06-18 21:28:55 +08:00
[misc] code lint (#10439)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -209,6 +209,7 @@ class DefaultToolUtils(ToolUtils):
|
||||
|
||||
return results
|
||||
|
||||
|
||||
class Gemma4ToolUtils(ToolUtils):
|
||||
r"""Gemma-4 tool using template."""
|
||||
|
||||
@@ -292,7 +293,7 @@ class Gemma4ToolUtils(ToolUtils):
|
||||
flags=re.DOTALL,
|
||||
)
|
||||
# Quote unquoted object keys so the payload can be parsed by json.loads.
|
||||
normalized = re.sub(r'(^|[{\s,])([A-Za-z_][A-Za-z0-9_]*)(\s*:)', r'\1"\2"\3', normalized)
|
||||
normalized = re.sub(r"(^|[{\s,])([A-Za-z_][A-Za-z0-9_]*)(\s*:)", r'\1"\2"\3', normalized)
|
||||
try:
|
||||
return json.loads(normalized)
|
||||
except json.JSONDecodeError:
|
||||
@@ -368,6 +369,7 @@ class Gemma4ToolUtils(ToolUtils):
|
||||
|
||||
return "".join(function_texts)
|
||||
|
||||
|
||||
class GLM4ToolUtils(ToolUtils):
|
||||
r"""GLM-4 tool using template."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user