semfire


Namesemfire JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummarySemFire (Semantic Firewall): detect advanced AI deception, including in-context scheming and multi-turn manipulative attacks.
upload_time2025-10-21 12:31:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords semfire llm security prompt injection semantic firewall ai safety deception detection
VCS
bugtrack_url
requirements fastapi uvicorn pydantic httpx openai requests python-dotenv streamlit pytest hypothesis psutil rich colorama
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <img src="https://github.com/josephedward/SemFire/raw/main/assets/logo-v1_102025.jpg" alt="SemFire Logo" width="320">
</div>

# SemFire 

[![CI](https://github.com/josephedward/SemFire/actions/workflows/test.yml/badge.svg)](https://github.com/josephedward/SemFire/actions/workflows/test.yml)

 ## AI Deception Detection Toolkit

**SemFire (Semantic Firewall) is an open-source toolkit for detecting advanced AI deception, with a primary focus on "in-context scheming" and multi-turn manipulative attacks.** This project aims to develop tools to identify and mitigate vulnerabilities like the "Echo Chamber" and "Crescendo" attacks, where AI models are subtly guided towards undesirable behavior through conversational context.

### Project Vision: A Toolkit for AI Deception Detection

[History](./docs/context.md)

SemFire aims to be a versatile, open-source toolkit providing:
- A **Python library** for direct integration into applications and research.
- A **Command Line Interface (CLI)** for quick analysis and scripting.
- A **REST API service** (via FastAPI) for broader accessibility and enterprise use cases.
- Core components that can be integrated into broader semantic-firewall-like systems to monitor and analyze AI interactions in real-time.

## Features

 - Rule-based detector (`EchoChamberDetector`) for identifying cues related to "in-context scheming," context poisoning, semantic steering, and other multi-turn manipulative attack patterns (e.g., "Echo Chamber", "Crescendo").
 - Analyzes both current text input and conversation history to detect evolving deceptive narratives.
 - Heuristic-based detector (`HeuristicDetector`) for signals like text complexity and keyword usage.
 - ML-based classifiers to enhance detection of complex scheming behaviors over extended dialogues (Future Work).
 - Free API Image 
 - Enterprise API in Alpha 


## Installation
The project can be installed from PyPI:
```bash
pip install semfire
```

- **Quickstart :**[/docs/quickstart.md](./docs/quickstart.md)
- **Containerized CLI :** [/docs/docker-cli.md](./docs/docker-cli.md)
- **Usage :** [/docs/usage.md](./docs/usage.md)
- **LLM Providers for ai-as-judge features :** [/docs/providers.md](./docs/providers.md)

## Terminal Demos (GIFs)

[Examples](./docs/examples.md)

The following terminal demo GIFs are available under `assets/demos/asciinema/`:

**Quick Start**

![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/demo_01.small.gif)

**Individual Detectors**

![demo](https://raw.githubusercontent.com/josephedward/SemFire/main/assets/demos/asciinema/demo_02.small.gif)

**Python API**

![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/demo_03.small.gif)

**Complete Workflow**

![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/demo_04.small.gif)

**API: Health/Ready/Zip Analyze**

![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/api_health_ready_zip.small.gif)


<!-- **Library — Basic Usage**  
[![Library — Basic Usage](https://asciinema.org/a/Mtk3RcSxwF66REU6ymdPKlFrd.svg)](https://asciinema.org/a/Mtk3RcSxwF66REU6ymdPKlFrd)

**Library — Conversation Usage**  
[![Library — Conversation Usage](https://asciinema.org/a/BiQD6IxghsAQuRn684uRbiNdK.svg)](https://asciinema.org/a/BiQD6IxghsAQuRn684uRbiNdK)

**Transformers — Env Config**  
[![Transformers — Env Config](https://asciinema.org/a/aPTMLqFhpiOQraWxcR2DtkrUM.svg)](https://asciinema.org/a/aPTMLqFhpiOQraWxcR2DtkrUM)

**Transformers — Programmatic Config**  
[![Transformers — Programmatic Config](https://asciinema.org/a/8uGbIpHrnU4cKuJm8hSPyYepf.svg)](https://asciinema.org/a/8uGbIpHrnU4cKuJm8hSPyYepf)

 -->
<!-- - API: Analyze (DistilBERT Image Route)
  
  ![demo](assets/demos/asciinema/api_analyze_img.small.gif) -->

<!-- End Terminal Demos (GIFs) -->


## Contributing
Contributions are welcome! Please open an issue or submit a pull request.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "semfire",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "semfire, llm, security, prompt injection, semantic firewall, ai safety, deception detection",
    "author": null,
    "author_email": "Edward Joseph <hyperceptron@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1c/92/36ce0c17bb38bf7a1f24d57ec731dc7984c9d5851ecfda70f8923389f506/semfire-0.3.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <img src=\"https://github.com/josephedward/SemFire/raw/main/assets/logo-v1_102025.jpg\" alt=\"SemFire Logo\" width=\"320\">\n</div>\n\n# SemFire \n\n[![CI](https://github.com/josephedward/SemFire/actions/workflows/test.yml/badge.svg)](https://github.com/josephedward/SemFire/actions/workflows/test.yml)\n\n ## AI Deception Detection Toolkit\n\n**SemFire (Semantic Firewall) is an open-source toolkit for detecting advanced AI deception, with a primary focus on \"in-context scheming\" and multi-turn manipulative attacks.** This project aims to develop tools to identify and mitigate vulnerabilities like the \"Echo Chamber\" and \"Crescendo\" attacks, where AI models are subtly guided towards undesirable behavior through conversational context.\n\n### Project Vision: A Toolkit for AI Deception Detection\n\n[History](./docs/context.md)\n\nSemFire aims to be a versatile, open-source toolkit providing:\n- A **Python library** for direct integration into applications and research.\n- A **Command Line Interface (CLI)** for quick analysis and scripting.\n- A **REST API service** (via FastAPI) for broader accessibility and enterprise use cases.\n- Core components that can be integrated into broader semantic-firewall-like systems to monitor and analyze AI interactions in real-time.\n\n## Features\n\n - Rule-based detector (`EchoChamberDetector`) for identifying cues related to \"in-context scheming,\" context poisoning, semantic steering, and other multi-turn manipulative attack patterns (e.g., \"Echo Chamber\", \"Crescendo\").\n - Analyzes both current text input and conversation history to detect evolving deceptive narratives.\n - Heuristic-based detector (`HeuristicDetector`) for signals like text complexity and keyword usage.\n - ML-based classifiers to enhance detection of complex scheming behaviors over extended dialogues (Future Work).\n - Free API Image \n - Enterprise API in Alpha \n\n\n## Installation\nThe project can be installed from PyPI:\n```bash\npip install semfire\n```\n\n- **Quickstart :**[/docs/quickstart.md](./docs/quickstart.md)\n- **Containerized CLI :** [/docs/docker-cli.md](./docs/docker-cli.md)\n- **Usage :** [/docs/usage.md](./docs/usage.md)\n- **LLM Providers for ai-as-judge features :** [/docs/providers.md](./docs/providers.md)\n\n## Terminal Demos (GIFs)\n\n[Examples](./docs/examples.md)\n\nThe following terminal demo GIFs are available under `assets/demos/asciinema/`:\n\n**Quick Start**\n\n![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/demo_01.small.gif)\n\n**Individual Detectors**\n\n![demo](https://raw.githubusercontent.com/josephedward/SemFire/main/assets/demos/asciinema/demo_02.small.gif)\n\n**Python API**\n\n![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/demo_03.small.gif)\n\n**Complete Workflow**\n\n![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/demo_04.small.gif)\n\n**API: Health/Ready/Zip Analyze**\n\n![demo](https://github.com/josephedward/SemFire/raw/main/assets/demos/asciinema/api_health_ready_zip.small.gif)\n\n\n<!-- **Library \u2014 Basic Usage**  \n[![Library \u2014 Basic Usage](https://asciinema.org/a/Mtk3RcSxwF66REU6ymdPKlFrd.svg)](https://asciinema.org/a/Mtk3RcSxwF66REU6ymdPKlFrd)\n\n**Library \u2014 Conversation Usage**  \n[![Library \u2014 Conversation Usage](https://asciinema.org/a/BiQD6IxghsAQuRn684uRbiNdK.svg)](https://asciinema.org/a/BiQD6IxghsAQuRn684uRbiNdK)\n\n**Transformers \u2014 Env Config**  \n[![Transformers \u2014 Env Config](https://asciinema.org/a/aPTMLqFhpiOQraWxcR2DtkrUM.svg)](https://asciinema.org/a/aPTMLqFhpiOQraWxcR2DtkrUM)\n\n**Transformers \u2014 Programmatic Config**  \n[![Transformers \u2014 Programmatic Config](https://asciinema.org/a/8uGbIpHrnU4cKuJm8hSPyYepf.svg)](https://asciinema.org/a/8uGbIpHrnU4cKuJm8hSPyYepf)\n\n -->\n<!-- - API: Analyze (DistilBERT Image Route)\n  \n  ![demo](assets/demos/asciinema/api_analyze_img.small.gif) -->\n\n<!-- End Terminal Demos (GIFs) -->\n\n\n## Contributing\nContributions are welcome! Please open an issue or submit a pull request.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "SemFire (Semantic Firewall): detect advanced AI deception, including in-context scheming and multi-turn manipulative attacks.",
    "version": "0.3.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/josephedward/SemFire/issues",
        "Homepage": "https://github.com/josephedward/SemFire",
        "Repository": "https://github.com/josephedward/SemFire"
    },
    "split_keywords": [
        "semfire",
        " llm",
        " security",
        " prompt injection",
        " semantic firewall",
        " ai safety",
        " deception detection"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e8c52bdb5933b54dd372008ff63e140f3a468a0d4e56e25c0e9f3b40642bfac3",
                "md5": "e87e8af3f6a5cec59d218b03503c8572",
                "sha256": "1a9e49a0a37767c487632820806c3ed73f8d3051a8482c66bbb101cd5d818d81"
            },
            "downloads": -1,
            "filename": "semfire-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e87e8af3f6a5cec59d218b03503c8572",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 33341,
            "upload_time": "2025-10-21T12:31:56",
            "upload_time_iso_8601": "2025-10-21T12:31:56.888991Z",
            "url": "https://files.pythonhosted.org/packages/e8/c5/2bdb5933b54dd372008ff63e140f3a468a0d4e56e25c0e9f3b40642bfac3/semfire-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1c9236ce0c17bb38bf7a1f24d57ec731dc7984c9d5851ecfda70f8923389f506",
                "md5": "a6b1c54c89ead1d51e0661e12623bd8a",
                "sha256": "439e98410fa07907f27b22e729bcc015ee20b8de13f6a101d9b8ae19537cd052"
            },
            "downloads": -1,
            "filename": "semfire-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a6b1c54c89ead1d51e0661e12623bd8a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 10446527,
            "upload_time": "2025-10-21T12:31:58",
            "upload_time_iso_8601": "2025-10-21T12:31:58.171199Z",
            "url": "https://files.pythonhosted.org/packages/1c/92/36ce0c17bb38bf7a1f24d57ec731dc7984c9d5851ecfda70f8923389f506/semfire-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-21 12:31:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "josephedward",
    "github_project": "SemFire",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "fastapi",
            "specs": [
                [
                    ">=",
                    "0.111.0"
                ]
            ]
        },
        {
            "name": "uvicorn",
            "specs": [
                [
                    ">=",
                    "0.29.0"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2.0"
                ],
                [
                    "<",
                    "3.0"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    ">=",
                    "0.27.0"
                ]
            ]
        },
        {
            "name": "openai",
            "specs": [
                [
                    "<",
                    "1.0.0"
                ],
                [
                    ">=",
                    "0.27.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.28.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "streamlit",
            "specs": [
                [
                    ">=",
                    "1.20.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "8.0.0"
                ]
            ]
        },
        {
            "name": "hypothesis",
            "specs": [
                [
                    ">=",
                    "6.0.0"
                ]
            ]
        },
        {
            "name": "psutil",
            "specs": [
                [
                    ">=",
                    "5.9.0"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    ">=",
                    "13.7.1"
                ]
            ]
        },
        {
            "name": "colorama",
            "specs": [
                [
                    ">=",
                    "0.4.6"
                ]
            ]
        }
    ],
    "lcname": "semfire"
}
        
Elapsed time: 3.21900s