//go:build integration

package integration

import (
	"context"
	"encoding/base64"
	"net/http"
	"testing"
	"time"

	"github.com/jmorganca/ollama/api"
	"github.com/stretchr/testify/require"
)

func TestIntegrationMultimodal(t *testing.T) {
	image, err := base64.StdEncoding.DecodeString(imageEncoding)
	require.NoError(t, err)
	req := api.GenerateRequest{
		Model:  "llava:7b",
		Prompt: "what does the text in this image say?",
		Stream: &stream,
		Options: map[string]interface{}{
			"seed":        42,
			"temperature": 0.0,
		},
		Images: []api.ImageData{
			image,
		},
	}

	resp := "the ollamas"
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
	defer cancel()
	GenerateTestHelper(ctx, t, &http.Client{}, req, []string{resp})
}

const imageEncoding = `iVBORw0KGgoAAAANSUhEUgAAANIAAAB4CAYAAACHHqzKAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEb
[encoded data, 59774 characters]
voQTefWxZ9CMIP9/0Wj1ClQSO/4AAAAASUVORK5CYII=`
