Add Support for Simulated Streaming Toggle and Provider Compatibility Checks #209
+42
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This PR introduces configuration options and logic to handle simulated streaming, allowing flexibility when native streaming support is unavailable from certain providers. It adds an environment-aware support check for multiple providers to prevent misconfiguration, ensuring the application only proceeds with simulated streaming when appropriate.
--enable-simulated-streaming=true
(default)--enable-simulated-streaming=false
When the application starts:
--enable-simulated-streaming=false
, the code checks if the selected provider supports native streamingKUBECTL_AI_REQUIRE_NATIVE_STREAMING=true
and provider-specific variables) and continuesThis approach ensures that applications that depend on real-time token-by-token streaming for UI updates or early termination can enforce this requirement at startup time.
Affected Modules:
Key Details:
--enable-simulated-streaming
with a default value oftrue
.checkNativeStreamingSupport()
to determine if a provider natively supports streaming features, with default assumptions.--enable-simulated-streaming=false
is specified, the code verifies provider support before proceeding.Potential Impacts:
checkNativeStreamingSupport()
.Testing Steps:
--enable-simulated-streaming=false
against providers known to support native streaming (gemini
), verify normal operation.--enable-simulated-streaming=false
against providers without native streaming support (azopenai
,grok
,llamacpp
,ollama
,openai
) and confirm proper error handling.--enable-simulated-streaming
omitted, ensuring it defaults to allowing simulated streaming.