From 810d09265d6ac42e71d5d85e2c1535878f79f363 Mon Sep 17 00:00:00 2001 From: JRinaldi Date: Thu, 24 Apr 2025 22:35:19 +0900 Subject: [PATCH 1/5] 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 ccd3f9a..6ec67d8 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 0000000..4f2f65d --- /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 dfeafcf..24eddd6 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/5] 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 6ec67d8..bf566f7 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/5] 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 bf566f7..3ee6a6a 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/5] fix format --- examples/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 3ee6a6a..3237f60 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/5] 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 4f2f65d..de6af1a 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