images_test.go 350 B

1234567891011121314151617181920212223
  1. package server
  2. import (
  3. "testing"
  4. "github.com/jmorganca/ollama/api"
  5. )
  6. func TestModelPrompt(t *testing.T) {
  7. var m Model
  8. req := api.GenerateRequest{
  9. Template: "a{{ .Prompt }}b",
  10. Prompt: "<h1>",
  11. }
  12. s, err := m.Prompt(req, "")
  13. if err != nil {
  14. t.Fatal(err)
  15. }
  16. want := "a<h1>b"
  17. if s != want {
  18. t.Errorf("got %q, want %q", s, want)
  19. }
  20. }