-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: disable streaming by default in sync chat methods (fixes #1733) #1734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
praisonai-triage-agent
wants to merge
6
commits into
main
Choose a base branch
from
claude/issue-1733-20260523-1442
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9f2cb5b
fix: disable streaming by default in sync chat methods (fixes #1733)
praisonai-triage-agent[bot] fb6ab2d
test: replace ad-hoc script with unit test for sync stream defaults
Copilot b43245a
test: clarify helper naming in sync stream default tests
Copilot e7969a4
test: harden sync stream default AST checks
Copilot c1f452e
test: align stream default test names with target methods
Copilot 54aee19
docs: clarify async/sync stream default asymmetry
praisonai-triage-agent[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env python3 | ||
| """Test script to reproduce and verify fix for multi-agent streaming issue #1733""" | ||
|
|
||
| import sys | ||
| import os | ||
|
|
||
| # Add the praisonaiagents package to the path | ||
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src', 'praisonai-agents')) | ||
|
|
||
| print("Testing multi-agent functionality with the fix...") | ||
|
|
||
| try: | ||
| from praisonaiagents import Agent, Agents | ||
|
|
||
| research_agent = Agent(instructions="Research about AI") | ||
| summarise_agent = Agent(instructions="Summarise research agent's findings") | ||
| agents = Agents(agents=[research_agent, summarise_agent]) | ||
|
|
||
| print("✓ Successfully created agents") | ||
|
|
||
| # Test that our fix worked: the sync methods should not use streaming by default | ||
| # Check the method signatures in chat_mixin.py | ||
| import inspect | ||
| from praisonaiagents.agent.chat_mixin import ChatMixin | ||
|
|
||
| # Check _chat_completion method | ||
| chat_completion_sig = inspect.signature(ChatMixin._chat_completion) | ||
| stream_param = chat_completion_sig.parameters.get('stream') | ||
| if stream_param and stream_param.default == False: | ||
| print("✓ _chat_completion method has stream=False as default") | ||
| else: | ||
| print(f"✗ _chat_completion method stream default is: {stream_param.default}") | ||
|
|
||
| # Check _execute_unified_chat_completion method | ||
| unified_chat_sig = inspect.signature(ChatMixin._execute_unified_chat_completion) | ||
| unified_stream_param = unified_chat_sig.parameters.get('stream') | ||
| if unified_stream_param and unified_stream_param.default == False: | ||
| print("✓ _execute_unified_chat_completion method has stream=False as default") | ||
| else: | ||
| print(f"✗ _execute_unified_chat_completion method stream default is: {unified_stream_param.default}") | ||
|
|
||
| print("✓ Fix validation completed - sync methods now default to stream=False") | ||
| print("✓ This should resolve the 'Streaming is not supported in sync OpenAIAdapter' error") | ||
|
|
||
| except Exception as e: | ||
| print(f"✗ Error occurred during validation: {e}") | ||
| import traceback | ||
| traceback.print_exc() | ||
| sys.exit(1) | ||
|
|
||
| print("✓ All tests passed!") | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation script does not fail on regression.
This script prints failure markers but still exits successfully, so it can report “All tests passed!” even when defaults are wrong.
Suggested fix
Also applies to: 51-51
🧰 Tools
🪛 Ruff (0.15.13)
[error] 29-29: Avoid equality comparisons to
False; usenot stream_param.default:for false checksReplace with
not stream_param.default(E712)
[error] 37-37: Avoid equality comparisons to
False; usenot unified_stream_param.default:for false checksReplace with
not unified_stream_param.default(E712)
🤖 Prompt for AI Agents