mirror of
https://github.com/ollama/ollama.git
synced 2026-03-11 17:34:04 -05:00
x: disable web search tool registration (#13656)
This commit is contained in:
@@ -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{})
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user