Skip to content

Add support for reasoning content to Microsoft.Extensions.AI integration#153

Merged
lofcz merged 1 commit intolofcz:masterfrom
smitranic:master
Feb 25, 2026
Merged

Add support for reasoning content to Microsoft.Extensions.AI integration#153
lofcz merged 1 commit intolofcz:masterfrom
smitranic:master

Conversation

@smitranic
Copy link
Contributor

Currently Microsoft.Extensions.AI integration doesn't support reasoning content.

This PR maps reasoning content to TextReasoningContent on MEAI side.

Sample usage:

TornadoApi api = new(endpointUrl, apiKey);

var chatClient = api.AsChatClient(modelName);
List<ChatMessage> messages = [
    new(ChatRole.User, "Why is sky blue?")
];

var response = await chatClient.GetResponseAsync(messages);

// Standard message.Text usage (unchanged):
Console.WriteLine(response.Messages.FirstOrDefault()?.Text);

// Grab the TextContent only (unchanged):
Console.WriteLine(response.Messages.FirstOrDefault()?.Contents.OfType<TextContent>().FirstOrDefault()?.Text);

// Grab the TextReasoningContent only (now supported):
Console.WriteLine(response.Messages.FirstOrDefault()?.Contents.OfType<TextReasoningContent>().FirstOrDefault()?.Text);

@lofcz
Copy link
Owner

lofcz commented Feb 25, 2026

thanks!

@lofcz lofcz merged commit 9544470 into lofcz:master Feb 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants