From 634f48872a8e1205404bf764cd45a10660677ff3 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Mon, 1 Jun 2026 11:31:20 -0700 Subject: [PATCH] fix(chat): set StreamingEnabled=true before calling CreateResponseStreamingAsync The OpenAI SDK requires StreamingEnabled to be set to true on CreateResponseOptions when calling CreateResponseStreamingAsync. Also propagate StreamingEnabled in CloneOptionsWithPreviousResponseId so tool-call continuation legs behave consistently. --- EssentialCSharp.Chat.Shared/Services/AIChatService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EssentialCSharp.Chat.Shared/Services/AIChatService.cs b/EssentialCSharp.Chat.Shared/Services/AIChatService.cs index 6c384a76..c927dfa0 100644 --- a/EssentialCSharp.Chat.Shared/Services/AIChatService.cs +++ b/EssentialCSharp.Chat.Shared/Services/AIChatService.cs @@ -102,6 +102,7 @@ public AIChatService(IOptions options, AISearchService searchService, // Create the streaming response using the Responses API #pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. + responseOptions.StreamingEnabled = true; responseOptions.InputItems.Clear(); responseOptions.InputItems.Add(ResponseItem.CreateUserMessageItem(enrichedPrompt)); var streamingUpdates = _ResponseClient.CreateResponseStreamingAsync(responseOptions, cancellationToken); @@ -560,6 +561,7 @@ private static CreateResponseOptions CloneOptionsWithPreviousResponseId( Temperature = source.Temperature, TopP = source.TopP, ServiceTier = source.ServiceTier, + StreamingEnabled = source.StreamingEnabled, }; foreach (var tool in source.Tools) clone.Tools.Add(tool);