Back to MCP directory
publicPublicdnsLocal runtime

omni-nli

Omni-NLI是一个可自托管的多接口(REST和MCP)服务器,专注于自然语言推理任务,用于验证文本间的支持、矛盾或中立关系,可帮助减少AI幻觉并提升应用可靠性。

article

README

🚀 Omni-NLI

Omni-NLI 是一个可自托管的服务器,它通过 RESTful 和模型上下文协议(MCP)接口提供自然语言推理(NLI)功能。既可以作为可扩展的无状态独立微服务(通过 REST API)使用,也能作为 MCP 服务器,为基于 AI 的应用程序中的 AI 代理实现验证层。

🚀 快速开始

1. 安装

pip install omni-nli[huggingface]

2. 启动服务器

omni-nli

3. 使用 REST API 进行自然语言推理评估

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "premise": "A football player kicks a ball into the goal.",
    "hypothesis": "The football player is asleep on the field."
  }' \
  http://127.0.0.1:8000/api/v1/nli/evaluate

示例响应:

{
    "label": "contradiction",
    "confidence": 0.99,
    "model": "microsoft/Phi-3.5-mini-instruct",
    "backend": "huggingface"
}

4. 使用 MCP 接口进行自然语言推理评估

lm_studio_mcp_usage_example_1.png

✨ 主要特性

  • 通过验证生成的内容是否有事实依据,帮助减少大语言模型(LLM)的幻觉问题。
  • 支持不同后端提供的模型,包括 Ollama、HuggingFace(公共和私有/受限模型)和 OpenRouter。
  • 支持 REST API(适用于传统应用程序)和 MCP(适用于 AI 代理)接口。
  • 完全可配置且具有高可扩展性,内置缓存功能。
  • 提供置信度分数和(可选)推理轨迹,以增强可解释性。

查看 ROADMAP.md 了解已实现和计划实现的功能列表。

⚠️ 重要提示

Omni-NLI 处于早期开发阶段,因此可能会出现 bug 和重大变更。请使用 问题页面 报告 bug 或请求新功能。

📚 详细文档

查看 Omni-NLI 文档 了解更多信息,包括配置选项、API 参考和示例。

🤝 贡献代码

欢迎贡献代码!请查看 CONTRIBUTING.md 了解如何开始贡献。

📄 许可证

Omni-NLI 采用 MIT 许可证(请参阅 LICENSE)。

👏 鸣谢

  • 图标来自 SVG Repo,并进行了一些修改。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client