semvec/pypi-packages huggingface dataset:
noaiguarde 0.1.0
A lightweight Python package for first-level prompt safety checking using substring matching
Requires Python: >=3.12
Keywords: ai, safety, prompt, filter, moderation, content-filter

# noaiguarde 🛡️

A lightweight Python package for first-level prompt safety checking using simple substring matching.

[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://badge.fury.io/py/noaiguarde.svg)](https://badge.fury.io/py/noaiguarde)

## Installation

```bash
pip install noaiguarde
```

Or with uv:

```bash
uv add noaiguarde
```

## Quick Start

```python
from noaiguarde import check_prompt

# Safe prompts return True
check_prompt("Hello, how are you?")  # True
check_prompt("What's the weather today?")  # True

# Unsafe prompts return False
check_prompt("I hate you")  # False
check_prompt("Let's attack the server")  # False
```

## How It Works

noaiguarde performs **case-insensitive substring matching** against a bundled word list. If any word from the list is found within the prompt, it returns `False` (unsafe). Otherwise, it returns `True` (safe).

This is designed as a **first-level filter** - a quick, lightweight check before sending prompts to more sophisticated AI moderation systems.

## API Reference

### `check_prompt(prompt: str) -> bool`

Check if a prompt is safe.

**Parameters:**
- `prompt` (str): The text prompt to check.

**Returns:**
- `True` if the prompt is safe (no bad words found).
- `False` if the prompt contains any bad words.

**Example:**
```python
from noaiguarde import check_prompt

if check_prompt(user_input):
    # Safe to proceed
    send_to_ai(user_input)
else:
    # Block or flag the input
    handle_unsafe_input(user_input)
```

## Use Cases

- 🔒 **Pre-flight checks** before sending prompts to AI APIs
- 🚫 **Content filtering** in chatbots and user interfaces
- ⚡ **Quick screening** before expensive AI moderation calls
- 🛡️ **Defense in depth** as part of a multi-layer safety strategy

## Limitations

- **Substring matching only**: May produce false positives (e.g., "skill" contains "kill")
- **English only**: The bundled word list is in English
- **Not a complete solution**: Use alongside more sophisticated AI safety tools

## License

MIT License - see [LICENSE](LICENSE) for details.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
choicedesign 0.2.1
Experimental designs for discrete choice models.
Requires Python: <3.15,>=3.12

# ChoiceDesign

**ChoiceDesign** is a Python package tool to construct D-efficient designs for Discrete Choice Experiments. ChoiceDesign combines enough flexibility to construct from simple 2-alternative designs with few attributes, to more complex settings that may involve conditions between attributes. ChoiceDesign is a revamped version of [EDT](https://github.com/ighdez/EDT), a project I created some years ago for the same purpose. ChoiceDesign includes improvements over EDT such as class-based syntax, coding improvements, better documentation and making this package available to install via `pip`.

**NEW:** ChoiceDesign now integrates [Biogeme](https://biogeme.epfl.ch/), which allows you to customise the utility functions.

## Installation

ChoiceDesign is available to install via the regular syntax of `pip`:

* ``python3 -m pip install choicedesign``

## Features

The main features of ChoiceDesign are:

* D-efficient designs based on a random swapping algorithm
* **Customisable utility functions** (powered by [Biogeme](https://biogeme.epfl.ch/))
<!-- * Bayesian priors *(experimental)* -->
* Designs with conditions over different attribute levels
* Designs with blocks.
* Multiple stopping criteria (Fixed number of iterations, iterations without improvement or fixed time).

## Examples

I provide some Jupyter notebooks that illustrate the use of ChoiceDesign in the `examples/` folder of this repo.

## How to contribute?
Any contributions to ChoiceDesign are welcome via this Git, or to my email joseignaciohernandezh at gmail dot com.

## Disclaimer

This software is provided for free and as it is, say with **no warranty**, and neither me nor my current institution is liable of any consequence of the use of it. In any case, integrity checks have been performed by comparing results with alternative software.

## References
* Bierlaire, M. (2003). BIOGEME: A free package for the estimation of discrete choice models. In *Swiss transport research conference*.
* Kuhfeld, W. F. (2005). Experimental design, efficiency, coding, and choice designs. *Marketing research methods in SAS: Experimental design, choice, conjoint, and graphical techniques*, 47-97.
* Quan, W., Rose, J. M., Collins, A. T., & Bliemer, M. C. (2011). A comparison of algorithms for generating efficient choice experiments.