| using System.Collections.Generic; |
| namespace OnDeviceAgent.AgentCore |
| { |
|
|
| public static class BuiltinToolFactory |
| { |
| public static IReadOnlyList<IAgentTool> AlwaysOnBuiltins(BuiltinToolDependencies deps) |
| { |
| var list = new List<IAgentTool> |
| { |
| new GetCurrentTimeTool(), |
| new GetWeatherTool(), |
| new WebSearchTool() |
| }; |
|
|
| if (deps != null && deps.VisionEnabled) |
| { |
| if (deps.Camera != null && deps.Yolo != null) |
| list.Add(new CountVisibleObjectsTool(deps.Camera, deps.Yolo)); |
| if (deps.Camera != null && deps.VisionAsk != null) |
| list.Add(new AnalyzeCurrentViewTool(deps.Camera, deps.VisionAsk)); |
| } |
|
|
| if (deps != null && deps.SetVoice != null) |
| list.Add(new SetVoiceTool(deps.SetVoice)); |
|
|
| if (deps != null && deps.SearchKnowledge != null) |
| list.Add(new SearchKnowledgeTool(deps.SearchKnowledge, deps.TranslateToEnglish, deps.OnToolNote, deps.KnowledgeSubject)); |
|
|
| return list; |
| } |
|
|
| public static void RegisterAll( |
| ToolRegistry registry, |
| bool enableBuiltins, |
| BuiltinToolDependencies deps) |
| { |
| if (registry == null) |
| throw new System.ArgumentNullException("registry"); |
|
|
| if (enableBuiltins) |
| { |
| foreach (var tool in AlwaysOnBuiltins(deps)) |
| registry.Register(tool); |
| } |
| } |
| } |
| } |
|
|