fully add thinking support to generate()

https://github.com/ollama/ollama-python/pull/521 missed some calls
This commit is contained in:
Devon Rifkin
2025-05-30 13:41:23 -07:00
parent f8c6cd5131
commit e0253ab627
3 changed files with 20 additions and 0 deletions
+3
View File
@@ -65,3 +65,6 @@ Requirement: `pip install tqdm`
### Thinking - Enable thinking mode for a model
- [thinking.py](thinking.py)
### Thinking (generate) - Enable thinking mode for a model
- [thinking-generate.py](thinking-generate.py)
+13
View File
@@ -0,0 +1,13 @@
from ollama import generate
messages = [
{
'role': 'user',
'content': 'What is 10 + 23?',
},
]
response = generate('deepseek-r1', 'why is the sky blue', think=True)
print('Thinking:\n========\n\n' + response.thinking)
print('\nResponse:\n========\n\n' + response.response)