Compare commits

...

3 Commits

Author SHA1 Message Date
Roy Han
0ac5cbc00e separate deprecation changes 2024-06-28 13:22:37 -07:00
Roy Han
12209bd021 Remove Latest at API Level 2024-06-12 14:43:17 -07:00
Roy Han
be2c5fd71a Remove :latest from Ollama List 2024-06-10 16:39:44 -07:00
5 changed files with 16 additions and 9 deletions

View File

@ -493,7 +493,7 @@ func ListHandler(cmd *cobra.Command, args []string) error {
for _, m := range models.Models {
if len(args) == 0 || strings.HasPrefix(m.Name, args[0]) {
data = append(data, []string{m.Name, m.Digest[:12], format.HumanBytes(m.Size), format.HumanTime(m.ModifiedAt, "Never")})
data = append(data, []string{m.Name[:len(m.Name)], m.Digest[:12], format.HumanBytes(m.Size), format.HumanTime(m.ModifiedAt, "Never")})
}
}

@ -1 +1 @@
Subproject commit 5921b8f089d3b7bda86aac5a66825df6a6c10603
Subproject commit 7c26775adb579e92b59c82e8084c07a1d0f75e9c

View File

@ -747,8 +747,8 @@ func (s *Server) ListModelsHandler(c *gin.Context) {
// tag should never be masked
models = append(models, api.ListModelResponse{
Model: n.DisplayShortest(),
Name: n.DisplayShortest(),
Model: trimLatest(n.DisplayShortest()),
Name: trimLatest(n.DisplayShortest()),
Size: m.Size(),
Digest: m.digest,
ModifiedAt: m.fi.ModTime(),
@ -1156,8 +1156,8 @@ func (s *Server) ProcessHandler(c *gin.Context) {
}
mr := api.ProcessModelResponse{
Model: model.ShortName,
Name: model.ShortName,
Model: trimLatest(model.ShortName),
Name: trimLatest(model.ShortName),
Size: int64(v.estimatedTotal),
SizeVRAM: int64(v.estimatedVRAM),
Digest: model.Digest,
@ -1178,6 +1178,13 @@ func (s *Server) ProcessHandler(c *gin.Context) {
c.JSON(http.StatusOK, api.ProcessResponse{Models: models})
}
func trimLatest(s string) string {
if strings.HasSuffix(s, ":latest") {
return s[:len(s)-7]
}
return s
}
// ChatPrompt builds up a prompt from a series of messages for the currently `loaded` model
func chatPrompt(ctx context.Context, runner *runnerRef, template string, messages []api.Message, numCtx int) (string, error) {
encode := func(s string) ([]int, error) {

View File

@ -16,12 +16,12 @@ func TestList(t *testing.T) {
expectNames := []string{
"mistral:7b-instruct-q4_0",
"zephyr:7b-beta-q5_K_M",
"apple/OpenELM:latest",
"apple/OpenELM",
"boreas:2b-code-v1.5-q6_K",
"notus:7b-v1-IQ2_S",
// TODO: host:port currently fails on windows (#4107)
// "localhost:5000/library/eurus:700b-v0.5-iq3_XXS",
"mynamespace/apeliotes:latest",
"mynamespace/apeliotes",
"myhost/mynamespace/lips:code",
}

View File

@ -123,7 +123,7 @@ func Test_Routes(t *testing.T) {
require.NoError(t, err)
assert.Len(t, modelList.Models, 1)
assert.Equal(t, "test-model:latest", modelList.Models[0].Name)
assert.Equal(t, "test-model", modelList.Models[0].Name)
},
},
{