feat(functions/aio): all-in-one images, function template enhancements (#1862)

* feat(startup): allow to specify models from local files

* feat(aio): add Dockerfile, make targets, aio profiles

* feat(template): add Function and LastMessage

* add hermes2-pro-mistral

* update hermes2 definition

* feat(template): add sprig

* feat(template): expose FunctionCall

* feat(aio): switch llm for text
This commit is contained in:
Ettore Di Giacinto 2024-03-21 01:12:20 +01:00 committed by GitHub
parent eeaf8c7ccd
commit e533dcf506
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 462 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import (
"sync"
"text/template"
"github.com/Masterminds/sprig/v3"
grammar "github.com/go-skynet/LocalAI/pkg/grammar"
"github.com/go-skynet/LocalAI/pkg/grpc"
process "github.com/mudler/go-processmanager"
@ -36,6 +37,9 @@ type ChatMessageTemplateData struct {
FunctionName string
Content string
MessageIndex int
Function bool
FunctionCall interface{}
LastMessage bool
}
// Keep this in sync with config.TemplateConfig. Is there a more idiomatic way to accomplish this in go?
@ -261,7 +265,7 @@ func (ml *ModelLoader) loadTemplateIfExists(templateType TemplateType, templateN
}
// Parse the template
tmpl, err := template.New("prompt").Parse(dat)
tmpl, err := template.New("prompt").Funcs(sprig.FuncMap()).Parse(dat)
if err != nil {
return err
}