Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
orangecat
ollama
Commits
8a41b244
Commit
8a41b244
authored
Oct 11, 2023
by
Matt Williams
Browse files
add golang gen
Signed-off-by:
Matt Williams
<
m@technovangelist.com
>
parent
fc6b49be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
examples/golang-simplegenerate/README.md
examples/golang-simplegenerate/README.md
+0
-0
examples/golang-simplegenerate/main.go
examples/golang-simplegenerate/main.go
+27
-0
No files found.
examples/golang-simplegenerate/README.md
0 → 100644
View file @
8a41b244
examples/golang-simplegenerate/main.go
0 → 100644
View file @
8a41b244
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
))
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment