Skip to content

Not possible to pass think = FALSE to Ollama models via chat_ollama() #940

Description

@AdaemmerP

I’m using chat_ollama() with a local Ollama model (qwen3.5:4b). Ollama allows to disable reasoning for thinking models using the think = false parameter (CLI flag --think=false). The provided Python code works. However, I haven’t found a way to pass this parameter through chat_ollama() with ellmer.

From looking at the implementation, it seems that:

  • chat_ollama() uses the OpenAI-compatible API (/v1/chat/completions).
  • The chat_params() method for ProviderOllama maps only a limited set of parameters (temperature, top_p, max_tokens, etc.):
method(chat_params, ProviderOllama) <- function(provider, params) {
  standardise_params(
    params,
    c(
      frequency_penalty = "frequency_penalty",
      presence_penalty = "presence_penalty",
      seed = "seed",
      stop = "stop_sequences",
      temperature = "temperature",
      top_p = "top_p",
      top_k = "top_k",
      max_tokens = "max_tokens"
    )
  )
}

I added think = "think" locally to the package and re-installed it, but that did not change anything. I also tried passing the argument via api_args:

chat <- chat_ollama(
  model = "qwen3.5:4b",
  api_args = list(think = FALSE)
)

but this also does not seem to propagate the parameter to the Ollama request.

Is there currently a supported way to pass think = FALSE to Ollama models when using chat_ollama() or is this limitation due to using the OpenAI-compatible endpoint instead of the native Ollama API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions