Skip to content

Commit

Permalink
fix: don't include tools for empty knowledge sets
Browse files Browse the repository at this point in the history
Signed-off-by: Donnie Adams <[email protected]>
  • Loading branch information
thedadams committed Oct 22, 2024
1 parent 5e4d6d5 commit 27e8163
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/controller/handlers/knowledgeset/knowledgeset.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (h *Handler) GenerateDataDescription(req router.Request, resp router.Respon
}

if len(files.Items) == 0 {
ks.Status.IsEmpty = true
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func addKnowledgeTools(ctx context.Context, db kclient.Client, agent *v1.Agent,
dataDescription = ks.Status.SuggestedDataDescription
}

if dataDescription == "" {
if ks.Status.IsEmpty || dataDescription == "" {
continue
}

Expand Down
1 change: 1 addition & 0 deletions pkg/storage/apis/otto.gptscript.ai/v1/knowledgeset.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type KnowledgeSetStatus struct {
ObservedIngestionGeneration int64 `json:"observedIngestionGeneration,omitempty"`
SuggestedDataDescription string `json:"suggestedDataDescription,omitempty"`
WorkspaceName string `json:"workspaceName,omitempty"`
IsEmpty bool `json:"isEmpty,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
6 changes: 6 additions & 0 deletions pkg/storage/openapi/generated/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 27e8163

Please sign in to comment.