Refresh provider compatibility and SDK maintenance - #48
Closed
iskakaushik wants to merge 2 commits into
Closed
Conversation
Review fixes:
- Preserve API error bodies on non-200 streaming responses (httplib routes
them through the content receiver, leaving response.body empty)
- Flush accumulated streamed tool calls when a stream ends without [DONE] /
content_block_stop, instead of silently dropping them
- Complete the Anthropic stream on message_stop so consumers don't hit the
event timeout waiting for the connection to close
- Don't report a user-initiated stop_stream() as a network failure
- Stamp failed streams with kFinishReasonError and no usage instead of a
clean finish(stop)
- Send stream_options {include_usage: true} so OpenAI actually emits the
terminal usage chunk the finish event reports
- Guard AnthropicStreamImpl::start_stream/stop_stream with the joinable
check + mutex (double start previously raced and could std::terminate)
- Null-tolerant Anthropic SSE field parsing (present-but-null keys from
gateways no longer discard whole events)
- Keep a tool_use block's initial input separate from streamed
input_json_delta fragments to avoid concatenating two JSON documents
- logger.h: feature-test __cpp_lib_atomic_shared_ptr with an
atomic_load/store fallback so libc++ builds keep compiling
- format.py/lint.py: only match the build- exclusion against directory
components, not filenames
- Remove the now-unused brotli submodule (httplib switched to zlib)
Modularity/DRY:
- New providers::streaming::HttpSseStream base owns the stream thread,
event queue, HTTP+SSE line-splitting plumbing, finish-once semantics and
pending tool-call accumulation; OpenAIStreamImpl and AnthropicStreamImpl
now only translate provider-specific SSE lines into events (~430 lines
net removed)
- Shared stream_utils.h (PendingToolCall, make_tool_call_event,
split_origin_and_path) and env_utils.h (non_empty_env) replace
copy-pasted logic in both providers and factories
- AnthropicClient constructors delegate to one private ctor instead of
duplicating the ProviderConfig block
- Anthropic sampling-parameter gating deduplicated into a prefix list and
a single add_sampling_parameter helper
Both Debug and Release trees build clean; 235/235 offline tests pass in
each; live OpenAI + Anthropic streaming and tool-calling smoke tests pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
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.
Summary
The model and stream behavior was compared against the current Vercel AI SDK checkout. This C++ client intentionally remains on OpenAI Chat Completions; Responses API support remains tracked separately in #44.
Removing the explicitly retired public model constants is a source-compatibility change for callers still referencing them.
Validation
Closes #36.
Closes #39.