FastAPI-BitNet
by grctest·★ 38·综合分 42
基于FastAPI的BitNet模型MCP服务器,支持会话管理、聊天和基准测试功能。
概述
FastAPI-BitNet是一个使用FastAPI构建的强大REST API,用于管理和与BitNet模型实例交互。它允许开发人员以编程方式控制llama-cli和llama-server进程,用于自动化测试、基准测试和交互式聊天会话。该服务器通过模型上下文协议与VS Code Copilot集成,使开发工作流程中能够无缝交互模型。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要为微软BitNet模型提供MCP接口,并需要全面的会话管理和基准测试功能,尤其是与VS Code集成时,选择FastAPI-BitNet。
什么时候不要选它
不适合需要高可用性或负载均衡的生产环境,因为它似乎是单实例实现,没有内置冗余机制。
此 server 暴露的工具
从 README 抽取出 9 个工具create_sessionStart a new llama-cli or llama-server session
stop_sessionStop a running llama-cli or llama-server session
check_session_statusCheck the status of a running session
chat_with_sessionSend a prompt to a running BitNet session and receive a response
initialize_multiple_instancesInitialize multiple BitNet instances simultaneously
shutdown_multiple_instancesShut down multiple BitNet instances in a single API call
run_benchmarkRun a benchmark test on a GGUF model
calculate_perplexityCalculate perplexity scores for a model on test data
estimate_server_capacityEstimate maximum number of BitNet instances the server can handle
说明:Tool names inferred from feature descriptions in the README, as no explicit 'Tools' section was found. The README describes functionality for session management, chat operations, and benchmarking, which were mapped to tool names.
可对比工具
安装
安装
- 前置条件:Docker Desktop、Conda、Python 3.10+
- 设置Python环境:
``bash conda create -n bitnet python=3.11 conda activate bitnet ``
- 安装Huggingface CLI:
``bash pip install -U "huggingface_hub[cli]" ``
- 下载BitNet模型:
``bash huggingface-cli download microsoft/BitNet-b1.58-2B-4T-gguf --local-dir app/models/BitNet-b1.58-2B-4T ``
- 使用Docker运行(推荐):
``bash docker build -t fastapi_bitnet . docker run -d --name ai_container -p 8080:8080 fastapi_bitnet ``
Claude Desktop配置
添加到claude_desktop_config.json:
{
"mcpServers": {
"fastapi-bitnet": {
"command": "http",
"args": ["http://localhost:8080/mcp"]
}
}
}FAQ
- 支持哪些模型?
- 目前支持GGUF格式的Microsoft BitNet-b1.58-2B-4T模型。
- 如何与VS Code集成?
- 运行服务器并配置VS Code Copilot将'http://localhost:8080/mcp'用作HTTP MCP服务器。
FastAPI-BitNet 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。