Skip to main content

PrivacyForms AI - LLM integration module

Project description

PrivacyForms AI

A Python CLI tool for interacting with Large Language Models (LLMs) via Simon Willison's llm library. Supports multiple providers including OpenAI, Anthropic, Moonshot, and Ollama.

Features

  • 🔧 Simple CLI - Easy-to-use command-line interface
  • 💬 Interactive Chat - Multi-turn conversations with context/memory
  • 🚀 Multiple Providers - Works with OpenAI, Anthropic, Moonshot, Ollama, and more
  • 🧪 Well Tested - Comprehensive test coverage
  • Fast - Built with modern Python tooling

Installation

Using uv (recommended)

# Clone the repository
git clone https://github.com/zopyx/privacyforms.ai.git
cd privacyforms.ai

# Install with uv
uv sync

# Or install in development mode
uv sync --all-extras --dev

Using pip

pip install privacyforms-ai

Configuration

Set your API keys as environment variables:

# OpenAI
export OPENAI_API_KEY="your-key"

# Anthropic
export ANTHROPIC_API_KEY="your-key"

# Moonshot
export MOONSHOT_API_KEY="your-key"

For Ollama, make sure the Ollama server is running locally.

Usage

List Available Models

privacyforms-ai models

# JSON output
privacyforms-ai models --json

Send a Single Prompt

# Basic prompt
privacyforms-ai prompt gpt-4o-mini "What is the capital of France?"

# With system prompt
privacyforms-ai prompt gpt-4o-mini "Explain recursion" --system "You are a computer science tutor"

Interactive Chat

Start an interactive chat session with conversation history:

# Basic chat
privacyforms-ai chat moonshot/kimi-k2.5

# With system prompt
privacyforms-ai chat gpt-4o-mini -s "You are a helpful coding assistant"

Chat Commands:

  • /quit, /exit, /q - End the chat session
  • /clear - Clear conversation history
  • /model - Show current model

Example session:

Starting chat with model: moonshot/kimi-k2.5
Type /quit, /exit, or /q to end the session. Type /clear to reset history.
--------------------------------------------------

You: Hello!

AI: Hello! How can I help you today?

You: What can you do?

AI: I can help with a variety of tasks including...

You: /quit

Goodbye!

Development

Setup

# Clone and setup
git clone https://github.com/zopyx/privacyforms.ai.git
cd privacyforms.ai
uv sync --all-extras --dev
source .venv/bin/activate

Running Tests

# Run all tests
make test

# With coverage
make test-cov

# Verbose output
uv run pytest -v

Code Quality

# Format code
make format

# Check formatting
make format-check

# Lint
make lint

# Auto-fix linting issues
make fix

# Type check
make type-check

# Run the full local gate
make check

Build Package

# Build release artifacts into dist/
make dist

Upload Package

# Upload to PyPI using twine and your ~/.pypirc or TWINE_* credentials
make upload

# Upload to another configured repository, e.g. TestPyPI
make upload TWINE_REPOSITORY=testpypi

Create a Release

# 1. Update the version in pyproject.toml, setup.py, cli.py, and tests

# 2. Refresh the lockfile if needed
uv sync --all-extras --dev

# 3. Verify and build
make check
make dist

# 4. Upload
make upload

# 5. Commit and tag
git add pyproject.toml setup.py src/privacyforms_ai/cli.py tests/ uv.lock
git commit -m "Release X.Y.Z"
git tag vX.Y.Z
git push origin HEAD
git push origin vX.Y.Z

API Design

See API_DESIGN.md for the REST API and WebSocket design specification for multi-chat server functionality.

Project Structure

privacyforms.ai/
├── src/privacyforms_ai/
│   ├── __init__.py
│   ├── ai.py              # AI class for LLM interactions
│   └── cli.py             # Click CLI commands
├── tests/
│   ├── conftest.py        # Pytest fixtures
│   ├── test_ai.py         # AI class tests
│   └── test_cli.py        # CLI tests
├── pyproject.toml         # Project configuration
├── uv.lock               # Locked dependencies
└── README.md

CI/CD

GitHub Actions workflow runs on:

  • Python 3.12, 3.13, 3.14, 3.14t (free-threaded)
  • Ubuntu Linux

Jobs:

  • test - Run pytest with coverage
  • lint - ruff (formatting, linting) and ty (type checking)

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Ensure all checks pass (uv run ruff format --check . && uv run ruff check . && uv run ty check src/ && uv run pytest)
  5. Submit a pull request

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

privacyforms_ai-0.1.2.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

privacyforms_ai-0.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file privacyforms_ai-0.1.2.tar.gz.

File metadata

  • Download URL: privacyforms_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for privacyforms_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 72963d06621246ebb2239741c553e17d81a0a09ce494598c6c19073f0ace4058
MD5 d26336385f4d357a7dea96df44c5dce1
BLAKE2b-256 86140f30d84450fda8d14fd010087726311ae0b029160fa2eded05a8d1eb795e

See more details on using hashes here.

File details

Details for the file privacyforms_ai-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for privacyforms_ai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9db76f5e01048116cd38667aa16723fd1ba7e544b62f43f3caae92f163e1706b
MD5 2fa36b66c9e66a1e3298101df0970446
BLAKE2b-256 d9bac7ff5a9c9c4ab1f942c3fe3e7e86204325bba4b038848ba97456fcecadf4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page