Skip to content

Commit

Permalink
#40 Made sure there is at least one active model in a router
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed Jan 21, 2024
1 parent 1452002 commit 431bd96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ func main() {
cli := cmd.NewCLI()

if err := cli.Execute(); err != nil {
log.Fatalf("Glide has finished with error: %v", err)
log.Fatalf("💥Glide has finished with error: %v", err)
}
}
4 changes: 4 additions & 0 deletions pkg/routers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ func (c *LangRouterConfig) BuildModels(tel *telemetry.Telemetry) ([]providers.La
return nil, errs
}

if len(models) == 0 {
return nil, fmt.Errorf("router \"%v\" must have at least one active model, zero defined", c.ID)
}

if len(models) == 1 {
tel.Logger.Warn(
"router has only one active model defined. "+
Expand Down

0 comments on commit 431bd96

Please sign in to comment.