mcpplibs.llmapi
importModern C++ LLM API client with openai-compatible support
import mcpplibs.llmapi;
模块名读自上游 src/llmapi.cppm 里的 `export module` 声明。
mcpp add mcpplibs.llmapi@0.2.8
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// Consuming `mcpplibs.llmapi` through the published index.
//
// Every assertion here is OFFLINE, on purpose. This is an HTTP client, and a
// test that reaches an LLM endpoint needs a key CI does not have, costs money,
// and fails for reasons that have nothing to do with the package. What a
// workspace member is for is the dependency edge: does the module import,
// does its exported surface exist and behave, does it link.
//
// The partitions exercised (:url, :types, :errors) are pure data and pure
// logic, which is exactly why they are the right ones to assert on.
import std;
import mcpplibs.llmapi;
using namespace mcpplibs;
int main() {
int failures = 0;
auto check = [&](bool ok, std::string_view what) {
if (!ok) { std::println("FAIL: {}", what); ++failures; }
};
// :url — the provider endpoints are compile-time constants, so a wrong one
// …
tests/examples/llmapi/tests/consume.cpp · 项目 tests/examples/llmapi
构建 · 上游清单
- modules
mcpplibs.llmapi- targets
llmapi (lib)- manifest version
0.2.8- dependencies
mcpplibs- 来源
https://raw.githubusercontent.com/mcpplibs/llmapi/0.2.8/mcpp.toml