Skip to content

fix: support anthropic stream requests#62

Open
cUp1d wants to merge 2 commits intoPsiACE:mainfrom
cUp1d:main
Open

fix: support anthropic stream requests#62
cUp1d wants to merge 2 commits intoPsiACE:mainfrom
cUp1d:main

Conversation

@cUp1d
Copy link

@cUp1d cUp1d commented Feb 18, 2026

Related Issue

Fixes #46

Modification

  • Switch ModelRunner from run_tools_async to stream_events_async for Anthropic stream compatibility.
  • Only pass parallel_tool_calls=False for anthropic / vertexaianthropic models to avoid breaking non-Anthropic providers.
  • Prioritize stream error handling before tool-followup decisions, so failed final events are not treated as successful tool continuation.
  • Add regression tests for:
    • non-Anthropic path not receiving parallel_tool_calls
    • stream error taking precedence over tool follow-up
  • Keep related tape-context stream compatibility updates and corresponding tests in this PR.
  • Use ASCII status tags ([OK] / [ERROR]) in telegram_send.py for PowerShell-friendly output.

Tests

  • Existing tests: uv run pytest passed
  • Manual verification: covered by regression scenarios for Anthropic stream error + provider compatibility paths

Code Quality Checks

  • uv run ruff check . passed
  • uv run mypy passed

- switch model runner to stream_events parsing for anthropic stream compatibility

- only pass parallel_tool_calls=False for anthropic/vertexaianthropic

- prioritize stream errors before tool follow-up decisions

- add regression coverage for stream event compatibility and error handling
@yihong0618
Copy link
Collaborator

can you help fix the lint?

@cUp1d
Copy link
Author

cUp1d commented Feb 21, 2026

Sure, I have fixed the lint errors. Let me know if there's anything else

@PsiACE
Copy link
Owner

PsiACE commented Feb 23, 2026

Hi @cUp1d,

Thanks. I just got back from vacation and don’t have a suitable API to test right now. I’m leaning toward moving the provider compatibility logic to Republic. Would love to hear your thoughts since you’re the expert on this now.

@cUp1d
Copy link
Author

cUp1d commented Feb 24, 2026

Welcome back! I have some Anthropic API keys available for testing. Happy to share it with you and bub project collaborators.

Agreed that moving the compatibility logic to republic is the cleaner approach. one thing i noticed — there's an open PR (#22) to move republic into the bub monorepo. might make sense to land that first so the fix can be done in one place? or if that's not happening soon i can open a separate PR on republic directly. let me know what you think.

@PsiACE
Copy link
Owner

PsiACE commented Feb 24, 2026

@cUp1d Thanks a lot

Re: #22, I don’t think moving republic into the bub monorepo is fully on the roadmap.

Handling this directly in the republic repo sounds great to me. Feel free to open the PR there.

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.

Anthropic provider: non-streaming methods fail

3 participants