From 142ef2a3f42098443e0f2115077598b38627c462 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Wed, 10 Jun 2026 10:47:47 +0800 Subject: [PATCH 1/3] docs: mcpp-first README; move xmake usage to docs//xmake.md README now leads with the mcpp ecosystem workflow (mcpp new --template llmapi / mcpp add llmapi) like imgui-m; the xmake package usage moved from README into docs/{en,zh,zh-hant}/xmake.md and getting-started is rewritten mcpp-first. All three README languages stay in sync. --- README.md | 117 ++++++++++++++++---------------- README.zh.hant.md | 89 +++++++++++++++--------- README.zh.md | 89 +++++++++++++++--------- docs/en/README.md | 1 + docs/en/getting-started.md | 49 +++++++------ docs/en/xmake.md | 47 +++++++++++++ docs/zh-hant/README.md | 1 + docs/zh-hant/getting-started.md | 49 +++++++------ docs/zh-hant/xmake.md | 45 ++++++++++++ docs/zh/README.md | 1 + docs/zh/getting-started.md | 49 +++++++------ docs/zh/xmake.md | 45 ++++++++++++ 12 files changed, 402 insertions(+), 180 deletions(-) create mode 100644 docs/en/xmake.md create mode 100644 docs/zh-hant/xmake.md create mode 100644 docs/zh/xmake.md diff --git a/README.md b/README.md index 5be4e2a..ca41fb2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # llmapi -> Modern C++23 LLM client built with modules +> Modern C++23 LLM client built with modules — `import` and chat, OpenAI-compatible, template-ready +[![Release](https://img.shields.io/github/v/release/mcpplibs/llmapi)](https://github.com/mcpplibs/llmapi/releases) [![C++23](https://img.shields.io/badge/C%2B%2B-23-blue.svg)](https://en.cppreference.com/w/cpp/23) [![Module](https://img.shields.io/badge/module-ok-green.svg)](https://en.cppreference.com/w/cpp/language/modules) [![License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](LICENSE) @@ -9,20 +10,37 @@ | English - [简体中文](README.zh.md) - [繁體中文](README.zh.hant.md) | |:---:| -| [Documentation](docs/README.md) - [English Docs](docs/en/README.md) - [中文文档](docs/zh/README.md) - [繁體中文文件](docs/zh-hant/README.md) | +| [mcpp build tool](https://github.com/mcpp-community/mcpp) · [package index](https://github.com/mcpp-community/mcpp-index) · [Documentation](docs/README.md) · [Issues](https://github.com/mcpplibs/llmapi/issues) | `llmapi` provides a typed `Client` API for chat, streaming, embeddings, tool calls, and conversation persistence. The default config alias `Config` maps to OpenAI-style providers, so the common case does not need an explicit `openai::OpenAI` wrapper. -## Features +## Quick Start (mcpp) -- `import mcpplibs.llmapi` with C++23 modules -- Strongly typed messages, tools, and response structs -- Sync, async, and streaming chat APIs -- Embeddings via the OpenAI provider -- Conversation save/load helpers -- OpenAI-compatible endpoint support through `openai::Config::baseUrl` +```bash +mcpp new myagent --template llmapi && cd myagent +export OPENAI_API_KEY="sk-..." +mcpp run +``` + +Templates ship with the library and version-track it automatically: + +```bash +mcpp new --list-templates llmapi # list available templates +mcpp new mybot --template llmapi:chat # interactive streaming chat CLI +mcpp new mybot --template llmapi:anthropic # Anthropic provider +mcpp new mybot --template llmapi:deepseek # OpenAI-compatible endpoint (DeepSeek) +``` -## Quick Start +Or add it to an existing mcpp project: + +```bash +mcpp add llmapi +``` + +```toml +[dependencies.mcpplibs] +llmapi = "0.2.7" +``` ```cpp import mcpplibs.llmapi; @@ -33,7 +51,7 @@ int main() { auto apiKey = std::getenv("OPENAI_API_KEY"); if (!apiKey) { - std::cerr << "OPENAI_API_KEY not set\n"; + std::println(stderr, "OPENAI_API_KEY not set"); return 1; } @@ -45,11 +63,30 @@ int main() { client.system("You are a concise assistant."); auto resp = client.chat("Explain why C++23 modules are useful in two sentences."); - std::cout << resp.text() << '\n'; + std::println("{}", resp.text()); return 0; } ``` +## Features + +- `import mcpplibs.llmapi` with C++23 modules +- Strongly typed messages, tools, and response structs +- Sync, async, and streaming chat APIs +- Embeddings via the OpenAI provider +- Conversation save/load helpers +- OpenAI-compatible endpoint support through `openai::Config::baseUrl` +- Project templates: `mcpp new --template llmapi[: