microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
8e11e5e231765b6fbeae91b4033a354e2340d0af

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.AI/ChatPlugin.cs

53lines · modecode

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