2
2
3
3
The ** GoLamify** Go package provides an easy way to integrate Go projects with ** Ollama** .
4
4
5
+ ## ✨ Features
6
+
7
+ 1 . ** Generate Responses from Ollama Models** – Easily generate responses using a variety of Ollama models.
8
+ 2 . ** Default Response Streaming** – Real-time response streaming for immediate output.
9
+ 3 . ** Full Parameter Support** – Customize model behavior with full API parameter support.
10
+ 4 . ** No Model Pulling Needed** – Access models without manual pre-pulling.
11
+ 5 . ** Clear Error Handling** – Simple, concise error handling for easy debugging.
12
+ 6 . ** More** – Comming soon.
13
+
5
14
## 🚀 Getting Started
6
15
7
16
### Installation
@@ -27,6 +36,7 @@ package main
27
36
28
37
import (
29
38
" fmt"
39
+
30
40
" github.com/prasad89/golamify/pkg/golamify"
31
41
)
32
42
@@ -37,13 +47,29 @@ func main() {
37
47
return
38
48
}
39
49
40
- resp , err := golamify.Generate (client, " llama3.2" , " Why is the sky blue?" )
41
- if err != nil {
42
- fmt.Println (" Error generating response:" , err)
43
- return
50
+ payload := golamify.GeneratePayload {
51
+ Model: " llama3.2:1b" ,
52
+ Prompt: " Why is the sky blue?" ,
44
53
}
45
54
46
- fmt.Println (" Response:" , resp.Response )
55
+ responseChannel , errorChannel := golamify.Generate (client, &payload)
56
+
57
+ for {
58
+ select {
59
+ case response , ok := <- responseChannel:
60
+ if !ok {
61
+ return
62
+ }
63
+ fmt.Print (response[" response" ])
64
+
65
+ case err , ok := <- errorChannel:
66
+ if ok && err != nil {
67
+ fmt.Println (" Error:" , err)
68
+ } else if !ok {
69
+ return
70
+ }
71
+ }
72
+ }
47
73
}
48
74
```
49
75
0 commit comments