diff --git a/NEWS.org b/NEWS.org index 21a6795..d5b5c10 100644 --- a/NEWS.org +++ b/NEWS.org @@ -2,6 +2,7 @@ - Removed bad interactions made in Ollama tool calls - Fixed Ollama tool calling requests - Fixed Ollama reasoning, whose API has changed +- Added gpt-oss, supported low/medium/high reasoning with Ollama - Run tools in the original buffer * Version 0.28.3 - Fixed breakage in Ollama streaming tool calling diff --git a/llm-models.el b/llm-models.el index 5c999f9..c1bcb2b 100644 --- a/llm-models.el +++ b/llm-models.el @@ -377,7 +377,12 @@ REGEX is a regular expression that can be used to identify the model, uniquely ( :name "BGE-M3" :symbol 'bge-m3 :capabilities '(embedding free-software) ;; MIT license :context-length 8192 - :regex "bge-m3"))) + :regex "bge-m3") + (make-llm-model + :name "gpt-oss" :symbol 'gpt-oss + :capabilities '(generation free-software reasoning tool-use) ; Apache license + :context-length 128000 + :regex "gpt-oss"))) (defun llm-models-by-symbol (symbol) "Return the model with SYMBOL." diff --git a/llm-ollama.el b/llm-ollama.el index 54768da..3e90099 100644 --- a/llm-ollama.el +++ b/llm-ollama.el @@ -188,11 +188,19 @@ PROVIDER is the llm-ollama provider." (llm-ollama--response-format (llm-chat-prompt-response-format prompt))))) (setq request-plist (plist-put request-plist :stream (if streaming t :false))) - (when (llm-chat-prompt-reasoning prompt) - (setq request-plist (plist-put request-plist :think - (if (eq 'none (llm-chat-prompt-reasoning prompt)) - :false - 't)))) + (let ((model (llm-models-match (llm-ollama-chat-model provider)))) + (when (and (llm-chat-prompt-reasoning prompt) + (member 'reasoning (llm-model-capabilities model)) + (not (eq 'none (llm-chat-prompt-reasoning prompt)))) + (setq request-plist (plist-put request-plist :think + (if (eq 'gpt-oss model) + (pcase (llm-chat-prompt-reasoning prompt) + ('light "low") + ('medium "medium") + ('maximum "high")) + (if (eq 'none (llm-chat-prompt-reasoning prompt)) + :false + 't)))))) (when (llm-chat-prompt-temperature prompt) (setq options (plist-put options :temperature (llm-chat-prompt-temperature prompt)))) (when (llm-chat-prompt-max-tokens prompt)