Metadata-Version: 2.4
Name: pydefend
Version: 1.0.0
Summary: AI security guardrails for LLM applications — scan inputs and check outputs with Claude, OpenAI, Gemini, Azure, or Ollama.
Author: Defend maintainers
License: Apache-2.0
Project-URL: Homepage, https://github.com/Adxzer/defend
Project-URL: Repository, https://github.com/Adxzer/defend
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: anyio>=4.0
Requires-Dist: httpx>=0.27
Requires-Dist: pyyaml>=6.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Provides-Extra: openai
Requires-Dist: openai>=1.57; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.42; extra == "anthropic"
Provides-Extra: gemini
Requires-Dist: google-genai>=1.69.0; extra == "gemini"
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.115; extra == "fastapi"
Requires-Dist: starlette>=0.38; extra == "fastapi"
Provides-Extra: langchain
Requires-Dist: langchain>=1.0.0; extra == "langchain"
Requires-Dist: langchain-core>=0.3.0; extra == "langchain"
Provides-Extra: all
Requires-Dist: openai>=1.57; extra == "all"
Requires-Dist: anthropic>=0.42; extra == "all"
Requires-Dist: google-genai>=1.69.0; extra == "all"
Requires-Dist: fastapi>=0.115; extra == "all"
Requires-Dist: starlette>=0.38; extra == "all"
Requires-Dist: langchain>=1.0.0; extra == "all"
Requires-Dist: langchain-core>=0.3.0; extra == "all"
Dynamic: license-file

# pydefend

AI security guardrails for LLM applications — scan inputs and check outputs with Claude, OpenAI, Gemini, Azure, or Ollama.

For the full project README, docs, and examples, see:

- **GitHub repo**: https://github.com/Adxzer/defend
- **Docs**: https://www.pydefend.com/docs

## Install

```bash
pip install pydefend
```

Optional provider extras:

```bash
pip install "pydefend[openai]"      # OpenAI SDK integration
pip install "pydefend[anthropic]"   # Anthropic SDK integration
pip install "pydefend[gemini]"      # Gemini (google-genai) SDK integration
pip install "pydefend[fastapi]"     # FastAPI middleware/integration helpers
pip install "pydefend[langchain]"   # LangChain integration helpers
pip install "pydefend[all]"         # All optional integrations
```

## Quick start

```python
import asyncio
from pydefend import Defend

defend = Defend.default()

async def main():
    scanned = await defend.scan("User message here")
    if not scanned:
        return "Can't help with that."

    # ... call your LLM with scanned.text ...

    checked = await defend.check("Model reply here")
    return checked.text if checked else None

print(asyncio.run(main()))
```

## Configuration

- **Code-first**: use `Defend.default()` or the builder API to choose modules.
- **Config file**: drop a `defend.yaml` into your repo and load it with `Defend.from_yaml("defend.yaml")`.

## Links

- **Repository / issues**: https://github.com/Adxzer/defend
- **Documentation**: https://www.pydefend.com/docs

## License

Apache-2.0 — see `LICENSE` in the GitHub repo.
