Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/upgrades/prompts/SemanticKernelToAgentFramework.md
Original file line number Diff line number Diff line change
Expand Up @@ -870,20 +870,16 @@ var agentOptions = new ChatClientAgentRunOptions(new ChatOptions
{
MaxOutputTokens = 8000,
// Breaking glass to access provider-specific options
RawRepresentationFactory = (_) => new OpenAI.Responses.ResponseCreationOptions()
RawRepresentationFactory = (_) => new OpenAI.Responses.CreateResponseOptions()
{
ReasoningOptions = new()
{
ReasoningEffortLevel = OpenAI.Responses.ResponseReasoningEffortLevel.High,
ReasoningSummaryVerbosity = OpenAI.Responses.ResponseReasoningSummaryVerbosity.Detailed
}
TruncationMode = OpenAI.Responses.ResponseTruncationMode.Auto,
}
});
```

**Use this pattern when:**
1. Standard `ChatOptions` properties don't cover required model settings
2. Provider-specific configuration is needed (e.g., reasoning effort level)
2. Provider-specific configuration is needed (e.g., truncation mode)
3. Advanced SDK features need to be accessed
</configuration_changes>

Expand Down
22 changes: 11 additions & 11 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageVersion Include="AWSSDK.SecurityToken" Version="4.0.5.6" />
<PackageVersion Include="Azure.AI.Agents.Persistent" Version="1.1.0" />
<PackageVersion Include="Azure.AI.ContentSafety" Version="1.0.0" />
<PackageVersion Include="Azure.AI.OpenAI" Version="2.7.0-beta.2" />
<PackageVersion Include="Azure.AI.OpenAI" Version="2.8.0-beta.1" />
<PackageVersion Include="Azure.AI.Projects" Version="1.1.0" />
<PackageVersion Include="Azure.Identity" Version="1.17.1" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.5.0" />
Expand Down Expand Up @@ -65,7 +65,7 @@
<PackageVersion Include="Microsoft.Azure.Kusto.Data" Version="12.2.8" />
<PackageVersion Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="1.5.1" />
<PackageVersion Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.3.2" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.2" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.3" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageVersion Include="Microsoft.Bcl.Memory" Version="10.0.2" />
<PackageVersion Include="Microsoft.Bcl.Numerics" Version="10.0.2" />
Expand All @@ -92,7 +92,7 @@
<PackageVersion Include="Npgsql" Version="8.0.7" />
<PackageVersion Include="OData2Linq" Version="2.2.0" />
<PackageVersion Include="OllamaSharp" Version="5.4.12" />
<PackageVersion Include="OpenAI" Version="2.7.0" />
<PackageVersion Include="OpenAI" Version="2.8.0" />
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.14.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
Expand All @@ -109,8 +109,8 @@
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.2" />
<PackageVersion Include="System.Memory.Data" Version="10.0.2" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.2" />
<PackageVersion Include="System.Text.Json" Version="10.0.2" />
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.3" />
<PackageVersion Include="System.Text.Json" Version="10.0.3" />
<PackageVersion Include="System.ValueTuple" Version="4.6.1" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
<PackageVersion Include="A2A" Version="0.3.1-preview" />
Expand All @@ -119,10 +119,10 @@
<!-- Tokenizers -->
<PackageVersion Include="Microsoft.ML.Tokenizers" Version="2.0.0" />
<!-- Microsoft.Extensions.* -->
<PackageVersion Include="Microsoft.Extensions.AI" Version="10.2.0" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="10.2.0" />
<PackageVersion Include="Microsoft.Extensions.AI" Version="10.3.0" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="10.3.0" />
<PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="10.0.0-preview.1.25559.3" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="10.0.1-preview.1.25571.5" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="10.3.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.2" />
Expand All @@ -131,14 +131,14 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.2.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="10.2.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="10.0.2" />
Expand All @@ -151,7 +151,7 @@
<PackageVersion Include="Moq" Version="[4.18.4]" />
<PackageVersion Include="FluentAssertions" Version="8.2.0" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="System.Threading.Channels" Version="10.0.2" />
<PackageVersion Include="System.Threading.Channels" Version="10.0.3" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="10.0.2" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async Task SKAgentAsync()
Console.WriteLine("\n=== SK Agent ===\n");

var responseClient = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName);
.GetResponsesClient(deploymentName);
OpenAIResponseAgent agent = new(responseClient)
{
Name = "Joker",
Expand Down Expand Up @@ -54,7 +54,7 @@ async Task SKAgent_As_AFAgentAsync()
Console.WriteLine("\n=== SK Agent Converted as an AF Agent ===\n");

var responseClient = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName);
.GetResponsesClient(deploymentName);

OpenAIResponseAgent skAgent = new(responseClient)
{
Expand Down Expand Up @@ -83,7 +83,7 @@ async Task AFAgentAsync()
Console.WriteLine("\n=== AF Agent ===\n");

var agent = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName)
.GetResponsesClient(deploymentName)
.CreateAIAgent(name: "Joker", instructions: "You are good at telling jokes.");

var thread = agent.GetNewThread();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async Task SKAgentAsync()
Console.WriteLine("\n=== SK Agent ===\n");

var responseClient = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName);
.GetResponsesClient(deploymentName);
OpenAIResponseAgent agent = new(responseClient)
{
Name = "Thinker",
Expand Down Expand Up @@ -119,7 +119,7 @@ async Task SKAgent_As_AFAgentAsync()
Console.WriteLine("\n=== SK Agent Converted as an AF Agent ===\n");

var responseClient = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName);
.GetResponsesClient(deploymentName);

#pragma warning disable SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

Expand All @@ -138,15 +138,10 @@ async Task SKAgent_As_AFAgentAsync()
var agentOptions = new ChatClientAgentRunOptions(new()
{
MaxOutputTokens = 8000,
// Microsoft.Extensions.AI currently does not have an abstraction for reasoning-effort,
// we need to break glass using the RawRepresentationFactory.
RawRepresentationFactory = (_) => new OpenAI.Responses.ResponseCreationOptions()
Reasoning = new()
{
ReasoningOptions = new()
{
ReasoningEffortLevel = OpenAI.Responses.ResponseReasoningEffortLevel.High,
ReasoningSummaryVerbosity = OpenAI.Responses.ResponseReasoningSummaryVerbosity.Detailed
}
Effort = ReasoningEffort.High,
Output = ReasoningOutput.Full
}
});

Expand Down Expand Up @@ -185,22 +180,17 @@ async Task AFAgentAsync()
Console.WriteLine("\n=== AF Agent ===\n");

var agent = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName)
.GetResponsesClient(deploymentName)
.CreateAIAgent(name: "Thinker", instructions: "You are good at thinking hard before answering.");

var thread = agent.GetNewThread();
var agentOptions = new ChatClientAgentRunOptions(new()
{
MaxOutputTokens = 8000,
// Microsoft.Extensions.AI currently does not have an abstraction for reasoning-effort,
// we need to break glass using the RawRepresentationFactory.
RawRepresentationFactory = (_) => new OpenAI.Responses.ResponseCreationOptions()
Reasoning = new()
{
ReasoningOptions = new()
{
ReasoningEffortLevel = OpenAI.Responses.ResponseReasoningEffortLevel.High,
ReasoningSummaryVerbosity = OpenAI.Responses.ResponseReasoningSummaryVerbosity.Detailed
}
Effort = ReasoningEffort.High,
Output = ReasoningOutput.Full
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static string GetWeather([Description("The location to get the weather for.")] s
async Task SKAgentAsync()
{
OpenAIResponseAgent agent = new(new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName))
.GetResponsesClient(deploymentName))
{ StoreEnabled = true };

// Initialize plugin and add to the agent's Kernel (same as direct Kernel usage).
Expand All @@ -49,7 +49,7 @@ async Task SKAgentAsync()
async Task SKAgent_As_AFAgentAsync()
{
OpenAIResponseAgent skAgent = new(new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName))
.GetResponsesClient(deploymentName))
{ StoreEnabled = true };

// Initialize plugin and add to the agent's Kernel (same as direct Kernel usage).
Expand All @@ -66,7 +66,7 @@ async Task SKAgent_As_AFAgentAsync()
async Task AFAgentAsync()
{
var agent = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName)
.GetResponsesClient(deploymentName)
.CreateAIAgent(instructions: "You are a helpful assistant", tools: [AIFunctionFactory.Create(GetWeather)]);

Console.WriteLine("\n=== AF Agent Response ===\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async Task SKAgentAsync()
var serviceCollection = new ServiceCollection();
serviceCollection.AddTransient<Microsoft.SemanticKernel.Agents.Agent>((sp)
=> new OpenAIResponseAgent(new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName))
.GetResponsesClient(deploymentName))
{
Name = "Joker",
Instructions = "You are good at telling jokes.",
Expand All @@ -49,7 +49,7 @@ async Task SKAgent_As_AFAgentAsync()
var serviceCollection = new ServiceCollection();
serviceCollection.AddTransient<Microsoft.SemanticKernel.Agents.Agent>((sp)
=> new OpenAIResponseAgent(new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName))
.GetResponsesClient(deploymentName))
{
Name = "Joker",
Instructions = "You are good at telling jokes.",
Expand All @@ -71,7 +71,7 @@ async Task AFAgentAsync()

var serviceCollection = new ServiceCollection();
serviceCollection.AddTransient<AIAgent>((sp) => new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName)
.GetResponsesClient(deploymentName)
.CreateAIAgent(name: "Joker", instructions: "You are good at telling jokes."));

await using ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async Task SKAgentAsync()
{
Console.WriteLine("\n=== SK Agent ===\n");

var responseClient = new OpenAIClient(apiKey).GetOpenAIResponseClient(model);
var responseClient = new OpenAIClient(apiKey).GetResponsesClient(model);
OpenAIResponseAgent agent = new(responseClient)
{
Name = "Joker",
Expand Down Expand Up @@ -51,7 +51,7 @@ async Task SKAgent_As_AFAgentAsync()
{
Console.WriteLine("\n=== SK Agent Converted as an AF Agent ===\n");

var responseClient = new OpenAIClient(apiKey).GetOpenAIResponseClient(model);
var responseClient = new OpenAIClient(apiKey).GetResponsesClient(model);

OpenAIResponseAgent skAgent = new(responseClient)
{
Expand Down Expand Up @@ -79,7 +79,7 @@ async Task AFAgentAsync()
{
Console.WriteLine("\n=== AF Agent ===\n");

var agent = new OpenAIClient(apiKey).GetOpenAIResponseClient(model)
var agent = new OpenAIClient(apiKey).GetResponsesClient(model)
.CreateAIAgent(name: "Joker", instructions: "You are good at telling jokes.");

var thread = agent.GetNewThread();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async Task SKAgentAsync()
{
Console.WriteLine("\n=== SK Agent ===\n");

var responseClient = new OpenAIClient(apiKey).GetOpenAIResponseClient(model);
var responseClient = new OpenAIClient(apiKey).GetResponsesClient(model);
OpenAIResponseAgent agent = new(responseClient)
{
Name = "Thinker",
Expand Down Expand Up @@ -116,7 +116,7 @@ async Task SKAgent_As_AFAgentAsync()
{
Console.WriteLine("\n=== SK Agent Converted as an AF Agent ===\n");

var responseClient = new OpenAIClient(apiKey).GetOpenAIResponseClient(model);
var responseClient = new OpenAIClient(apiKey).GetResponsesClient(model);

#pragma warning disable SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

Expand All @@ -135,15 +135,10 @@ async Task SKAgent_As_AFAgentAsync()
var agentOptions = new ChatClientAgentRunOptions(new()
{
MaxOutputTokens = 8000,
// Microsoft.Extensions.AI currently does not have an abstraction for reasoning-effort,
// we need to break glass using the RawRepresentationFactory.
RawRepresentationFactory = (_) => new OpenAI.Responses.ResponseCreationOptions()
Reasoning = new()
{
ReasoningOptions = new()
{
ReasoningEffortLevel = OpenAI.Responses.ResponseReasoningEffortLevel.High,
ReasoningSummaryVerbosity = OpenAI.Responses.ResponseReasoningSummaryVerbosity.Detailed
}
Effort = ReasoningEffort.High,
Output = ReasoningOutput.Full
}
});

Expand Down Expand Up @@ -181,22 +176,17 @@ async Task AFAgentAsync()
{
Console.WriteLine("\n=== AF Agent ===\n");

var agent = new OpenAIClient(apiKey).GetOpenAIResponseClient(model)
var agent = new OpenAIClient(apiKey).GetResponsesClient(model)
.CreateAIAgent(name: "Thinker", instructions: "You are at thinking hard before answering.");

var thread = agent.GetNewThread();
var agentOptions = new ChatClientAgentRunOptions(new()
{
MaxOutputTokens = 8000,
// Microsoft.Extensions.AI currently does not have an abstraction for reasoning-effort,
// we need to break glass using the RawRepresentationFactory.
RawRepresentationFactory = (_) => new OpenAI.Responses.ResponseCreationOptions()
Reasoning = new()
{
ReasoningOptions = new()
{
ReasoningEffortLevel = OpenAI.Responses.ResponseReasoningEffortLevel.High,
ReasoningSummaryVerbosity = OpenAI.Responses.ResponseReasoningSummaryVerbosity.Detailed
}
Effort = ReasoningEffort.High,
Output = ReasoningOutput.Full
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async Task SKAgentAsync()
{
var builder = Kernel.CreateBuilder().AddOpenAIChatClient(model, apiKey);

OpenAIResponseAgent agent = new(new OpenAIClient(apiKey).GetOpenAIResponseClient(model)) { StoreEnabled = true };
OpenAIResponseAgent agent = new(new OpenAIClient(apiKey).GetResponsesClient(model)) { StoreEnabled = true };

// Initialize plugin and add to the agent's Kernel (same as direct Kernel usage).
agent.Kernel.Plugins.Add(KernelPluginFactory.CreateFromFunctions("KernelPluginName", [KernelFunctionFactory.CreateFromMethod(GetWeather)]));
Expand All @@ -48,7 +48,7 @@ async Task SKAgent_As_AFAgentAsync()
{
var builder = Kernel.CreateBuilder().AddOpenAIChatClient(model, apiKey);

OpenAIResponseAgent skAgent = new(new OpenAIClient(apiKey).GetOpenAIResponseClient(model)) { StoreEnabled = true };
OpenAIResponseAgent skAgent = new(new OpenAIClient(apiKey).GetResponsesClient(model)) { StoreEnabled = true };

// Initialize plugin and add to the agent's Kernel (same as direct Kernel usage).
skAgent.Kernel.Plugins.Add(KernelPluginFactory.CreateFromFunctions("KernelPluginName", [KernelFunctionFactory.CreateFromMethod(GetWeather)]));
Expand All @@ -63,7 +63,7 @@ async Task SKAgent_As_AFAgentAsync()

async Task AFAgentAsync()
{
var agent = new OpenAIClient(apiKey).GetOpenAIResponseClient(model).CreateAIAgent(
var agent = new OpenAIClient(apiKey).GetResponsesClient(model).CreateAIAgent(
instructions: "You are a helpful assistant",
tools: [AIFunctionFactory.Create(GetWeather)]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async Task SKAgentAsync()

var serviceCollection = new ServiceCollection();
serviceCollection.AddTransient<Microsoft.SemanticKernel.Agents.Agent>((sp)
=> new OpenAIResponseAgent(new OpenAIClient(apiKey).GetOpenAIResponseClient(model))
=> new OpenAIResponseAgent(new OpenAIClient(apiKey).GetResponsesClient(model))
{
Name = "Joker",
Instructions = "You are good at telling jokes."
Expand All @@ -44,7 +44,7 @@ async Task SKAgent_As_AFAgentAsync()

var serviceCollection = new ServiceCollection();
serviceCollection.AddTransient<Microsoft.SemanticKernel.Agents.Agent>((sp)
=> new OpenAIResponseAgent(new OpenAIClient(apiKey).GetOpenAIResponseClient(model))
=> new OpenAIResponseAgent(new OpenAIClient(apiKey).GetResponsesClient(model))
{
Name = "Joker",
Instructions = "You are good at telling jokes."
Expand All @@ -65,7 +65,7 @@ async Task AFAgentAsync()

var serviceCollection = new ServiceCollection();
serviceCollection.AddTransient((sp) => new OpenAIClient(apiKey)
.GetOpenAIResponseClient(model)
.GetResponsesClient(model)
.CreateAIAgent(name: "Joker", instructions: "You are good at telling jokes."));

await using ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();
Expand Down
Loading
Loading