Compare commits

..

6 Commits

Author SHA1 Message Date
Bruce MacDonald fdba575aeb fix formatting 2025-06-04 11:51:39 -07:00
Bruce MacDonald 3615139ea0 types: add capabilities to list response 2025-06-04 11:44:11 -07:00
Devon Rifkin 63ca747622 Merge pull request #525 from hwittenborn/main
test / test (push) Has been cancelled
test / lint (push) Has been cancelled
Remove unused `messages` variable from `thinking-generate` example
2025-05-30 16:14:02 -07:00
Hunter Wittenborn 4c11d507b0 Remove unused messages variable from thinking-generate example 2025-05-30 16:58:16 -05:00
Devon Rifkin ce6846e4fc Merge pull request #524 from ollama/drifkin/thinking-support
test / test (push) Waiting to run
test / lint (push) Waiting to run
fully add thinking support to `generate()`
2025-05-30 14:32:05 -07:00
Devon Rifkin e0253ab627 fully add thinking support to generate()
https://github.com/ollama/ollama-python/pull/521 missed some calls
2025-05-30 13:41:23 -07:00
5 changed files with 15 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)
+1
View File
@@ -4,6 +4,7 @@ response: ListResponse = list()
for model in response.models:
print('Name:', model.model)
print(' Capabilities:', model.capabilities)
print(' Size (MB):', f'{(model.size.real / 1024 / 1024):.2f}')
if model.details:
print(' Format:', model.details.format)
+6
View File
@@ -0,0 +1,6 @@
from ollama import generate
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)
+4
View File
@@ -190,6 +190,7 @@ class Client(BaseClient):
template: str = '',
context: Optional[Sequence[int]] = None,
stream: Literal[False] = False,
think: Optional[bool] = None,
raw: bool = False,
format: Optional[Union[Literal['', 'json'], JsonSchemaValue]] = None,
images: Optional[Sequence[Union[str, bytes, Image]]] = None,
@@ -208,6 +209,7 @@ class Client(BaseClient):
template: str = '',
context: Optional[Sequence[int]] = None,
stream: Literal[True] = True,
think: Optional[bool] = None,
raw: bool = False,
format: Optional[Union[Literal['', 'json'], JsonSchemaValue]] = None,
images: Optional[Sequence[Union[str, bytes, Image]]] = None,
@@ -225,6 +227,7 @@ class Client(BaseClient):
template: Optional[str] = None,
context: Optional[Sequence[int]] = None,
stream: bool = False,
think: Optional[bool] = None,
raw: Optional[bool] = None,
format: Optional[Union[Literal['', 'json'], JsonSchemaValue]] = None,
images: Optional[Sequence[Union[str, bytes, Image]]] = None,
@@ -253,6 +256,7 @@ class Client(BaseClient):
template=template,
context=context,
stream=stream,
think=think,
raw=raw,
format=format,
images=list(_copy_images(images)) if images else None,
+1
View File
@@ -464,6 +464,7 @@ class ListResponse(SubscriptableBaseModel):
digest: Optional[str] = None
size: Optional[ByteSize] = None
details: Optional[ModelDetails] = None
capabilities: Optional[List[str]] = None
models: Sequence[Model]
'List of models.'