2023-09-01 22:12:20 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2023-12-05 05:16:27 +00:00
|
|
|
|
|
|
|
"github.com/jmorganca/ollama/api"
|
2023-09-01 22:12:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestModelPrompt(t *testing.T) {
|
2023-12-05 05:16:27 +00:00
|
|
|
var m Model
|
|
|
|
req := api.GenerateRequest{
|
2023-09-01 22:12:20 +00:00
|
|
|
Template: "a{{ .Prompt }}b",
|
2023-12-05 05:16:27 +00:00
|
|
|
Prompt: "<h1>",
|
2023-09-01 22:12:20 +00:00
|
|
|
}
|
2023-12-05 05:16:27 +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)
|
|
|
|
}
|
|
|
|
}
|