Omni Nli

io.github.CogitatorTech由 GitHub 账号 CogitatorTech 发布v0.1.1更新于 Oct 24, 2026

An MCP server for natural language inference

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

一个可自托管的自然语言推理服务器,让助手判断假设是被前提蕴含、与前提矛盾,还是与前提无关。

可以做什么
评估前提与假设文本对,返回蕴含、矛盾或中立三种标签之一,并给出置信度分数和可选的推理过程。作为验证层,检查生成内容是否有事实支撑或是否与先前陈述一致。核对摘要是否与原文矛盾,并检验检索到的文档是否蕴含查询。既可作为面向智能体的本地 MCP 服务器运行,也可作为独立的 REST 微服务运行。
适用场景
当你希望助手对生成内容、摘要或搜索结果与原文做事实核查或一致性检查,并且愿意自行运行和配置推理后端时适用。
运行要求
以 Python 包形式通过 pip 安装并在本地运行,使用 omni-nli 命令启动。需要模型后端,例如 Ollama、HuggingFace(含受限模型)或 OpenRouter,这些后端可能需要各自的账号或访问令牌。清单中未声明环境变量或请求头。
安装前请注意
README 说明项目处于早期开发阶段,可能出现缺陷和不兼容变更。结果质量高度依赖所选模型,建议用领域数据微调。使用 HuggingFace 或 OpenRouter 等托管后端时,文本可能被发送给第三方,并可能需要凭据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Omni Nli,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[Omni-NLI Logo]

Omni-NLI

[Tests] [Code Coverage] [Python Version] [PyPI] [Documentation] [License]
[Examples] [Docker Image (CPU)] [Docker Image (CUDA)]

A multi-interface (REST and MCP) server for natural language inference


Omni-NLI is a self-hostable server that provides natural language inference (NLI) capabilities via RESTful and the Model Context Protocol (MCP) interfaces. It can be used both as a very scalable standalone stateless microservice (via the REST API) and also as an MCP server for AI agents to implement a verification layer for AI-based applications.

[Architecture Diagram]

What is NLI?

Given two pieces of text called premise and hypothesis, NLI (AKA textual entailment) is the task of determining the directional relationship between them as it is perceived by a human reader. The relationship is given one of these three labels:

  • "entailment": the hypothesis is supported by the premise
  • "contradiction": the hypothesis is contradicted by the premise
  • "neutral": the hypothesis is neither supported nor contradicted by the premise

[!IMPORTANT] NLI is not the same as logical entailment. Its goal is to determine if a reasonable human would consider the hypothesis to follow from the premise. This checks for consistency instead of the absolute truth of the hypothesis.

Typical applications of NLI include:

  • NLI can be used to check if a given piece of text is consistent with the rest of the text. For example, if a new response from a chatbot or AI assistant contradicts something that was said earlier in the conversation.
  • It can be used to check if a summarization contradicts the original text in some way.
  • It can be used to check if the documents in the ranked list of results entail the query.
  • It can be used to check if a piece of text is supported by some facts. Note that this is not the same as using logic.

[!IMPORTANT] The quality of the results depends a lot on the model (the LLM) that is used. A good strategy is to first fine-tune the model using a dataset of premise-hypothesis-label triples that are relevant to your application domain.

Main Features of Omni-NLI

  • Helps mitigate LLM hallucinations by verifying if the generated content is supported by facts
  • Supports models provided by different backends, including Ollama, HuggingFace (public and private/gated models), and OpenRouter
  • Supports REST API (for traditional applications) and MCP (for AI agents) interfaces
  • Fully configurable and very scalable, with built-in caching
  • Provides confidence scores and (optional) reasoning traces for explainability

See ROADMAP.md for the list of implemented and planned features.

[!IMPORTANT] Omni-NLI is in early development, so bugs and breaking changes are expected. Please use the issues page to report bugs or request features.


Quickstart

1. Installation
sh
pip install omni-nli[huggingface]
2. Start the Server
sh
omni-nli
3. Evaluate NLI (with REST API)
sh
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

Example response:

json
{    "label": "contradiction",    "confidence": 0.99,    "model": "microsoft/Phi-3.5-mini-instruct",    "backend": "huggingface"}
4. Evaluate NLI (with MCP Interface)

[lm_studio_mcp_usage_example_1.png]


Documentation

Check out the Omni-NLI Documentation for more information, including configuration options, API reference, and examples.


Contributing

Contributions are always welcome! Please see CONTRIBUTING.md for details on how to get started.

License

Omni-NLI is licensed under the MIT License (see LICENSE).

Acknowledgements

  • The logo is from SVG Repo with some modifications.

来源:README.md,提交 943c1f2

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分