mirror of
https://github.com/ollama/ollama-python.git
synced 2026-06-19 06:33:24 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fdba575aeb | |||
| 3615139ea0 | |||
| 63ca747622 | |||
| 4c11d507b0 | |||
| ce6846e4fc | |||
| e0253ab627 |
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -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,
|
||||
|
||||
@@ -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.'
|
||||
|
||||
Reference in New Issue
Block a user