Repository navigation
Perspective adapter: optional custom endpoint (Perspective API shuts down 31 Dec 2026) - #593
Open
fstandhartinger wants to merge 1 commit into
Open
fstandhartinger wants to merge 1 commit into
fstandhartinger wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_endpointanddiscovery_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 existinggoogleapiclientclient 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 ownPython testsworkflow 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.