x: disable web search tool registration (#13656)

This commit is contained in:
Parth Sareen
2026-01-09 01:42:20 -08:00
committed by GitHub
parent 33ee7168ba
commit a23b559b4c
2 changed files with 8 additions and 22 deletions

View File

@@ -94,9 +94,10 @@ func (r *Registry) Count() int {
// - OLLAMA_AGENT_DISABLE_BASH=1 disables bash
func DefaultRegistry() *Registry {
r := NewRegistry()
if os.Getenv("OLLAMA_AGENT_DISABLE_WEBSEARCH") == "" {
r.Register(&WebSearchTool{})
}
// TODO(parthsareen): re-enable web search once it's ready for release
// if os.Getenv("OLLAMA_AGENT_DISABLE_WEBSEARCH") == "" {
// r.Register(&WebSearchTool{})
// }
if os.Getenv("OLLAMA_AGENT_DISABLE_BASH") == "" {
r.Register(&BashTool{})
}

View File

@@ -93,19 +93,14 @@ func TestRegistry_Execute(t *testing.T) {
func TestDefaultRegistry(t *testing.T) {
r := DefaultRegistry()
if r.Count() != 2 {
t.Errorf("expected 2 tools in default registry, got %d", r.Count())
if r.Count() != 1 {
t.Errorf("expected 1 tool in default registry, got %d", r.Count())
}
_, ok := r.Get("bash")
if !ok {
t.Error("expected bash tool in default registry")
}
_, ok = r.Get("web_search")
if !ok {
t.Error("expected web_search tool in default registry")
}
}
func TestDefaultRegistry_DisableWebsearch(t *testing.T) {
@@ -133,18 +128,8 @@ func TestDefaultRegistry_DisableBash(t *testing.T) {
r := DefaultRegistry()
if r.Count() != 1 {
t.Errorf("expected 1 tool with bash disabled, got %d", r.Count())
}
_, ok := r.Get("web_search")
if !ok {
t.Error("expected web_search tool in registry")
}
_, ok = r.Get("bash")
if ok {
t.Error("expected bash to be disabled")
if r.Count() != 0 {
t.Errorf("expected 0 tools with bash disabled, got %d", r.Count())
}
}