From 810d09265d6ac42e71d5d85e2c1535878f79f363 Mon Sep 17 00:00:00 2001 From: JRinaldi Date: Thu, 24 Apr 2025 22:35:19 +0900 Subject: [PATCH 1/7] add capabilities to show model. --- examples/README.md | 2 ++ examples/show.py | 17 +++++++++++++++++ ollama/_types.py | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 examples/show.py diff --git a/examples/README.md b/examples/README.md index ccd3f9a1..6ec67d85 100644 --- a/examples/README.md +++ b/examples/README.md @@ -59,3 +59,5 @@ Requirement: `pip install tqdm` ### Ollama Embed - Generate embeddings with a model - [embed.py](embed.py) +### Ollama Show - Display downloaded model's properties and capabilities +- [show.py](show.py) \ No newline at end of file diff --git a/examples/show.py b/examples/show.py new file mode 100644 index 00000000..4f2f65d2 --- /dev/null +++ b/examples/show.py @@ -0,0 +1,17 @@ +from ollama import ShowResponse, show +from ollama import ListResponse, list + +response: ListResponse = list() + +for model in response.models: + print('Name:', model.model) + model_details: ShowResponse = show(model.model) + if "embedding" in model_details.capabilities: + print("Embedding model") + elif "vision" in model_details.capabilities: + print("Vision model") + elif "completion" in model_details.capabilities: + print("Chat model") + else: + print("Unknown", model_details.capabilities) + print('\n') diff --git a/ollama/_types.py b/ollama/_types.py index dfeafcf1..24eddd6c 100644 --- a/ollama/_types.py +++ b/ollama/_types.py @@ -505,6 +505,8 @@ class ShowResponse(SubscriptableBaseModel): parameters: Optional[str] = None + capabilities: Optional[list[str]] = None + class ProcessResponse(SubscriptableBaseModel): class Model(SubscriptableBaseModel): From 4cbf2b7b0f09c1630d4a1c2ef85f31de525c7076 Mon Sep 17 00:00:00 2001 From: JRinaldi Date: Thu, 24 Apr 2025 23:24:53 +0900 Subject: [PATCH 2/7] move show to below list --- examples/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/README.md b/examples/README.md index 6ec67d85..bf566f76 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 downloaded model's properties and capabilities +- [show.py](show.py) + + ### Ollama ps - Show model status with CPU/GPU usage - [ps.py](ps.py) @@ -55,9 +59,5 @@ Requirement: `pip install tqdm` - [create.py](create.py) - ### Ollama Embed - Generate embeddings with a model - [embed.py](embed.py) - -### Ollama Show - Display downloaded model's properties and capabilities -- [show.py](show.py) \ No newline at end of file From 2c3e6cb8e307f399830f6fed3c42565905d1b660 Mon Sep 17 00:00:00 2001 From: JRinaldi Date: Thu, 24 Apr 2025 23:27:38 +0900 Subject: [PATCH 3/7] fix formatting with readme.md --- examples/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/README.md b/examples/README.md index bf566f76..3ee6a6a0 100644 --- a/examples/README.md +++ b/examples/README.md @@ -59,5 +59,7 @@ Requirement: `pip install tqdm` - [create.py](create.py) + ### Ollama Embed - Generate embeddings with a model - [embed.py](embed.py) + From c2da8906d95ed57da6c87db7bece186f97de36bf Mon Sep 17 00:00:00 2001 From: JRinaldi Date: Fri, 25 Apr 2025 00:03:57 +0900 Subject: [PATCH 4/7] fix format --- examples/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 3ee6a6a0..3237f609 100644 --- a/examples/README.md +++ b/examples/README.md @@ -59,7 +59,6 @@ Requirement: `pip install tqdm` - [create.py](create.py) - ### Ollama Embed - Generate embeddings with a model - [embed.py](embed.py) From 89eed9373d1683db71a158d8079b3140c1341f67 Mon Sep 17 00:00:00 2001 From: JRinaldi Date: Tue, 29 Apr 2025 09:47:50 +0900 Subject: [PATCH 5/7] updated to show all properties of show response --- examples/show.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/examples/show.py b/examples/show.py index 4f2f65d2..de6af1af 100644 --- a/examples/show.py +++ b/examples/show.py @@ -1,17 +1,11 @@ from ollama import ShowResponse, show -from ollama import ListResponse, list -response: ListResponse = list() - -for model in response.models: - print('Name:', model.model) - model_details: ShowResponse = show(model.model) - if "embedding" in model_details.capabilities: - print("Embedding model") - elif "vision" in model_details.capabilities: - print("Vision model") - elif "completion" in model_details.capabilities: - print("Chat model") - else: - print("Unknown", model_details.capabilities) - print('\n') +response: ShowResponse = show("gemma3") +print(f"Modified at: {response.modified_at}\n") +print(f"Template: {response.template}\n") +print(f"Modelfile: {response.modelfile}\n") +print(f"License: {response.license}\n") +print(f"Details: {response.details}\n") +print(f"Model Info: {response.modelinfo}\n") +print(f"Parameters: {response.parameters}\n") +print(f"Capabilities: {response.capabilities}\n") \ No newline at end of file From dab1cdd35920d76a3052c331b274b0865e91f7d6 Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Wed, 14 May 2025 18:11:10 -0700 Subject: [PATCH 6/7] Cleanup show example --- examples/show.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/show.py b/examples/show.py index de6af1af..184a1e3e 100644 --- a/examples/show.py +++ b/examples/show.py @@ -1,11 +1,12 @@ from ollama import ShowResponse, show -response: ShowResponse = show("gemma3") -print(f"Modified at: {response.modified_at}\n") -print(f"Template: {response.template}\n") -print(f"Modelfile: {response.modelfile}\n") -print(f"License: {response.license}\n") -print(f"Details: {response.details}\n") -print(f"Model Info: {response.modelinfo}\n") -print(f"Parameters: {response.parameters}\n") -print(f"Capabilities: {response.capabilities}\n") \ No newline at end of file +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}') From 5df7ed30cd24850e3ef8d8a085eb2d7d82bd05d4 Mon Sep 17 00:00:00 2001 From: Parth Sareen Date: Wed, 14 May 2025 18:20:46 -0700 Subject: [PATCH 7/7] Make compatible with Python3.9 --- examples/README.md | 2 +- ollama/_types.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/README.md b/examples/README.md index 3237f609..f505a2a8 100644 --- a/examples/README.md +++ b/examples/README.md @@ -42,7 +42,7 @@ See [ollama/docs/api.md](https://github.com/ollama/ollama/blob/main/docs/api.md) - [list.py](list.py) -### Ollama Show - Display downloaded model's properties and capabilities +### Ollama Show - Display model properties and capabilities - [show.py](show.py) diff --git a/ollama/_types.py b/ollama/_types.py index 24eddd6c..67721fc3 100644 --- a/ollama/_types.py +++ b/ollama/_types.py @@ -505,7 +505,7 @@ class ShowResponse(SubscriptableBaseModel): parameters: Optional[str] = None - capabilities: Optional[list[str]] = None + capabilities: Optional[List[str]] = None class ProcessResponse(SubscriptableBaseModel):