@@ -68,7 +68,7 @@ Collect messages from multiple sources into a single target:
6868::: zone pivot="programming-language-csharp"
6969
7070``` csharp
71- builder .AddFanInBarrierEdge (sources : [worker1 , worker2 , worker3 ], target : aggregatorExecutor );
71+ builder .AddFanInBarrierEdge (sources : [ worker1 , worker2 , worker3 ], target : aggregatorExecutor );
7272```
7373
7474::: zone-end
@@ -210,10 +210,11 @@ using Microsoft.Extensions.AI;
210210/// </summary >
211211/// <returns >A ChatClientAgent configured for spam detection</returns >
212212private static ChatClientAgent GetSpamDetectionAgent (IChatClient chatClient ) =>
213- new (chatClient , new ChatClientAgentOptions ( instructions : " You are a spam detection assistant that identifies spam emails. " )
213+ new (chatClient , new ChatClientAgentOptions
214214 {
215215 ChatOptions = new ()
216216 {
217+ Instructions = " You are a spam detection assistant that identifies spam emails." ,
217218 ResponseFormat = ChatResponseFormat .ForJsonSchema (AIJsonUtilities .CreateJsonSchema (typeof (DetectionResult )))
218219 }
219220 });
@@ -223,10 +224,11 @@ private static ChatClientAgent GetSpamDetectionAgent(IChatClient chatClient) =>
223224/// </summary >
224225/// <returns >A ChatClientAgent configured for email assistance</returns >
225226private static ChatClientAgent GetEmailAssistantAgent (IChatClient chatClient ) =>
226- new (chatClient , new ChatClientAgentOptions ( instructions : " You are an email assistant that helps users draft professional responses to emails. " )
227+ new (chatClient , new ChatClientAgentOptions
227228 {
228229 ChatOptions = new ()
229230 {
231+ Instructions = " You are an email assistant that helps users draft professional responses to emails." ,
230232 ResponseFormat = ChatResponseFormat .ForJsonSchema (AIJsonUtilities .CreateJsonSchema (typeof (EmailResponse )))
231233 }
232234 });
@@ -378,7 +380,7 @@ public static class Program
378380
379381 // Execute the workflow with sample spam email
380382 string emailContent = " Congratulations! You've won $1,000,000! Click here to claim your prize now!" ;
381- StreamingRun run = await InProcessExecution .StreamAsync (workflow , new ChatMessage (ChatRole .User , emailContent ));
383+ StreamingRun run = await InProcessExecution .RunStreamingAsync (workflow , new ChatMessage (ChatRole .User , emailContent ));
382384 await run .TrySendMessageAsync (new TurnToken (emitEvents : true ));
383385
384386 await foreach (WorkflowEvent evt in run .WatchStreamAsync ().ConfigureAwait (false ))
@@ -815,10 +817,11 @@ Update the spam detection agent to be less confident and return three-way classi
815817/// </summary >
816818/// <returns >A ChatClientAgent configured for three-way spam detection</returns >
817819private static ChatClientAgent GetSpamDetectionAgent (IChatClient chatClient ) =>
818- new (chatClient , new ChatClientAgentOptions ( instructions : " You are a spam detection assistant that identifies spam emails. Be less confident in your assessments. " )
820+ new (chatClient , new ChatClientAgentOptions
819821 {
820822 ChatOptions = new ()
821823 {
824+ Instructions = " You are a spam detection assistant that identifies spam emails. Be less confident in your assessments." ,
822825 ResponseFormat = ChatResponseFormat .ForJsonSchema <DetectionResult >()
823826 }
824827 });
@@ -828,10 +831,11 @@ private static ChatClientAgent GetSpamDetectionAgent(IChatClient chatClient) =>
828831/// </summary >
829832/// <returns >A ChatClientAgent configured for email assistance</returns >
830833private static ChatClientAgent GetEmailAssistantAgent (IChatClient chatClient ) =>
831- new (chatClient , new ChatClientAgentOptions ( instructions : " You are an email assistant that helps users draft responses to emails with professionalism. " )
834+ new (chatClient , new ChatClientAgentOptions
832835 {
833836 ChatOptions = new ()
834837 {
838+ Instructions = " You are an email assistant that helps users draft responses to emails with professionalism." ,
835839 ResponseFormat = ChatResponseFormat .ForJsonSchema <EmailResponse >()
836840 }
837841 });
@@ -1015,7 +1019,7 @@ public static class Program
10151019 string email = Resources .Read (" ambiguous_email.txt" );
10161020
10171021 // Execute the workflow
1018- StreamingRun run = await InProcessExecution .StreamAsync (workflow , new ChatMessage (ChatRole .User , email ));
1022+ StreamingRun run = await InProcessExecution .RunStreamingAsync (workflow , new ChatMessage (ChatRole .User , email ));
10191023 await run .TrySendMessageAsync (new TurnToken (emitEvents : true ));
10201024 await foreach (WorkflowEvent evt in run .WatchStreamAsync ().ConfigureAwait (false ))
10211025 {
@@ -1677,10 +1681,11 @@ Create agents for analysis, assistance, and summarization:
16771681/// </summary >
16781682/// <returns >A ChatClientAgent configured for comprehensive email analysis</returns >
16791683private static ChatClientAgent GetEmailAnalysisAgent (IChatClient chatClient ) =>
1680- new (chatClient , new ChatClientAgentOptions ( instructions : " You are a spam detection assistant that identifies spam emails. " )
1684+ new (chatClient , new ChatClientAgentOptions
16811685 {
16821686 ChatOptions = new ()
16831687 {
1688+ Instructions = " You are a spam detection assistant that identifies spam emails." ,
16841689 ResponseFormat = ChatResponseFormat .ForJsonSchema <AnalysisResult >()
16851690 }
16861691 });
@@ -1690,10 +1695,11 @@ private static ChatClientAgent GetEmailAnalysisAgent(IChatClient chatClient) =>
16901695/// </summary >
16911696/// <returns >A ChatClientAgent configured for email assistance</returns >
16921697private static ChatClientAgent GetEmailAssistantAgent (IChatClient chatClient ) =>
1693- new (chatClient , new ChatClientAgentOptions ( instructions : " You are an email assistant that helps users draft responses to emails with professionalism. " )
1698+ new (chatClient , new ChatClientAgentOptions
16941699 {
16951700 ChatOptions = new ()
16961701 {
1702+ Instructions = " You are an email assistant that helps users draft responses to emails with professionalism." ,
16971703 ResponseFormat = ChatResponseFormat .ForJsonSchema <EmailResponse >()
16981704 }
16991705 });
@@ -1703,10 +1709,11 @@ private static ChatClientAgent GetEmailAssistantAgent(IChatClient chatClient) =>
17031709/// </summary >
17041710/// <returns >A ChatClientAgent configured for email summarization</returns >
17051711private static ChatClientAgent GetEmailSummaryAgent (IChatClient chatClient ) =>
1706- new (chatClient , new ChatClientAgentOptions ( instructions : " You are an assistant that helps users summarize emails. " )
1712+ new (chatClient , new ChatClientAgentOptions
17071713 {
17081714 ChatOptions = new ()
17091715 {
1716+ Instructions = " You are an assistant that helps users summarize emails." ,
17101717 ResponseFormat = ChatResponseFormat .ForJsonSchema <EmailSummary >()
17111718 }
17121719 });
@@ -1773,7 +1780,7 @@ public static class Program
17731780 string email = Resources .Read (" email.txt" );
17741781
17751782 // Execute the workflow with custom event handling
1776- StreamingRun run = await InProcessExecution .StreamAsync (workflow , new ChatMessage (ChatRole .User , email ));
1783+ StreamingRun run = await InProcessExecution .RunStreamingAsync (workflow , new ChatMessage (ChatRole .User , email ));
17771784 await run .TrySendMessageAsync (new TurnToken (emitEvents : true ));
17781785 await foreach (WorkflowEvent evt in run .WatchStreamAsync ().ConfigureAwait (false ))
17791786 {
0 commit comments