Skip to content

Add OpenAI provider support - #5

Merged
dtump merged 3 commits into
mainfrom
add-openai-support
Apr 14, 2026
Merged

Add OpenAI provider support#5
dtump merged 3 commits into
mainfrom
add-openai-support

Conversation

@dtump

@dtump dtump commented Apr 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add OpenAI as a second AI provider (default model: gpt-5.4-mini)
  • Add provider dispatcher (ai_spam_check.py) that routes to the configured provider via settings.provider in config.ini (defaults to anthropic)
  • Extract shared system prompt into email_utils/prompts.py
  • Improve system prompt: explicit spam/not-spam definitions, detection hints (DKIM/SPF, suspicious domains, pressure tactics), confidence scale anchoring, truncation disclaimer
  • Add openai>=2.0,<3.0 dependency
  • Add config.ini.default sections for provider selection and OpenAI
  • Add 10 new tests (42 total): OpenAI provider, dispatcher routing, default behavior
  • Update README with provider configuration docs and supported models table
  • Update AGENTS.md with multi-provider architecture notes and PR checklist

Test plan

  • ruff check . && ruff format --check . — clean
  • pytest -v — 42 tests pass
  • Verify CI passes
  • Test with provider = anthropic (existing behavior unchanged)
  • Test with provider = openai and a valid OpenAI API key

dtump added 3 commits April 14, 2026 22:54
- Add provider dispatcher (ai_spam_check.py) that routes to the
  configured provider based on settings.provider in config.ini
- Add OpenAI provider (openai_spam_check.py) using gpt-5.4-mini
- Extract shared system prompt into email_utils/prompts.py
- Rename check_spam_with_ai to check_spam_with_anthropic in the
  Anthropic module; public API remains check_spam_with_ai via dispatcher
- Add openai>=2.0,<3.0 dependency
- Add config.ini.default sections for provider selection and OpenAI
- Add tests for OpenAI provider, dispatcher routing, and default behavior
- Update AGENTS.md with multi-provider architecture docs
- Add configuration section with provider selection, config example,
  and supported providers table
- Add PR checklist to AGENTS.md (always check if README needs updates)
- Define what counts as spam vs not spam explicitly
- Add detection hints (DKIM/SPF failures, suspicious domains, pressure tactics)
- Clarify that URL/list truncation is preprocessing, not a spam signal
- Anchor confidence scale for consistent scoring
- Request no markdown wrapping in response
@dtump
dtump merged commit bc23c3a into main Apr 14, 2026
4 checks passed
@dtump
dtump deleted the add-openai-support branch April 14, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant