microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fix/msal-cache

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.AI/ChatPlugin.cs

71lines · 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>
13[Obsolete("Microsoft.Teams.AI is deprecated and will be removed by end of summer 2026.")]
14public interface IChatPlugin
15{
16 /// <summary>
17 /// called before a prompt sends
18 /// a message
19 /// </summary>
20 /// <param name="prompt">the prompt</param>
21 /// <param name="message">the message</param>
22 /// <param name="options">the model options</param>
23 /// <returns>the transformed message</returns>
24 public Task<IMessage> OnBeforeSend<TOptions>(IChatPrompt<TOptions> prompt, IMessage message, TOptions? options = default, CancellationToken cancellationToken = default);
25
26 /// <summary>
27 /// called after a prompt sends
28 /// a message
29 /// </summary>
30 /// <param name="prompt">the prompt</param>
31 /// <param name="message">the message</param>
32 /// <param name="options">the model options</param>
33 /// <returns>the transformed message</returns>
34 public Task<IMessage> OnAfterSend<TOptions>(IChatPrompt<TOptions> prompt, IMessage message, TOptions? options = default, CancellationToken cancellationToken = default);
35
36 /// <summary>
37 /// called before a prompt function is called
38 /// </summary>
39 /// <param name="prompt">the prompt</param>
40 /// <param name="function">the function</param>
41 /// <param name="call">the function call</param>
42 /// <returns>the transformed call</returns>
43 public Task<FunctionCall> OnBeforeFunctionCall<TOptions>(IChatPrompt<TOptions> prompt, IFunction function, FunctionCall call, CancellationToken cancellationToken = default);
44
45 /// <summary>
46 /// called after a prompt function is called
47 /// </summary>
48 /// <param name="prompt">the prompt</param>
49 /// <param name="function">the function</param>
50 /// <param name="call">the function call</param>
51 /// <param name="output">the functions return value</param>
52 /// <returns>the transformed response</returns>
53 public Task<object?> OnAfterFunctionCall<TOptions>(IChatPrompt<TOptions> prompt, IFunction function, FunctionCall call, object? output, CancellationToken cancellationToken = default);
54
55 /// <summary>
56 /// Modify the prompt functions passed to the model.
57 /// </summary>
58 /// <param name="prompt">the prompt</param>
59 /// <param name="functions">a copy of the configured chat prompt functions</param>
60 /// <param name="cancellationToken">the cancellation token</param>
61 /// <returns>the transformed functions</returns>
62 public Task<FunctionCollection> OnBuildFunctions<TOptions>(IChatPrompt<TOptions> prompt, FunctionCollection functions, CancellationToken cancellationToken = default);
63
64 /// <summary>
65 /// Modify the prompt instructions passed to the model.
66 /// </summary>
67 /// <param name="prompt">the prompt</param>
68 /// <param name="instructions">the instructions</param>
69 /// <returns>the transformed instructions</returns>
70 public Task<DeveloperMessage?> OnBuildInstructions<TOptions>(IChatPrompt<TOptions> prompt, DeveloperMessage? instructions, CancellationToken cancellationToken = default);
71}