Skip to content

Commit

Permalink
Merge pull request #6 from So-Sahari/feature/cleanup-ollama-list
Browse files Browse the repository at this point in the history
feat: ollama now list models available
  • Loading branch information
catpaladin authored Jun 30, 2024
2 parents 8f97e62 + 9976eaf commit cf522da
Show file tree
Hide file tree
Showing 6 changed files with 382 additions and 90 deletions.
6 changes: 5 additions & 1 deletion app/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ func getModelsByPlatform(ctx context.Context, region string) gin.HandlerFunc {
modelList = append(modelList, v.ID)
}
case "Ollama":
for _, n := range ollama.OllamaModels {
ollamaModels, err := ollama.ListModels(ctx)
if err != nil {
log.Fatal("Unable to list models")
}
for _, n := range ollamaModels {
modelList = append(modelList, n.ModelID)
}
default:
Expand Down
6 changes: 5 additions & 1 deletion cmd/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ func init() {

func invokeOllamaModel(ctx context.Context) {
if model == "" {
model = o.SelectOllamaModel()
var err error
model, err = o.SelectOllamaModel(ctx)
if err != nil {
log.Fatal(err)
}
}

var chatMessages string
Expand Down
65 changes: 49 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
module jenn-ai

go 1.21.0
go 1.22.0

toolchain go1.22.4

require (
github.com/aws/aws-sdk-go-v2/config v1.27.4
github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.1
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.7.1
github.com/chzyer/readline v1.5.1
github.com/gin-gonic/gin v1.9.1
github.com/gin-gonic/gin v1.10.0
github.com/lithammer/fuzzysearch v1.1.8
github.com/manifoldco/promptui v0.9.0
github.com/spf13/cobra v1.8.0
github.com/tmc/langchaingo v0.1.5
)

require (
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
github.com/aws/aws-sdk-go-v2 v1.25.2 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.4 // indirect
Expand All @@ -28,34 +32,63 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.1 // indirect
github.com/aws/smithy-go v1.20.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/chewxy/hm v1.0.0 // indirect
github.com/chewxy/math32 v1.10.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1 // indirect
github.com/dlclark/regexp2 v1.8.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/cors v1.7.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/nlpodyssey/gopickle v0.3.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/ollama/ollama v0.1.48 // indirect
github.com/pdevine/tensor v0.0.0-20240510204454-f88f4562727c // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkoukk/tiktoken-go v0.1.2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xtgo/set v1.0.0 // indirect
github.com/yuin/goldmark v1.7.4 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorgonia.org/vecf32 v0.9.0 // indirect
gorgonia.org/vecf64 v0.9.0 // indirect
)
Loading

0 comments on commit cf522da

Please sign in to comment.