{
  "markdown": "<div align=\"center\">\n  <picture>\n    <img alt=\"Omni-NLI Logo\" src=\"logo.svg\" width=\"200\">\n  </picture>\n<br>\n\n<h2>Omni-NLI</h2>\n\n[![Tests](https://img.shields.io/github/actions/workflow/status/CogitatorTech/omni-nli/tests.yml?label=tests&style=flat&labelColor=333333&logo=github&logoColor=white)](https://github.com/CogitatorTech/omni-nli/actions/workflows/tests.yml)\n[![Code Coverage](https://img.shields.io/codecov/c/github/CogitatorTech/omni-nli?style=flat&label=coverage&labelColor=333333&logo=codecov&logoColor=white)](https://codecov.io/gh/CogitatorTech/omni-nli)\n[![Python Version](https://img.shields.io/badge/python-%3E=3.10-3776ab?style=flat&labelColor=333333&logo=python&logoColor=white)](https://github.com/CogitatorTech/omni-nli)\n[![PyPI](https://img.shields.io/pypi/v/omni-nli?style=flat&labelColor=333333&logo=pypi&logoColor=white)](https://pypi.org/project/omni-nli/)\n[![Documentation](https://img.shields.io/badge/docs-read-00acc1?style=flat&labelColor=282c34&logo=readthedocs)](https://CogitatorTech.github.io/omni-nli/)\n[![License](https://img.shields.io/badge/license-MIT-00acc1?style=flat&labelColor=333333&logo=open-source-initiative&logoColor=white)](https://github.com/CogitatorTech/omni-nli/blob/main/LICENSE)\n<br>\n[![Examples](https://img.shields.io/badge/examples-view-green?style=flat&labelColor=382c34)](https://github.com/CogitatorTech/omni-nli/tree/main/examples)\n[![Docker Image (CPU)](https://img.shields.io/badge/Docker-CPU-007ec6?style=flat&logo=docker)](https://github.com/CogitatorTech/omni-nli/pkgs/container/omni-nli-cpu)\n[![Docker Image (CUDA)](https://img.shields.io/badge/Docker-CUDA-007ec6?style=flat&logo=docker)](https://github.com/CogitatorTech/omni-nli/pkgs/container/omni-nli-cuda)\n\nA multi-interface (REST and MCP) server for natural language inference\n\n</div>\n\n---\n\nOmni-NLI is a self-hostable server that provides [natural language inference (NLI)](https://en.wikipedia.org/wiki/Textual_entailment) capabilities via\nRESTful and the Model Context Protocol (MCP) interfaces.\nIt 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\nverification layer for AI-based applications.\n\n![Architecture Diagram](docs/assets/diagrams/architecture.svg)\n\n### What is NLI?\n\nGiven two pieces of text called premise and hypothesis, NLI (AKA textual entailment) is the task of determining the directional relationship between\nthem as it is perceived by a human reader.\nThe relationship is given one of these three labels:\n\n- `\"entailment\"`: the hypothesis is supported by the premise\n- `\"contradiction\"`: the hypothesis is contradicted by the premise\n- `\"neutral\"`: the hypothesis is neither supported nor contradicted by the premise\n\n> [!IMPORTANT]\n> NLI is not the same as logical entailment.\n> Its goal is to determine if a reasonable human would consider the hypothesis to follow from the premise.\n> This checks for consistency instead of the absolute truth of the hypothesis.\n\nTypical applications of NLI include:\n\n* 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\n  from a chatbot or AI assistant contradicts something that was said earlier in the conversation.\n* It can be used to check if a summarization contradicts the original text in some way.\n* It can be used to check if the documents in the ranked list of results entail the query.\n* 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.\n\n> [!IMPORTANT]\n> The quality of the results depends a lot on the model (the LLM) that is used.\n> 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.\n\n### Main Features of Omni-NLI\n\n- Helps mitigate LLM hallucinations by verifying if the generated content is supported by facts\n- Supports models provided by different backends, including Ollama, HuggingFace (public and private/gated models), and OpenRouter\n- Supports REST API (for traditional applications) and MCP (for AI agents) interfaces\n- Fully configurable and very scalable, with built-in caching\n- Provides confidence scores and (optional) reasoning traces for explainability\n\nSee [ROADMAP.md](ROADMAP.md) for the list of implemented and planned features.\n\n> [!IMPORTANT]\n> Omni-NLI is in early development, so bugs and breaking changes are expected.\n> Please use the [issues page](https://github.com/CogitatorTech/omni-nli/issues) to report bugs or request features.\n\n---\n\n### Quickstart\n\n#### 1. Installation\n\n```sh\npip install omni-nli[huggingface]\n```\n\n#### 2. Start the Server\n\n```sh\nomni-nli\n```\n\n#### 3. Evaluate NLI (with REST API)\n\n```sh\ncurl -X POST \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"premise\": \"A football player kicks a ball into the goal.\",\n    \"hypothesis\": \"The football player is asleep on the field.\"\n  }' \\\n  http://127.0.0.1:8000/api/v1/nli/evaluate\n```\n\nExample response:\n\n```json\n{\n    \"label\": \"contradiction\",\n    \"confidence\": 0.99,\n    \"model\": \"microsoft/Phi-3.5-mini-instruct\",\n    \"backend\": \"huggingface\"\n}\n```\n\n#### 4. Evaluate NLI (with MCP Interface)\n\n![lm_studio_mcp_usage_example_1.png](docs/assets/screenshots/lm_studio_mcp_usage_example_1.png)\n\n---\n\n### Documentation\n\nCheck out the [Omni-NLI Documentation](https://cogitatortech.github.io/omni-nli/) for more information, including configuration options, API\nreference, and examples.\n\n---\n\n### Contributing\n\nContributions are always welcome!\nPlease see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to get started.\n\n### License\n\nOmni-NLI is licensed under the MIT License (see [LICENSE](LICENSE)).\n\n### Acknowledgements\n\n- The logo is from [SVG Repo](https://www.svgrepo.com/svg/480613/puzzle-9) with some modifications.\n\n<!-- Need to add this line for MCP registry publication -->\n<!-- mcp-name: io.github.CogitatorTech/omni-nli -->\n",
  "bytes": 5966,
  "sha": "ac0ef477a6d9c6bc5ae72aab87c494fb9eb92e7a57af005a9b2badd3cec5c7a9",
  "repo_slug": "cogitatortech/omni-nli",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cogitatortech_omni_nli_fc3ae01c/readme"
}