PL

palm1r/llmqore

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

51 stars 14 forks 质量 75 趋势 27MIT

Qt C++ 库,用于处理 AI/LLM 提供者和 MCP

概览

Qt/C++库,适用于云和本地LLM提供商、MCP客户端和服务器,以及ACP代理。流式差异作为Qt信号在对象自身线程中到达,异步结果为QFuture,所有权遵循QObject的父-子节点。针对核心、网络和并发的链路。 - — 云端和本地:Claude、OpenAI 聊天完成、OpenAI 响应、Google AI、Mistral、DeepSeek、Qwen、Ollama 等llama.cpp;流式或缓冲,图片输入,推理出,令牌使用,取消——您的 BaseTool 子类,包含工具循环,若愿意由 QFuture 限制——客户端和服务器通过 stdio,可流式 HTTP 或遗留 SSE,共享一个工具注册表;mcp-bridge CLI 将多个上游服务器置于一个端点后方——一个历史,转换为每个提供者的形状,可移植于它们之间————JSON 注册表中的任何代理;提供 Claude 代码和代码库 或者亲眼看着它到来,这正是你在聊天面板中想要的效果: accumulatedReceived 携带迄今为止的全部答案;chunkReceived 仅携带新的 delta。

概述(AI 翻译)

适用于云和本地LLM提供商、MCP客户端和服务器以及ACP代理的Qt/C++库。 流式delta作为Qt信号在对象自身线程上到达,异步结果为 QFuture,所有权紧随QObject父子关系。与Core、Network及 Concurrent。

它的作用

  • LLM REST API — 云端和本地:Claude、OpenAI聊天完成、OpenAI响应、Google AI、Mistral、DeepSeek、Qwen、Ollama、llama.cpp;流式或缓冲、图像输入、推理、令牌使用、取消
  • 工具调用 — 你的BaseTool子职业,包括工具循环,如果你愿意,可以被QFuture 限制
  • MCP — 客户端和服务器通过stdio、可流式HTTP或传统SSE,共享一个工具注册表;mcp-bridgeCLI将多个上游服务器放在一个端点后面
  • 对话 — 一个历史记录,转换为每个提供者的形状,在它们之间可携带
  • ACP 主机 — JSON 注册表中的任何代理;提供 Claude 代码和 Codex

LLM REST API

请提问并等待答案:

或者亲眼看着它到来,这正是你在聊天面板中想要的效果:

accumulatedReceived 承载了迄今为止的全部答案;chunkReceived 仅承载了新的 德尔塔。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

LLMQore

Qt/C++ library for cloud and local LLM providers, MCP clients and servers, and ACP agents. Streaming deltas arrive as Qt signals on the object’s own thread, async results as QFuture, ownership follows QObject parent-child. Links against Core, Network and Concurrent.

What it does

  • LLM REST API — cloud and local: Claude, OpenAI Chat Completions, OpenAI Responses, Google AI, Mistral, DeepSeek, Qwen, Ollama, llama.cpp; streaming or buffered, images in, reasoning out, token usage, cancellation
  • Tool calling — your BaseTool subclass, tool loop included, gated by QFuture if you want
  • MCP — client and server over stdio, Streamable HTTP or legacy SSE, sharing one tool registry; mcp-bridge CLI puts many upstream servers behind one endpoint
  • Conversation — one history, translated into each provider’s shape, portable between them
  • ACP host — any agent in the JSON registry; ships Claude Code and Codex

LLM REST API

Ask and await the answer:

auto *client = new LLMQore::ClaudeClient(
    "https://api.anthropic.com", apiKey, "claude-sonnet-4-5", this);

client->askOnce("What is Qt?").then(this, [this](const LLMQore::CompletionInfo &result) {
    m_view->setPlainText(result.fullText);
});

Or watch it arrive, which is what you want in a chat panel:

connect(client, &LLMQore::BaseClient::accumulatedReceived,
        this, [this](const LLMQore::RequestID &, const QString &answer) {
    m_view->setPlainText(answer);
});

client->ask("What is Qt?");

accumulatedReceived carries the whole answer so far; chunkReceived carries only the new delta. Both are emitted on the client’s own thread, so a direct connection into a widget or model is safe.

→ Quick Start

Tool calling

Expose a function over data the provider cannot see — the open document, the current selection, a local database:

client->tools()->addTool(new SearchCurrentFileTool(client));

conversation.addUser("Where do we handle the timeout?");
client->ask(conversation);

The client drives the loop: the model requests the tool, executeAsync runs, the result is sent back, the model answers. setMaxToolContinuations() bounds it, ten rounds by default. toolStarted and toolResultReady report progress; setExecutionGate() gates each call behind a QFuture.

→ Quick Start · LLM clients

MCP

Using external tools

Tools from an MCP server enter the same registry and reach the model through the same tool-definition array:

client->tools()->addMcpServer({.name = "filesystem", .command = "npx",
在 GitHub 查看完整 README

安装

npx -y @modelcontextprotocol/server-filesystem /home/user
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"] } } }