-
Notifications
You must be signed in to change notification settings - Fork 265
feat: allow to adjust knowledgebase usage #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,7 @@ type options struct { | |||||
| jobFilters types.JobFilters | ||||||
| enableHUD, standaloneJob, showCharacter, enableKB, enableSummaryMemory, enableLongTermMemory bool | ||||||
| stripThinkingTags bool | ||||||
| kbAutoSearch bool | ||||||
|
||||||
| kbAutoSearch bool | |
| kbAutoSearch bool |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -565,6 +565,24 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig, obs O | |||||||||
| summarize := config.KBCompactionSummarize | ||||||||||
| opts = append(opts, EnableKBCompaction, WithKBCompactionInterval(interval), WithKBCompactionSummarize(summarize)) | ||||||||||
| } | ||||||||||
| // Set KB auto search option (defaults to true for backward compatibility) | ||||||||||
| // For backward compatibility: if both new KB fields are false (zero values), | ||||||||||
| // assume this is an old config and default KBAutoSearch to true | ||||||||||
| kbAutoSearch := config.KBAutoSearch | ||||||||||
| if !config.KBAutoSearch && !config.KBAsTools { | ||||||||||
| // Both new fields are false, likely an old config - default to true for backward compatibility | ||||||||||
| kbAutoSearch = true | ||||||||||
| } | ||||||||||
| opts = append(opts, WithKBAutoSearch(kbAutoSearch)) | ||||||||||
|
Comment on lines
+568
to
+576
|
||||||||||
| // Inject KB wrapper actions if enabled | ||||||||||
| if config.KBAsTools && ragClient != nil { | ||||||||||
| kbResults := config.KnowledgeBaseResults | ||||||||||
| if kbResults <= 0 { | ||||||||||
| kbResults = 5 // Default | ||||||||||
| } | ||||||||||
| searchAction, addAction := NewKBWrapperActions(ragClient, kbResults) | ||||||||||
| actions = append(actions, searchAction, addAction) | ||||||||||
|
||||||||||
| actions = append(actions, searchAction, addAction) | |
| actions = append(actions, searchAction, addAction) | |
| // Re-apply actions option so the updated slice (with KB tools) is used | |
| opts = append(opts, WithActions(actions...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kbAutoSearchchanges the observable behavior of the agent (KB recall is now skipped when disabled), but there are no tests covering this new branch. Sincecore/agentalready has a test suite, please add unit tests asserting thatknowledgeBaseLookupdoes not call intoragdb.SearchwhenkbAutoSearchis false (and does when true).