Skip to content

Commit 46038d6

Browse files
committed
[bugfix] modify glm-4.5 system prompt
1 parent d7d23d4 commit 46038d6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

swift/llm/template/template/glm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class GLM4_5TemplateMeta(GLMTemplateMeta):
7171
prompt: Prompt = field(default_factory=lambda: ['<|user|>\n{{QUERY}}<|assistant|>\n'])
7272
chat_sep: Optional[Prompt] = field(default_factory=list)
7373
suffix: Prompt = field(default_factory=lambda: ['<|user|>'])
74-
system_prefix: Optional[Prompt] = field(default_factory=lambda: ['<|system|>\n{{SYSTEM}}'])
74+
system_prefix: Optional[Prompt] = field(default_factory=lambda: ['[gMASK]<sop><|system|>\n{{SYSTEM}}'])
7575

7676
agent_template: str = 'glm4_5'
7777
stop_words: List[Word] = field(default_factory=lambda: ['<|endoftext|>', '<|user|>', '<|observation|>'])

swift/plugin/agent_template/glm4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def get_toolcall(self, response: str) -> List['Function']:
109109

110110
def _format_tools(self, tools: List[Union[str, dict]], system: str, user_message=None) -> str:
111111
tool_descs = [
112-
'[gMASK]<sop><|system|>\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>'
112+
'# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>'
113113
]
114114
for tool in tools:
115115
tool_descs.append(f'{json.dumps(tool, ensure_ascii=False)}')

0 commit comments

Comments
 (0)