Skip to content

Wrap streaming callback properly in C++ - #1061

Open
Scott McKay (skottmckay) wants to merge 4 commits into
mainfrom
skottmckay/ImproveCppStreamingCallbackWrapping
Open

Wrap streaming callback properly in C++#1061
Scott McKay (skottmckay) wants to merge 4 commits into
mainfrom
skottmckay/ImproveCppStreamingCallbackWrapping

Conversation

@skottmckay

Copy link
Copy Markdown
Collaborator

The callback didn't get full wrapped, forcing users to drop to the C API level. They shouldn't need to do that in general, so fix the wrapping so they can deal in the Item returned.

Copilot AI balanced review requested due to automatic review settings September 2, 2026 00:01
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foundry-local Ready Ready Preview Sep 2, 2026 4:00am UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The port guide incorrectly states that streamed and final response item types always match.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an item-oriented C++ streaming callback so consumers no longer need C API queue handling.

Changes:

  • Adds std::function<int(Item)> callback support with RAII ownership.
  • Deprecates the raw C callback overload and adds callback clearing.
  • Updates tests, examples, and documentation.
File summaries
File Description
foundry_local_cpp.h Declares callback API and adapter.
foundry_local_cpp.inline.h Implements callback registration.
streaming_audio_test.cc Exercises item-based audio streaming.
chat_session_test.cc Exercises item-based tool streaming.
examples/tool_calling/main.cc Simplifies tool callback usage.
examples/realtime_audio/main.cc Simplifies audio callback usage.
examples/basic_chat/main.cc Simplifies text callback usage.
docs/CppPortGuide.md Documents the new callback contract.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread sdk_v2/cpp/docs/CppPortGuide.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants