microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/close-pull-request

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.AI/Prompts/ChatPrompt/ChatPrompt.Chain.cs

32lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4using Json.Schema;
5
6namespace Microsoft.Teams.AI.Prompts;
7
8public partial class ChatPrompt<TOptions>
9{
10 /// <summary>
11 /// provide another chat prompt to be used
12 /// as a function
13 /// </summary>
14 /// <param name="prompt">the chat prompt</param>
15 public ChatPrompt<TOptions> Chain(IChatPrompt<TOptions> prompt)
16 {
17 Functions.Add(new Function(
18 prompt.Name,
19 prompt.Description,
20 new JsonSchemaBuilder().Properties(
21 ("text", new JsonSchemaBuilder().Type(SchemaValueType.String).Description("text to send"))
22 ),
23 async (string text) =>
24 {
25 var res = await prompt.Send(text);
26 return res.Content;
27 }
28 ));
29
30 return this;
31 }
32}