microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
ed542af71cd064dd9674c86645c24cec4e03bec6

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

Samples/Samples.Lights/LightsPrompt.cs

44lines · modecode

1using Microsoft.Teams.AI.Annotations;
2using Microsoft.Teams.Api.Activities;
3using Microsoft.Teams.Apps;
4
5namespace Samples.Lights;
6
7[Prompt]
8[Prompt.Description("manage light status")]
9[Prompt.Instructions(
10 "The following is a conversation with an AI assistant.",
11 "The assistant can turn the lights on or off.",
12 "The lights are currently off."
13)]
14public class LightsPrompt(IContext.Accessor accessor)
15{
16 private IContext<IActivity> context => accessor.Value!;
17
18 [Function]
19 [Function.Description("get the current light status")]
20 public bool GetLightStatus()
21 {
22 return State.From(context).Status;
23 }
24
25 [Function]
26 [Function.Description("turn the lights on")]
27 public string LightsOn()
28 {
29 var state = State.From(context);
30 state.Status = true;
31 state.Save(context);
32 return "the lights are now on";
33 }
34
35 [Function]
36 [Function.Description("turn the lights off")]
37 public string LightsOff()
38 {
39 var state = State.From(context);
40 state.Status = false;
41 state.Save(context);
42 return "the lights are now off";
43 }
44}