A multi-interface (REST and MCP) server for natural language inference
Project description
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 and also as an MCP server for AI agents to implement a verification layer for AI-based applications like chatbots or virtual assistants.
What is NLI?
Given two pieces of text called premise and hypothesis, NLI is the task of determining the logical relationship between them if it was done by a human. The relationship is typically shown by one of 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
NLI is useful for a lot of applications, like fact-checking the output of large language models (LLMs) and checking the correctness of the answers a question-answering system generates.
Main Features
- 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
Below is the high-level architecture of Omni-NLI:
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
pip install omni-nli
2. Start the Server
omni-nli
3. Evaluate NLI
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:
{
"label": "contradiction",
"confidence": 0.99,
"model": "microsoft/Phi-3.5-mini-instruct",
"backend": "huggingface"
}
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omni_nli-0.1.0a3.tar.gz.
File metadata
- Download URL: omni_nli-0.1.0a3.tar.gz
- Upload date:
- Size: 216.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95366585ab7dae0144ac131dec1da7d2beb27b7d53f21887583b70537da3c2b0
|
|
| MD5 |
8ec53ff24c7a34134f9d8f3e6e5fe87d
|
|
| BLAKE2b-256 |
b60e5c53c97ca2f0e0a92a4e835be0b608c5b6956f01d6c76e2aa905fc4be92e
|
File details
Details for the file omni_nli-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: omni_nli-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af88bf2cfe51fe66801f29b5154b83fea4bcf04f7d6b04cc9c370eebd862749a
|
|
| MD5 |
2804366d05875e98bbb46c460a81d432
|
|
| BLAKE2b-256 |
22cc4c8121e3d4dc4afd5b78ceb8cf782b15823b0b0d89dcb510dac212c90108
|