Skip to content

Commit

Permalink
added provider selection
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant committed Dec 26, 2024
1 parent 9dc6d43 commit 94819f5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.env
.env
dkn_compute
.DS_Store
43 changes: 40 additions & 3 deletions utils/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,28 @@ func PickModels(openai_models, gemini_models, or_models, ollama_models []string)
fmt.Println(separator)

// print the rows
const OPENAI_PROVIDER = "OpenAI"
const OPENAI_PROVIDER_SEL = "OAI"
fmt.Printf("| %-*s | %-*s | %-*s |\n", idWidth, OPENAI_PROVIDER_SEL, providerWidth, OPENAI_PROVIDER, nameWidth, "~ All OpenAI models ~")
for id, model := range openai_models {
modelId := id + 1
provider := "OpenAI"
provider := OPENAI_PROVIDER
fmt.Printf("| %-*d | %-*s | %-*s |\n", idWidth, modelId, providerWidth, provider, nameWidth, model)
}
const GEMINI_PROVIDER = "Gemini"
const GEMINI_PROVIDER_SEL = "G"
fmt.Printf("| %-*s | %-*s | %-*s |\n", idWidth, GEMINI_PROVIDER_SEL, providerWidth, GEMINI_PROVIDER, nameWidth, "~ All Gemini models ~")
for id, model := range gemini_models {
modelId := len(openai_models) + id + 1
provider := "Gemini"
provider := GEMINI_PROVIDER
fmt.Printf("| %-*d | %-*s | %-*s |\n", idWidth, modelId, providerWidth, provider, nameWidth, model)
}
const OPENROUTER_PROVIDER = "OpenRouter"
const OPENROUTER_PROVIDER_SEL = "OR"
fmt.Printf("| %-*s | %-*s | %-*s |\n", idWidth, OPENROUTER_PROVIDER_SEL, providerWidth, OPENROUTER_PROVIDER, nameWidth, "~ All OpenRouter models ~")
for id, model := range or_models {
modelId := len(openai_models) + len(gemini_models) + id + 1
provider := "OpenRouter"
provider := OPENROUTER_PROVIDER
display_name := strings.Split(model, "/")[1]
fmt.Printf("| %-*d | %-*s | %-*s |\n", idWidth, modelId, providerWidth, provider, nameWidth, display_name)
}
Expand All @@ -194,6 +203,34 @@ func PickModels(openai_models, gemini_models, or_models, ollama_models []string)
continue
}

// Check for provider selection
switch i {
case OPENAI_PROVIDER_SEL:
for id, model := range openai_models {
if !picked_models_map[id+1] {
picked_models_map[id+1] = true
picked_models_str = fmt.Sprintf("%s,%s", picked_models_str, model)
}
}
continue
case GEMINI_PROVIDER_SEL:
for id, model := range gemini_models {
if !picked_models_map[len(openai_models)+id+1] {
picked_models_map[len(openai_models)+id+1] = true
picked_models_str = fmt.Sprintf("%s,%s", picked_models_str, model)
}
}
continue
case OPENROUTER_PROVIDER_SEL:
for id, model := range or_models {
if !picked_models_map[len(openai_models)+len(gemini_models)+id+1] {
picked_models_map[len(openai_models)+len(gemini_models)+id+1] = true
picked_models_str = fmt.Sprintf("%s,%s", picked_models_str, model)
}
}
continue
}

id, err := strconv.Atoi(i)
if err != nil {
// not integer, invalid
Expand Down

0 comments on commit 94819f5

Please sign in to comment.