Feat/prefer streaming#44
Open
harshpreet931 wants to merge 4 commits into
Open
Conversation
…ildChatCompletionParams
Introduce a new optional `preferStreaming` boolean in `RunConfig` to allow users to explicitly enable or disable streaming for model completions. When set to `false`, streaming is skipped even if the provider supports it. This provides better control over response handling, especially in scenarios where non-streaming is preferred for simplicity or compatibility. - Added `preferStreaming` to `RunConfig` type. - Propagated the option in `agentAsTool`, `guardrails`, and engine logic. - Updated model provider to explicitly set `stream: false` for non-streaming calls.
7fbbb18 to
e05de49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces a new
preferStreamingconfiguration option to the agent and model execution pipeline, allowing callers to control whether streaming responses are preferred when available. The changes propagate this option through multiple layers of the codebase, update type definitions, and ensure that model providers respect the streaming preference. The most important changes are grouped below:Streaming Preference Propagation
preferStreamingproperty to theRunConfigtype insrc/core/types.ts, enabling configuration of streaming preference for model responses.preferStreamingoption through agent and guardrail invocations, ensuring it is available in downstream config objects (src/core/agent-as-tool.ts,src/core/guardrails.ts). [1] [2]Model Execution Logic
runInternalinsrc/core/engine.tsto checkpreferStreamingbefore using the streaming completion API, providing more granular control over streaming behavior. [1] [2]Model Provider Implementation
src/providers/model.tsto always setstream: falsefor non-streaming completions, ensuring explicit control over request streaming based on configuration.