Skip to content

Refresh provider compatibility and SDK maintenance - #48

Closed
iskakaushik wants to merge 2 commits into
mainfrom
maintenance/provider-refresh-2026-08
Closed

Refresh provider compatibility and SDK maintenance#48
iskakaushik wants to merge 2 commits into
mainfrom
maintenance/provider-refresh-2026-08

Conversation

@iskakaushik

Copy link
Copy Markdown
Collaborator

Summary

  • refresh OpenAI and Anthropic model catalogs, centralize identifiers, add Claude Opus 5, and remove retired model constants
  • normalize current provider options for GPT-5.6 Chat Completions and current Claude sampling constraints
  • complete streamed tool-call assembly and emit one terminal finish event with usage
  • add configurable Anthropic retries and harden multi-step/tool execution behavior
  • repair CMake install/export consumption, Python build tooling, examples, and documentation

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

  • Debug build and unit/offline suite: pass
  • live OpenAI and Anthropic integration coverage: pass; one ClickHouse/OpenAI case timed out in the aggregate run and passed on isolated retry (7.4s)
  • OpenRouter live generation and streaming example: pass
  • Release build and offline CTest suite: pass
  • formatting check and clang-tidy across 52 source files: pass
  • installed-package downstream CMake consumer: pass

Closes #36.
Closes #39.

iskakaushik and others added 2 commits August 19, 2026 11:12
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>
@iskakaushik

Copy link
Copy Markdown
Collaborator Author

Superseded by stacked PRs #49#50#51#52#53 (same content split into reviewable layers, with the streaming review fixes applied). The stack merges bottom-up starting at #49.

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.

RetryConfig for anthropic client Issue with build.py

1 participant