Skip to content

Commit

Permalink
Add 'enabled' setting to vector settings to globally enable/disable v…
Browse files Browse the repository at this point in the history
…ector services
  • Loading branch information
sd2k committed Sep 14, 2023
1 parent 8e6985b commit bbfa61c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
16 changes: 10 additions & 6 deletions pkg/plugin/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@ func NewApp(appSettings backend.AppInstanceSettings) (instancemgmt.Instance, err
settings := loadSettings(appSettings)
var err error

log.DefaultLogger.Debug("Creating vector service")
app.vectorService, err = vector.NewService(settings.Vector, appSettings.DecryptedSecureJSONData)
if err != nil {
log.DefaultLogger.Error("Error creating vector service", "err", err)
return nil, err
if settings.Vector.Enabled {
log.DefaultLogger.Debug("Creating vector service")
app.vectorService, err = vector.NewService(
settings.Vector,
appSettings.DecryptedSecureJSONData,
)
if err != nil {
log.DefaultLogger.Error("Error creating vector service", "err", err)
return nil, err
}
}

log.DefaultLogger.Debug("App instance created")
return &app, nil
}

Expand Down
7 changes: 4 additions & 3 deletions pkg/plugin/vector/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ type Service interface {
}

type VectorSettings struct {
Model string `json:"model"`
Embed embed.Settings `json:"embed"`
Store store.Settings `json:"store"`
Enabled bool `json:"enabled"`
Model string `json:"model"`
Embed embed.Settings `json:"embed"`
Store store.Settings `json:"store"`
}

type vectorService struct {
Expand Down
1 change: 1 addition & 0 deletions provisioning/plugins/grafana-llm-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apps:
- type: grafana-llm-app
jsonData:
vector:
enabled: true
model: text-embedding-ada-002
embed:
type: openai
Expand Down

0 comments on commit bbfa61c

Please sign in to comment.