Skip to content

Commit

Permalink
Update example programs
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Oct 2, 2024
1 parent 8328b41 commit 1a7104b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
7 changes: 5 additions & 2 deletions v2/cmd/describeimage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import (

"github.com/spf13/pflag"
"github.com/xyproto/ollamaclient/v2"
"github.com/xyproto/usermodel"
"github.com/xyproto/wordwrap"
"golang.org/x/term"
)

const (
versionString = "DescribeImage 1.0.0"
defaultModel = "llava"
defaultTermWidth = 79
)

var verbose bool
var (
defaultModel = usermodel.GetVisionModel()
verbose bool
)

// Only print the provided data when in verbose mode
func logVerbose(format string, a ...interface{}) {
Expand Down
8 changes: 4 additions & 4 deletions v2/cmd/fortune/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"os"

"github.com/xyproto/ollamaclient/v2"
"github.com/xyproto/usermodel"
)

const (
model = "gemma2:2b"
prompt = "Write a silly saying, quote or joke like it could have been the output of the fortune command on Linux."
)
const prompt = "Write a silly saying, quote or joke like it could have been the output of the fortune command on Linux."

var model = usermodel.GetChatModel()

func main() {
oc := ollamaclient.New(model)
Expand Down
3 changes: 2 additions & 1 deletion v2/cmd/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"fmt"

"github.com/xyproto/ollamaclient/v2"
"github.com/xyproto/usermodel"
)

func main() {
oc := ollamaclient.New("gemma2:2b")
oc := ollamaclient.New(usermodel.GetChatModel())
if err := oc.PullIfNeeded(true); err != nil {
fmt.Println("Error:", err)
return
Expand Down
3 changes: 2 additions & 1 deletion v2/cmd/simpledescribe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"log"

"github.com/xyproto/ollamaclient/v2"
"github.com/xyproto/usermodel"
)

func main() {
oc := ollamaclient.New("llava")
oc := ollamaclient.New(usermodel.GetVisionModel())
oc.SetReproducible()
if err := oc.PullIfNeeded(true); err != nil {
log.Fatalln(err)
Expand Down
9 changes: 6 additions & 3 deletions v2/cmd/summarize/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import (

"github.com/spf13/pflag"
"github.com/xyproto/ollamaclient/v2"
"github.com/xyproto/usermodel"
"github.com/xyproto/wordwrap"
"golang.org/x/term"
)

const (
versionString = "Summarize 1.4.0"
defaultModel = "nous-hermes:7b-llama2-q2_K"
versionString = "Summarize 1.5.0"
defaultTermWidth = 79
)

var verbose bool
var (
defaultModel = usermodel.GetTextGenerationModel()
verbose bool
)

// Only print the provided data when in verbose mode
func logVerbose(format string, a ...interface{}) {
Expand Down

0 comments on commit 1a7104b

Please sign in to comment.