Skip to content

Perspective adapter: optional custom endpoint (Perspective API shuts down 31 Dec 2026) - #593

Open
fstandhartinger wants to merge 1 commit into
OpenDCAI:mainfrom
fstandhartinger:perspective-custom-endpoint
Open

fstandhartinger wants to merge 1 commit into
OpenDCAI:mainfrom
fstandhartinger:perspective-custom-endpoint

Conversation

@fstandhartinger

Copy link
Copy Markdown

Google is shutting down the Perspective API on 31 December 2026. Right now the Perspective adapter hard-codes commentanalyzer.googleapis.com, so anyone who wants to keep the Perspective filter working after that date has to fork the code.

This PR adds two optional arguments, api_endpoint and discovery_service_url. If both are left out, nothing changes: Google stays the default and requests are byte-for-byte the same. Setting them points the existing googleapiclient client at any compatible endpoint, such as a self-hosted model or an adapter. The README section says that scores from a different model are not Perspective scores and that thresholds have to be calibrated again.

Tests: added test_perspective_custom_discovery_and_endpoint (cpu marker; default and custom URLs). The repo's own Python tests workflow passed on the fork on all 6 matrix jobs (Ubuntu 3.10-3.13, Windows 3.10/3.12): 610 passed.

Disclosure: I work on Decision Models, which runs a Perspective-shaped moderation endpoint. This patch does not name or prefer any vendor. If you'd rather handle the shutdown another way, feel free to close it.

Google remains the default. Lets users point the adapter at a compatible endpoint
(e.g. after the Perspective API shutdown on 31 Dec 2026) without forking.

This branch has not been deployed

No deployments
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