- Introduced a new search configuration structure, allowing for detailed settings for web, knowledge base, database, citation, and weights. - Updated the `Assistant` model to include a `Search` field, enabling assistant-specific search configurations. - Enhanced the loading and merging logic for search configurations, ensuring global defaults can be overridden by assistant-specific settings. - Added comprehensive tests for loading, saving, and updating assistants with search configurations, verifying the integrity of search settings. - Updated documentation in DESIGN.md to reflect the new search configuration hierarchy and usage, clarifying the interaction between global and assistant-level settings.
63 lines
1.2 KiB
Go
63 lines
1.2 KiB
Go
package defaults
|
|
|
|
import "github.com/yaoapp/yao/agent/search/types"
|
|
|
|
// SystemDefaults provides hardcoded default values
|
|
// Used by agent/load.go for merging with agent/search.yao
|
|
var SystemDefaults = &types.Config{
|
|
// Web search defaults
|
|
Web: &types.WebConfig{
|
|
Provider: "tavily",
|
|
MaxResults: 10,
|
|
},
|
|
|
|
// KB search defaults
|
|
KB: &types.KBConfig{
|
|
Threshold: 0.7,
|
|
Graph: false,
|
|
},
|
|
|
|
// DB search defaults
|
|
DB: &types.DBConfig{
|
|
MaxResults: 20,
|
|
},
|
|
|
|
// Keyword extraction options (uses.keyword)
|
|
Keyword: &types.KeywordConfig{
|
|
MaxKeywords: 10,
|
|
Language: "auto",
|
|
},
|
|
|
|
// QueryDSL generation options (uses.querydsl)
|
|
QueryDSL: &types.QueryDSLConfig{
|
|
Strict: false,
|
|
},
|
|
|
|
// Rerank options (uses.rerank)
|
|
Rerank: &types.RerankConfig{
|
|
TopN: 10,
|
|
},
|
|
|
|
// Citation
|
|
Citation: &types.CitationConfig{
|
|
Format: "#ref:{id}",
|
|
AutoInjectPrompt: true,
|
|
},
|
|
|
|
// Source weights
|
|
Weights: &types.WeightsConfig{
|
|
User: 1.0,
|
|
Hook: 0.8,
|
|
Auto: 0.6,
|
|
},
|
|
|
|
// Behavior options
|
|
Options: &types.OptionsConfig{
|
|
SkipThreshold: 5,
|
|
},
|
|
}
|
|
|
|
// GetWeight returns the weight for a source type using default config
|
|
func GetWeight(source types.SourceType) float64 {
|
|
return SystemDefaults.GetWeight(source)
|
|
}
|