containers / ramalama

The goal of RamaLama is to make working with AI boring.
MIT License
247 stars 39 forks source link

Implement shortnames #38

Closed ericcurtin closed 1 month ago

ericcurtin commented 2 months ago

podman has this concept of shortnames, which look like this:

/etc/containers/registries.conf.d/000-shortnames.conf

$ head /etc/containers/registries.conf.d/000-shortnames.conf
[aliases]
  # almalinux
  "almalinux" = "docker.io/library/almalinux"
  "almalinux-minimal" = "docker.io/library/almalinux-minimal"
  # Amazon Linux
  "amazonlinux" = "public.ecr.aws/amazonlinux/amazonlinux"
  # Arch Linux
  "archlinux" = "docker.io/library/archlinux"
  # centos
  "centos" = "quay.io/centos/centos"

Create something similar /etc/ramalama/registries.conf.d/000-shortnames.conf that can do the same for ramalama models

Suggested by @rhatdan in https://github.com/containers/ramalama/pull/35

rhatdan commented 2 months ago

I think this is a good idea.

rhatdan commented 2 months ago

Also adding a way to specify that which is the default registry to pull images on shortnames. In Podman shortname expansion is handled via

An array of host[:port] registries to try when pulling an unqualified image, in order.

unqualified-search-registries = ["example.com"]

# Adding something that stated

unqualified-search-registrie = [ "huggingface", "ollama", "quay.io" ]

Should tell ramalama to search for a shortname without a shortnames.conf expansion first in huggingface, then in ollama and finally in "quay.io"

Obviously the user would have the opportunity modify this file and change the search path.

ericcurtin commented 2 months ago

The podman file for this is:

$ grep -v "^#" /etc/containers/registries.conf unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "docker.io"] short-name-mode = "enforcing"

so I guess the ramalama equivalent would be:

/etc/ramalama/registries.conf

rhatdan commented 2 months ago

Yes I think that makes sense, although perhaps we should use /usr/share/ramalama/registries.conf and then allow sysadmins to override in /etc/ramalama.