2023-10-12 04:20:50 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"log"
|
2023-10-19 16:21:00 +00:00
|
|
|
"net/http"
|
|
|
|
"os"
|
2023-10-12 04:20:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
body := []byte(`{"model":"mistral"}`)
|
|
|
|
resp, err := http.Post("http://localhost:11434/api/generate", "application/json", bytes.NewBuffer(body))
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
fmt.Print(err.Error())
|
|
|
|
os.Exit(1)
|
2023-10-19 16:21:00 +00:00
|
|
|
}
|
2023-10-12 04:20:50 +00:00
|
|
|
|
2023-12-25 14:01:37 +00:00
|
|
|
defer resp.Body.Close()
|
2024-05-05 23:08:09 +00:00
|
|
|
|
2023-10-12 04:20:50 +00:00
|
|
|
responseData, err := io.ReadAll(resp.Body)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
fmt.Println(string(responseData))
|
|
|
|
|
|
|
|
}
|