-
Notifications
You must be signed in to change notification settings - Fork 13k
api: return model capabilities from the show endpoint #10066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
a17d78f
to
4c4e0aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the model show endpoint by adding a new field for model capabilities, making it easier for clients to discover what features a model supports. Key changes include:
- Introducing a new Capability type and constants in types/model/capability.go.
- Updating server endpoints and CLI commands to utilize the new capabilities information.
- Extending tests and API documentation to validate and showcase model capabilities.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
types/model/capability.go | Defines model capability constants and a String method. |
server/sched.go | Refactors capability calls to use the new model.Capability constants. |
server/routes.go | Updates route handlers to work with model.Capability and variable renaming. |
server/images_test.go | Adds tests validating model capabilities extraction from model files. |
server/images.go | Implements Capabilities and CheckCapabilities methods for models. |
docs/api.md | Updates API example to include the new capabilities field. |
cmd/cmd_test.go | Extends tests for CLI output to include capabilities information. |
cmd/cmd.go | Incorporates capabilities into CLI output and multimodal logic. |
api/types.go | Updates API response structure to include a Capabilities field. |
Comments suppressed due to low confidence (3)
docs/api.md:1220
- The model name 'llava' in the API example appears inconsistent with other references (e.g. 'llama3.2'); please confirm if this naming is intentional.
"model": "llava"
server/images.go:137
- Consider explicitly wrapping all joined errors using errors.Join(errs...) in the error message so that all missing capabilities are clearly reported.
return fmt.Errorf("%w %w", errCapabilities, err)
server/images.go:130
- For unknown capabilities, consider appending a descriptive error to the errors slice instead of only logging the error, ensuring the caller receives appropriate feedback.
default:
This looks like a good feature. Especially useful for the REST API where you can get details on the model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Just one suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm (but you should remove the comment)
Thank you all very much, really appreciate it |
@JHubi1 thanks for bringing it up |
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.
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 avision
capability based off the presence of avision.block_count
KV.Sample API response:
Sample
ollama show
CLI output: