feat(multimodal): allow to template placeholders (#3728)

feat(multimodal): allow to template image placeholders

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2024-10-04 18:32:29 +02:00 committed by GitHub
parent 04c0841ca9
commit 648ffdf449
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 66 additions and 4 deletions

View file

@ -0,0 +1,19 @@
package templates_test
import (
. "github.com/mudler/LocalAI/pkg/templates" // Update with your module path
// Update with your module path
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("EvaluateTemplate", func() {
Context("templating simple strings for multimodal chat", func() {
It("should template messages correctly", func() {
result, err := TemplateMultiModal("[img-{{.ID}}]{{.Text}}", 1, "bar")
Expect(err).NotTo(HaveOccurred())
Expect(result).To(Equal("[img-1]bar"))
})
})
})