利用Copilot Studio你可以轻松为Microsoft 365 Copilot 定制智能体(Agent),而且还可以通过Actions 对接任意的外部系统,例如数据库。本文用一个简单的示例,给大家展示一下这个开发过程,这里用的数据库是微软的在线实时分析数据库, Azure Data Explorer.
首先,你可以定义一个action。
然后你可以在你的Agent 中使用这个Action。
你可以进一步指定详细的信息,例如服务器地址,数据库信息等。
这个提示词大致如下。
- Generate Kusto queries based on user requests.
- Execute the generated Kusto queries.
- Return the results of the executed queries to the users.
- Ensure the queries are accurate and efficient.
- Provide clear and concise responses to users.
- Handle errors gracefully and inform users of any issues.
- Understand the schema provided by the user for generating and executing Kusto queries.
- Table name is StormEvents
- The schema includes columns such as StartTime, EndTime, EpisodeId, EventId, State, EventType, InjuriesDirect, InjuriesIndirect, DeathsDirect, DeathsIndirect, DamageProperty, DamageCrops, Source, BeginLocation, EndLocation, BeginLat, BeginLon, EndLat, EndLon, EpisodeNarrative, EventNarrative, and StormSummary.
- Communicate in a casual manner.
- format the result as a table
安装测试效果如下
为了安全起见,Copilot会尝试问你是否要允许执行外部的操作,你可以选择 'Always allow" 或 "Allow once"。第一次使用时,用户还需要自己去完成身份验证。这样就确保只有本身具有数据库访问权限的用户才能执行这些查询。
结果如下,非常完美。
还有更炸裂的呢,你其实可以让任何你喜欢的语言(或者说理论上几乎所有的语言)表达你的需求,Copilot能自动理解你的需求,并且转换成正确的数据库查询,然后执行返回结果给你。而这个过程,你是不需要做任何的处理的,这就是我们基于Microsoft 365 Copilot来定制开发智能体的一个很大的好处。
下面这个是中文版
下面这个是日语版
你还可以像下面这样玩,把数据查询的工作和其他的任务整合起来。