From 5d7c63fae1358ce3a3eccb57587a0fb8da895653 Mon Sep 17 00:00:00 2001 From: JRinaldi Date: Thu, 15 May 2025 11:27:48 +0900 Subject: [PATCH] types: add capabilities to show response. (#511) --- examples/README.md | 5 ++++- examples/show.py | 12 ++++++++++++ ollama/_types.py | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 examples/show.py diff --git a/examples/README.md b/examples/README.md index ccd3f9a..f505a2a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -42,6 +42,10 @@ See [ollama/docs/api.md](https://github.com/ollama/ollama/blob/main/docs/api.md) - [list.py](list.py) +### Ollama Show - Display model properties and capabilities +- [show.py](show.py) + + ### Ollama ps - Show model status with CPU/GPU usage - [ps.py](ps.py) @@ -55,7 +59,6 @@ Requirement: `pip install tqdm` - [create.py](create.py) - ### Ollama Embed - Generate embeddings with a model - [embed.py](embed.py) diff --git a/examples/show.py b/examples/show.py new file mode 100644 index 0000000..184a1e3 --- /dev/null +++ b/examples/show.py @@ -0,0 +1,12 @@ +from ollama import ShowResponse, show + +response: ShowResponse = show('gemma3') +print('Model Information:') +print(f'Modified at: {response.modified_at}') +print(f'Template: {response.template}') +print(f'Modelfile: {response.modelfile}') +print(f'License: {response.license}') +print(f'Details: {response.details}') +print(f'Model Info: {response.modelinfo}') +print(f'Parameters: {response.parameters}') +print(f'Capabilities: {response.capabilities}') diff --git a/ollama/_types.py b/ollama/_types.py index 3ba506b..3911499 100644 --- a/ollama/_types.py +++ b/ollama/_types.py @@ -506,6 +506,8 @@ class ShowResponse(SubscriptableBaseModel): parameters: Optional[str] = None + capabilities: Optional[List[str]] = None + class ProcessResponse(SubscriptableBaseModel): class Model(SubscriptableBaseModel):