Commit 9b87f13

mo khan <mo@mokhan.ca>
2026-09-05 04:48:27
fix: forward GGUF reasoning_content as a thinking event
The native shim already parses <think> blocks (GLM, DeepSeek, etc.) into a separate reasoning field -- confirmed correct via direct calls against a GLM GGUF model, including combined with tool-calling. But gguf.rb only logged it at DEBUG, unlike ollama.rb/claude.rb which both forward their equivalent reasoning field as a "thinking" event. The REPL never showed GLM's thinking text because of this, which looked like a parsing bug but was a missing event forward. Claude-Session: https://claude.ai/code/session_01FpbgyAMtPEkDbo2kx78qR6
1 parent 2f4f217
Changed files (1)
lib
elelem
lib/elelem/llama/client.rb
@@ -50,7 +50,9 @@ module Elelem
         if result["tool_calls"].to_a.empty? && !tools.empty? && result["content"].to_s.include?("\"name\"")
           Elelem.logger.debug("gguf: no tool calls parsed, tools offered")
         end
-        Elelem.logger.debug("gguf: reasoning: #{result["reasoning"]}") if result["reasoning"].to_s != ""
+        reasoning = result["reasoning"].to_s
+        Elelem.logger.debug("gguf: reasoning: #{reasoning}") unless reasoning.empty?
+        block&.call(type: "thinking", text: reasoning) unless reasoning.empty?
 
         content = result["content"].to_s
         block&.call(type: "saying", text: content) unless content.empty?