forked from SciSharp/BotSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAgentService.cs
More file actions
89 lines (68 loc) · 3.57 KB
/
IAgentService.cs
File metadata and controls
89 lines (68 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using BotSharp.Abstraction.Agents.Options;
using BotSharp.Abstraction.Coding.Models;
using BotSharp.Abstraction.Coding.Options;
using BotSharp.Abstraction.Functions.Models;
using BotSharp.Abstraction.Instructs.Enums;
using BotSharp.Abstraction.Plugins.Models;
using BotSharp.Abstraction.Repositories.Filters;
namespace BotSharp.Abstraction.Agents;
/// <summary>
/// Agent management service
/// </summary>
public interface IAgentService
{
Task<Agent> CreateAgent(Agent agent);
Task<string> RefreshAgents(IEnumerable<string>? agentIds = null);
Task<PagedItems<Agent>> GetAgents(AgentFilter filter);
Task<List<IdName>> GetAgentOptions(List<string>? agentIds = null, bool byName = false);
Task<IEnumerable<AgentUtility>> GetAgentUtilityOptions();
/// <summary>
/// Load agent configurations and trigger hooks
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<Agent> LoadAgent(string id, bool loadUtility = true);
/// <summary>
/// Inherit from an agent
/// </summary>
/// <param name="agent"></param>
/// <returns></returns>
Task InheritAgent(Agent agent);
string RenderInstruction(Agent agent, IDictionary<string, object>? renderData = null);
string RenderTemplate(Agent agent, string templateName, IDictionary<string, object>? renderData = null);
bool RenderFunction(Agent agent, FunctionDef def, IDictionary<string, object>? renderData = null);
FunctionParametersDef? RenderFunctionProperty(Agent agent, FunctionDef def, IDictionary<string, object>? renderData = null);
(string, IEnumerable<FunctionDef>) PrepareInstructionAndFunctions(Agent agent, IDictionary<string, object>? renderData = null, StringComparer? comparer = null);
bool RenderVisibility(string? visibilityExpression, IDictionary<string, object> dict);
IDictionary<string, object> CollectRenderData(Agent agent);
/// <summary>
/// Get agent detail without trigger any hook.
/// </summary>
/// <param name="id"></param>
/// <returns>Original agent information</returns>
Task<Agent> GetAgent(string id);
Task<AgentTemplate?> GetAgentTemplateDetail(string agentId, string templateName);
Task<bool> DeleteAgent(string id, AgentDeleteOptions? options = null);
Task UpdateAgent(Agent agent, AgentField updateField);
/// <summary>
/// Path existing templates of agent, cannot create new or delete templates
/// </summary>
/// <param name="agent"></param>
/// <returns></returns>
Task<string> PatchAgentTemplate(Agent agent);
string GetDataDir();
string GetAgentDataDir(string agentId);
Task<List<UserAgent>> GetUserAgents(string userId);
Task<PluginDef> GetPlugin(string agentId);
Task<List<AgentCodeScript>> GetAgentCodeScripts(string agentId, AgentCodeScriptFilter? filter = null)
=> Task.FromResult(new List<AgentCodeScript>());
Task<AgentCodeScript?> GetAgentCodeScript(string agentId, string scriptName, string scriptType = AgentCodeScriptType.Src)
=> Task.FromResult((AgentCodeScript?)null);
Task<bool> UpdateAgentCodeScripts(string agentId, List<AgentCodeScript> codeScripts, AgentCodeScriptUpdateOptions? options = null)
=> Task.FromResult(false);
Task<bool> DeleteAgentCodeScripts(string agentId, List<AgentCodeScript>? codeScripts = null)
=> Task.FromResult(false);
Task<CodeGenerationResult> GenerateCodeScript(string agentId, string text, CodeGenHandleOptions? options = null)
=> Task.FromResult(new CodeGenerationResult());
ResponseFormatType GetTemplateResponseFormat(Agent agent, string templateName);
}