-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
.NETbugSomething isn't workingSomething isn't workingpythonv1.0Features being tracked for the version 1.0 GAFeatures being tracked for the version 1.0 GA
Description
Description
-
was expecting to have some access to the code interpreter reasoning stream from the Contents collection
-
see code below
-
in the debugging screenshot, you can see when i hit the raw delta object, the Contents object is empty
-
in the code output screenshot, you can see that the TextReasoningContent dont contain any of the code from the raw objects
Code Sample
#pragma warning disable OPENAI001
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Configuration;
using OpenAI;
using OpenAI.Responses;
using System.ClientModel;
using System.Text;
var config = new ConfigurationBuilder()
.AddUserSecrets<Program>()
.Build();
var cred = new ApiKeyCredential(config["OpenAIAPIKey"]);
var openAIClient = new OpenAIClient(cred);
var agent = openAIClient
.GetResponsesClient("gpt-5")
.AsIChatClient()
.AsBuilder()
.ConfigureOptions(options =>
{
options.Tools = [new HostedCodeInterpreterTool()];
options.RawRepresentationFactory = _ => new CreateResponseOptions()
{
ReasoningOptions = new ResponseReasoningOptions()
{
ReasoningEffortLevel = "medium",
ReasoningSummaryVerbosity = "detailed"
}
};
})
.Build()
.AsAIAgent();
var message = "Write and execute a simple, arbitrary python script with code interpreter.";
var reasoningCodeInterpreterResponse = new StringBuilder();
var reasoningContent = new StringBuilder();
Console.WriteLine("AIContent objects types received:");
Console.WriteLine("---------------------------------");
await foreach (var update in agent.RunStreamingAsync(message))
{
switch (update.RawRepresentation)
{
case ChatResponseUpdate chatResponseUpdate:
switch (chatResponseUpdate.RawRepresentation)
{
case StreamingResponseCodeInterpreterCallCodeDeltaUpdate delta:
reasoningCodeInterpreterResponse.Append(delta.Delta);
break;
default:
break;
}
break;
}
foreach (var content in update.Contents)
{
Console.WriteLine(content.GetType().FullName);
switch (content)
{
case TextReasoningContent textContent:
reasoningContent.Append(textContent.Text);
break;
}
}
}
Console.WriteLine();
Console.WriteLine("Code Interpreter Response:");
Console.WriteLine("--------------------------");
Console.WriteLine(reasoningCodeInterpreterResponse.ToString());
Console.WriteLine();
Console.WriteLine("Reasoning Response:");
Console.WriteLine("-------------------");
Console.WriteLine(reasoningContent.ToString());Error Messages / Stack Traces
Package Versions
Microsoft.Agents.AI (1.0.0-preview.260128.1), Microsoft.Agents.AI.OpenAI (1.0.0-preview.260128.1)
.NET Version
.NET 8.0
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
.NETbugSomething isn't workingSomething isn't workingpythonv1.0Features being tracked for the version 1.0 GAFeatures being tracked for the version 1.0 GA
Type
Projects
Status
No status