From 2fe1e454fbfb8fec6967091f9672a09ee8f4b613 Mon Sep 17 00:00:00 2001 From: lindexi Date: Mon, 19 Jan 2026 14:41:00 +0800 Subject: [PATCH] Fix sample code compile As the https://github.com/microsoft/agent-framework/pull/1517 changed, the `ChatClientAgentOptions` remove the `Instructions` property and it will use the `ChatOptions.Instructions` property. So that we should set the `ChatOptions.Instructions` property --- agent-framework/tutorials/agents/structured-output.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/agent-framework/tutorials/agents/structured-output.md b/agent-framework/tutorials/agents/structured-output.md index e6b262ec8..5fe261105 100644 --- a/agent-framework/tutorials/agents/structured-output.md +++ b/agent-framework/tutorials/agents/structured-output.md @@ -65,7 +65,8 @@ ChatOptions chatOptions = new() ResponseFormat = ChatResponseFormat.ForJsonSchema( schema: schema, schemaName: "PersonInfo", - schemaDescription: "Information about a person including their name, age, and occupation") + schemaDescription: "Information about a person including their name, age, and occupation"), + Instructions = "You are a helpful assistant.", }; ``` @@ -76,16 +77,16 @@ using System; using Azure.AI.OpenAI; using Azure.Identity; using Microsoft.Agents.AI; -using OpenAI; +using Microsoft.Extensions.AI; AIAgent agent = new AzureOpenAIClient( new Uri("https://.openai.azure.com"), new AzureCliCredential()) .GetChatClient("gpt-4o-mini") + .AsIChatClient() .CreateAIAgent(new ChatClientAgentOptions() { Name = "HelpfulAssistant", - Instructions = "You are a helpful assistant.", ChatOptions = chatOptions }); ```