microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
a520ba785be4e788a9153949bfbc866a3ee0ae81

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.AI/ChatPlugin.cs

50lines · modecode

1using Microsoft.Teams.AI.Messages;
2using Microsoft.Teams.AI.Prompts;
3
4namespace Microsoft.Teams.AI;
5
6/// <summary>
7/// a component that can change the
8/// way a ChatPrompt works
9/// </summary>
10public interface IChatPlugin : IPlugin
11{
12 /// <summary>
13 /// called before a prompt sends
14 /// a message
15 /// </summary>
16 /// <param name="prompt">the prompt</param>
17 /// <param name="message">the message</param>
18 /// <param name="options">the model options</param>
19 /// <returns>the transformed message</returns>
20 public Task<IMessage> OnBeforeSend<TOptions>(IChatPrompt<TOptions> prompt, IMessage message, TOptions? options = default, CancellationToken cancellationToken = default);
21
22 /// <summary>
23 /// called after a prompt sends
24 /// a message
25 /// </summary>
26 /// <param name="prompt">the prompt</param>
27 /// <param name="message">the message</param>
28 /// <param name="options">the model options</param>
29 /// <returns>the transformed message</returns>
30 public Task<IMessage> OnAfterSend<TOptions>(IChatPrompt<TOptions> prompt, IMessage message, TOptions? options = default, CancellationToken cancellationToken = default);
31
32 /// <summary>
33 /// called before a prompt function is called
34 /// </summary>
35 /// <param name="prompt">the prompt</param>
36 /// <param name="function">the function</param>
37 /// <param name="call">the function call</param>
38 /// <returns>the transformed call</returns>
39 public Task<FunctionCall> OnBeforeFunctionCall<TOptions>(IChatPrompt<TOptions> prompt, IFunction function, FunctionCall call, CancellationToken cancellationToken = default);
40
41 /// <summary>
42 /// called after a prompt function is called
43 /// </summary>
44 /// <param name="prompt">the prompt</param>
45 /// <param name="function">the function</param>
46 /// <param name="call">the function call</param>
47 /// <param name="output">the functions return value</param>
48 /// <returns>the transformed response</returns>
49 public Task<object?> OnAfterFunctionCall<TOptions>(IChatPrompt<TOptions> prompt, IFunction function, FunctionCall call, object? output, CancellationToken cancellationToken = default);
50}