[PR #15116] Expose numeric parameter_count in model details #40906

Open
opened 2026-04-23 01:41:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15116
Author: @PiyushInt
Created: 3/28/2026
Status: 🔄 Open

Base: mainHead: feature


📝 Commits (1)

  • cbb9112 Expose numeric parameter_count in model details

📊 Changes

3 files changed (+57 additions, -1 deletions)

View changed files

📝 api/types.go (+1 -0)
📝 server/routes.go (+55 -1)
📝 server/routes_create_test.go (+1 -0)

📄 Description

Fixes #15067

Summary

Expose a numeric parameter_count field in model metadata so clients can adapt tool definitions based on model size (Option B from the issue: expose model metadata to clients).

Changes

  • API:
    • Extend ModelDetails with a new parameter_count field (in addition to the existing human-readable parameter_size).
  • Server:
    • /api/show:
      • Populate details.parameter_count from:
        • Safetensors LLM metadata (general.parameter_count), when available.
        • Image generation manifest ParameterCount, when available.
        • Otherwise, derive an approximate numeric count from details.parameter_size (e.g., "7B", "430M", "15K").
    • /api/ps:
      • Include details.parameter_count by deriving it from the existing details.parameter_size.
    • /api/tags:
      • Include details.parameter_count for listed models, also derived from details.parameter_size.
  • Tests:
    • Update existing ShowHandler test expectations to account for the new parameter_count field while keeping prior behavior unchanged.

Rationale

Clients that use /api/chat with tools can now call /api/show (or reuse /api/ps / /api/tags) to read a numeric parameter_count and implement capability-aware tool presentation on their side (e.g., different tool tiers for small vs. large models), without changing the current chat/tool prompting behavior on the server.


🔄 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/15116 **Author:** [@PiyushInt](https://github.com/PiyushInt) **Created:** 3/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature` --- ### 📝 Commits (1) - [`cbb9112`](https://github.com/ollama/ollama/commit/cbb91120d2045d57057c1e931f9d16e91cc4ea71) Expose numeric parameter_count in model details ### 📊 Changes **3 files changed** (+57 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+1 -0) 📝 `server/routes.go` (+55 -1) 📝 `server/routes_create_test.go` (+1 -0) </details> ### 📄 Description Fixes #15067 ## Summary Expose a numeric `parameter_count` field in model metadata so clients can adapt tool definitions based on model size (Option B from the issue: expose model metadata to clients). ## Changes - API: - Extend `ModelDetails` with a new `parameter_count` field (in addition to the existing human-readable `parameter_size`). - Server: - `/api/show`: - Populate `details.parameter_count` from: - Safetensors LLM metadata (`general.parameter_count`), when available. - Image generation manifest `ParameterCount`, when available. - Otherwise, derive an approximate numeric count from `details.parameter_size` (e.g., `"7B"`, `"430M"`, `"15K"`). - `/api/ps`: - Include `details.parameter_count` by deriving it from the existing `details.parameter_size`. - `/api/tags`: - Include `details.parameter_count` for listed models, also derived from `details.parameter_size`. - Tests: - Update existing `ShowHandler` test expectations to account for the new `parameter_count` field while keeping prior behavior unchanged. ## Rationale Clients that use `/api/chat` with tools can now call `/api/show` (or reuse `/api/ps` / `/api/tags`) to read a numeric `parameter_count` and implement capability-aware tool presentation on their side (e.g., different tool tiers for small vs. large models), without changing the current chat/tool prompting behavior on the server. --- <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-23 01:41:31 -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#40906