Use thinking models for reasoning
mainModels like deepseek-r1 support a "thinking" mode where they output their reasoning process. Enable this by setting think: true in generate or chat calls. You can access the reasoning via the thinking property on the response.
// Generate with thinking enabled
let response = try await client.generate(
model: "deepseek-r1:8b",
prompt: "What is 17 * 23? Show your work.",
think: true
)
print("Thinking: \(response.thinking ?? "None")")
print("Answer: \(response.response)")