Skip to content

Commit 9f308ea

Browse files
committed
[model] support glm-4.5 agent
1 parent 95fa35c commit 9f308ea

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

swift/llm/template/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,6 @@ def _swift_encode(self, inputs: StdTemplateInputs):
11371137
# the current response
11381138
string_stop_words = tuple(s for s in template_meta.stop_words if isinstance(s, str))
11391139
if self.is_training and not sep_token and not response.endswith(string_stop_words) or self.task_type == 'embedding':
1140-
# if self.is_training and not sep_token or self.task_type == 'embedding':
11411140
extra_context_list = template_meta.suffix
11421141
extra_context_type = ContextType.SUFFIX
11431142
elif template_meta.response_prefix:

swift/plugin/agent_template/glm4.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def _find_function_call(single_content: str) -> Optional['Function']:
2222
matches = pattern.findall(single_content)
2323
if not matches:
2424
return
25-
2625
name, arguments = matches[0]
2726
return Function(name=name, arguments=arguments)
2827

@@ -88,15 +87,13 @@ def _find_function_call(single_content: str) -> Optional['Function']:
8887
func_name_match = re.match(r'^([^\n<]+)', single_content)
8988
if not func_name_match:
9089
return None
91-
9290
func_name = func_name_match.group(1).strip()
9391
arg_key_pattern = re.compile(r'<arg_key>(.*?)</arg_key>', re.DOTALL)
9492
arg_value_pattern = re.compile(r'<arg_value>(.*?)</arg_value>', re.DOTALL)
9593
keys = arg_key_pattern.findall(single_content)
9694
values = arg_value_pattern.findall(single_content)
9795
if len(keys) != len(values):
9896
return None
99-
10097
args = {k.strip(): v.strip() for k, v in zip(keys, values)}
10198
return Function(name=func_name, arguments=json.dumps(args, ensure_ascii=False))
10299

0 commit comments

Comments
 (0)