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