YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
smolagents GLM Fix
Patches smolagents to strip </code artifacts that GLM models append to code blocks, causing SyntaxError at every agent step.
The problem
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.
Usage
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=[...])
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support