Downloads · 30 days
0
lifatsastain/smolagents-glm-fix
smolagents-glm-fix is a machine learning model from lifatsastain. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Patches smolagents to strip </code artifacts that GLM models append to code blocks, causing SyntaxError at every agent step.
Downloads · 30 days
0
Access
Public
Updated Mar 1, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 42%
From the Hugging Face model README
Patches smolagents to strip </code artifacts that GLM models append to code blocks, causing SyntaxError at every agent step.
GLM models (glm-4-flash, glm-4.7-flash, etc.) output malformed closing tags like:
</code</code</code>
The non-greedy regex in smolagents captures </code</code inside the extracted code, breaking execution.
from huggingface_hub import hf_hub_download
exec(open(hf_hub_download("lifatsastain/smolagents-glm-fix", "glm_fix.py")).read())
apply()
Apply before creating any CodeAgent:
from huggingface_hub import hf_hub_download
exec(open(hf_hub_download("lifatsastain/smolagents-glm-fix", "glm_fix.py")).read())
apply()
from smolagents import CodeAgent, OpenAIServerModel
agent = CodeAgent(model=OpenAIServerModel("glm-4.7-flash", ...), tools=[...])