[PR #10066] [MERGED] api: return model capabilities from the show endpoint #13135

Closed
opened 2026-04-13 00:18:48 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10066
Author: @BruceMacD
Created: 3/31/2025
Status: Merged
Merged: 4/1/2025
Merged by: @BruceMacD

Base: mainHead: brucemacd/api-caps


📝 Commits (6)

  • 70a9435 api: return model capabilities from the show endpoint
  • 4c4e0aa server: return vision type for model capabilities
  • b555516 add embedding capability
  • d03ac98 use capability error map look-up
  • 65fe5f4 restore TODO comment
  • 4b020ee Update server/images.go

📊 Changes

9 files changed (+521 additions, -69 deletions)

View changed files

📝 api/types.go (+13 -11)
📝 cmd/cmd.go (+15 -0)
📝 cmd/cmd_test.go (+29 -0)
📝 docs/api.md (+6 -2)
📝 server/images.go (+63 -38)
server/images_test.go (+360 -0)
📝 server/routes.go (+18 -17)
📝 server/sched.go (+2 -1)
types/model/capability.go (+15 -0)

📄 Description

With support for multimodal models becoming more varied and common it is important for clients to be able to easily see what capabilities a model has. Retuning these from the show endpoint will allow clients to easily see what a model can do.

This change adds a capabilities field to the show response so that clients can easily see what features a given model supports. It also adds a vision capability based off the presence of a vision.block_count KV.

Sample API response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Mon, 31 Mar 2025 23:26:18 GMT
Connection: close
Transfer-Encoding: chunked

{
  "license": "omitted",
  "modelfile": "omitted",
  "parameters": "omitted",
  "template": "{{- range $i, $_ := .Messages }}\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\n{{- if or (eq .Role \"user\") (eq .Role \"system\") }}\u003cstart_of_turn\u003euser\n{{ .Content }}\u003cend_of_turn\u003e\n{{ if $last }}\u003cstart_of_turn\u003emodel\n{{ end }}\n{{- else if eq .Role \"assistant\" }}\u003cstart_of_turn\u003emodel\n{{ .Content }}{{ if not $last }}\u003cend_of_turn\u003e\n{{ end }}\n{{- end }}\n{{- end }}",
  "details": {
    "parent_model": "",
    "format": "gguf",
    "family": "gemma3",
    "families": [
      "gemma3"
    ],
    "parameter_size": "4.3B",
    "quantization_level": "Q4_K_M"
  },
  "model_info": {
    // ... omitted
  },
  "tensors": [
    // ... omitted
  ],
  "capabilities": [
    "completion",
    "vision"
  ],
  "modified_at": "2025-03-31T16:07:27.293556892-07:00"
}

Sample ollama show CLI output:

❯ ./ollama show llama3.2:1b
  Model
    architecture        llama     
    parameters          1.2B      
    context length      131072    
    embedding length    2048      
    quantization        Q8_0      

  Capabilities
    completion    
    tools         

  License
    LLAMA 3.2 COMMUNITY LICENSE AGREEMENT                 
    Llama 3.2 Version Release Date: September 25, 2024    

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/10066 **Author:** [@BruceMacD](https://github.com/BruceMacD) **Created:** 3/31/2025 **Status:** ✅ Merged **Merged:** 4/1/2025 **Merged by:** [@BruceMacD](https://github.com/BruceMacD) **Base:** `main` ← **Head:** `brucemacd/api-caps` --- ### 📝 Commits (6) - [`70a9435`](https://github.com/ollama/ollama/commit/70a94356f47927d7e6eb26c6c13c9dca6c647041) api: return model capabilities from the show endpoint - [`4c4e0aa`](https://github.com/ollama/ollama/commit/4c4e0aa7ccaa862d048be8bd781dac1f47e229b7) server: return vision type for model capabilities - [`b555516`](https://github.com/ollama/ollama/commit/b55551642f1b7f8550e8fa18bc5449a28011a210) add embedding capability - [`d03ac98`](https://github.com/ollama/ollama/commit/d03ac987dd5fbfe1843fe975f3801873ab5e0511) use capability error map look-up - [`65fe5f4`](https://github.com/ollama/ollama/commit/65fe5f4d47824126443d2b8aefbf8959f23c8804) restore TODO comment - [`4b020ee`](https://github.com/ollama/ollama/commit/4b020ee9f34c737fd7d216427d3907bbd9454ef0) Update server/images.go ### 📊 Changes **9 files changed** (+521 additions, -69 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+13 -11) 📝 `cmd/cmd.go` (+15 -0) 📝 `cmd/cmd_test.go` (+29 -0) 📝 `docs/api.md` (+6 -2) 📝 `server/images.go` (+63 -38) ➕ `server/images_test.go` (+360 -0) 📝 `server/routes.go` (+18 -17) 📝 `server/sched.go` (+2 -1) ➕ `types/model/capability.go` (+15 -0) </details> ### 📄 Description With support for multimodal models becoming more varied and common it is important for clients to be able to easily see what capabilities a model has. Retuning these from the show endpoint will allow clients to easily see what a model can do. This change adds a `capabilities` field to the show response so that clients can easily see what features a given model supports. It also adds a `vision` capability based off the presence of a `vision.block_count` KV. Sample API response: ``` HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Date: Mon, 31 Mar 2025 23:26:18 GMT Connection: close Transfer-Encoding: chunked { "license": "omitted", "modelfile": "omitted", "parameters": "omitted", "template": "{{- range $i, $_ := .Messages }}\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\n{{- if or (eq .Role \"user\") (eq .Role \"system\") }}\u003cstart_of_turn\u003euser\n{{ .Content }}\u003cend_of_turn\u003e\n{{ if $last }}\u003cstart_of_turn\u003emodel\n{{ end }}\n{{- else if eq .Role \"assistant\" }}\u003cstart_of_turn\u003emodel\n{{ .Content }}{{ if not $last }}\u003cend_of_turn\u003e\n{{ end }}\n{{- end }}\n{{- end }}", "details": { "parent_model": "", "format": "gguf", "family": "gemma3", "families": [ "gemma3" ], "parameter_size": "4.3B", "quantization_level": "Q4_K_M" }, "model_info": { // ... omitted }, "tensors": [ // ... omitted ], "capabilities": [ "completion", "vision" ], "modified_at": "2025-03-31T16:07:27.293556892-07:00" } ``` Sample `ollama show` CLI output: ``` ❯ ./ollama show llama3.2:1b Model architecture llama parameters 1.2B context length 131072 embedding length 2048 quantization Q8_0 Capabilities completion tools License LLAMA 3.2 COMMUNITY LICENSE AGREEMENT Llama 3.2 Version Release Date: September 25, 2024 ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:18:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#13135