Merge branch 'Revised-search-mechanism' of https://github.com/trungtt6/picoclaw into Revised-search-mechanism
This commit is contained in:
commit
6a08310ce1
1 changed files with 12 additions and 3 deletions
|
|
@ -306,7 +306,7 @@ type WebSearchTool struct {
|
||||||
//
|
//
|
||||||
// If Provider is set, it's considered enabled. Use empty Provider to disable.
|
// If Provider is set, it's considered enabled. Use empty Provider to disable.
|
||||||
// BaseURL is generic and works for any provider (e.g., custom Ollama instances).
|
// BaseURL is generic and works for any provider (e.g., custom Ollama instances).
|
||||||
// Model is not needed for web search - results are translated by the main LLM.
|
// Search results are returned as raw text/JSON for the main LLM or agent to process.
|
||||||
//
|
//
|
||||||
// Usage example:
|
// Usage example:
|
||||||
//
|
//
|
||||||
|
|
@ -327,8 +327,17 @@ type WebSearchToolOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWebSearchTool(opts ...WebSearchToolOptions) *WebSearchTool {
|
func NewWebSearchTool(opts ...WebSearchToolOptions) *WebSearchTool {
|
||||||
// Priority order: Brave > Ollama > Perplexity > DuckDuckGo
|
// If no options are provided, default to DuckDuckGo with 5 results.
|
||||||
priorityOrder := []string{"brave", "ollama", "perplexity", "duckduckgo"}
|
if len(opts) == 0 {
|
||||||
|
opts = []WebSearchToolOptions{
|
||||||
|
{
|
||||||
|
Provider: "duckduckgo",
|
||||||
|
MaxResults: 5,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Priority order: Brave > Ollama > DuckDuckGo
|
||||||
|
priorityOrder := []string{"brave", "ollama", "duckduckgo"}
|
||||||
optMap := make(map[string]WebSearchToolOptions)
|
optMap := make(map[string]WebSearchToolOptions)
|
||||||
|
|
||||||
// Build map of enabled providers
|
// Build map of enabled providers
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue