2023-09-01 22:12:20 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/jmorganca/ollama/api"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestModelPrompt(t *testing.T) {
|
|
|
|
var m Model
|
|
|
|
req := api.GenerateRequest{
|
|
|
|
Template: "a{{ .Prompt }}b",
|
|
|
|
Prompt: "<h1>",
|
|
|
|
}
|
2023-10-16 15:07:37 +00:00
|
|
|
s, err := m.Prompt(req)
|
2023-09-01 22:12:20 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
want := "a<h1>b"
|
|
|
|
if s != want {
|
|
|
|
t.Errorf("got %q, want %q", s, want)
|
|
|
|
}
|
|
|
|
}
|