The author is developing new features for the ClickHouse native client, aiming to achieve user-friendly integration similar to what JavaScript and Python offer. They created the ai-sdk-cpp
(Apache-2.0), a C++20 library that allows unified API calls to OpenAI (GPT-4o) and Anthropic (Claude 3.5). The SDK supports streaming, multi-turn chat, and efficient error handling through modern C++ constructs like std::optional
and std::variant
, eliminating the need for macros. It also facilitates tool calling, enabling the model to interact with real APIs, either synchronously or asynchronously. However, the lack of real reflection in C++ complicates the mapping of functions to JSON schemas, unlike TypeScript. The author seeks feedback, especially on this aspect, and invites users to test the examples available on the GitHub repository linked. The project draws inspiration from Vercel’s AI SDK and litellm.
Introducing HN: A Cutting-Edge C++20 AI SDK Featuring GPT-4o, Claude 3.5, and Advanced Tool Integration

Share
Read more