feat(templates): add sprig to multimodal templates (#3868)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2024-10-17 17:34:20 +02:00 committed by GitHub
parent d5da8c3509
commit e1db6dce82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,11 +3,13 @@ package templates
import (
"bytes"
"text/template"
"github.com/Masterminds/sprig/v3"
)
func TemplateMultiModal(templateString string, templateID int, text string) (string, error) {
// compile the template
tmpl, err := template.New("template").Parse(templateString)
tmpl, err := template.New("template").Funcs(sprig.FuncMap()).Parse(templateString)
if err != nil {
return "", err
}