Implement "ai/" as the default namespace for model references#2
Draft
Implement "ai/" as the default namespace for model references#2
Conversation
Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement as ekcasey described here:
@docker/model-distribution/pull/126
Implement "ai/" as the default namespace for model references
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the feature requested in docker#126 to make "ai/" the default namespace for model references, allowing users to run commands like
docker model run gpt-osswithout explicitly specifying the "ai/" prefix.Changes Made
Added a smart namespace defaulting system that automatically prepends "ai/" to simple model names while preserving existing behavior for qualified references:
Core Implementation
addDefaultNamespace()function with intelligent logic to determine when to apply the default namespacePullModel()- for pulling models from registryGetModel()- for retrieving stored modelsIsModelInStore()- for checking model existenceDeleteModel()- for removing modelsSmart Logic
The namespace defaulting only applies to simple model names, preserving existing behavior for:
my-namespace/model→ unchangedsome-repo:v1.0→ unchangedregistry.com/namespace/model:tag→ unchangedsha256:abcd1234...→ unchangedExamples
Testing
Added comprehensive test coverage including:
This implementation follows the minimal-change principle and maintains backward compatibility while providing the convenience feature similar to how Ollama handles the "library/" namespace.
Closes docker#126
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.