microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.AI/BaseChatPlugin.cs
44lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.AI.Messages; |
| 5 | using Microsoft.Teams.AI.Prompts; |
| 6 | |
| 7 | namespace Microsoft.Teams.AI; |
| 8 | |
| 9 | /// <summary> |
| 10 | /// A base implementation of <see cref="IChatPlugin"/> with no-op methods. |
| 11 | /// </summary> |
| 12 | [Obsolete("Microsoft.Teams.AI is deprecated and will be removed by end of summer 2026.")] |
| 13 | public abstract class BaseChatPlugin : IChatPlugin |
| 14 | { |
| 15 | public virtual Task<IMessage> OnBeforeSend<TOptions>(IChatPrompt<TOptions> prompt, IMessage message, TOptions? options = default, CancellationToken cancellationToken = default) |
| 16 | { |
| 17 | return Task.FromResult(message); |
| 18 | } |
| 19 | |
| 20 | public virtual Task<IMessage> OnAfterSend<TOptions>(IChatPrompt<TOptions> prompt, IMessage message, TOptions? options = default, CancellationToken cancellationToken = default) |
| 21 | { |
| 22 | return Task.FromResult(message); |
| 23 | } |
| 24 | |
| 25 | public virtual Task<FunctionCall> OnBeforeFunctionCall<TOptions>(IChatPrompt<TOptions> prompt, IFunction function, FunctionCall call, CancellationToken cancellationToken = default) |
| 26 | { |
| 27 | return Task.FromResult(call); |
| 28 | } |
| 29 | |
| 30 | public virtual Task<object?> OnAfterFunctionCall<TOptions>(IChatPrompt<TOptions> prompt, IFunction function, FunctionCall call, object? output, CancellationToken cancellationToken = default) |
| 31 | { |
| 32 | return Task.FromResult(output); |
| 33 | } |
| 34 | |
| 35 | public virtual Task<FunctionCollection> OnBuildFunctions<TOptions>(IChatPrompt<TOptions> prompt, FunctionCollection functions, CancellationToken cancellationToken = default) |
| 36 | { |
| 37 | return Task.FromResult(functions); |
| 38 | } |
| 39 | |
| 40 | public virtual Task<DeveloperMessage?> OnBuildInstructions<TOptions>(IChatPrompt<TOptions> prompt, DeveloperMessage? instructions, CancellationToken cancellationToken = default) |
| 41 | { |
| 42 | return Task.FromResult(instructions); |
| 43 | } |
| 44 | } |