add golang gen

Signed-off-by: Matt Williams <m@technovangelist.com>
This commit is contained in:
Matt Williams 2023-10-11 21:20:50 -07:00
parent fc6b49be32
commit 8a41b244e8
2 changed files with 27 additions and 0 deletions

View file

View file

@ -0,0 +1,27 @@
package main
import (
"bytes"
"fmt"
"net/http"
"os"
"io"
"log"
)
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)
}
responseData, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(responseData))
}