Skip to main content

PerspectiveAnalyzeCommentResponse

Response returned by Respectify's public Perspective-compatible analyse endpoint.

from respectify.schemas import PerspectiveAnalyzeCommentAttributeScore, PerspectiveAnalyzeCommentResponse

Fields

attributeScores

Map of requested Perspective attribute names, such as TOXICITY or INSULT, to their score objects. Each value contains a summaryScore and, when requested, optional spanScores.

result.attributeScores: Dict[str, PerspectiveAnalyzeCommentAttributeScore]

languages

Requested or effective language context for this response, as language codes such as en, es, or fr.

result.languages: List[str]

detectedLanguages

Present only if Respectify actually detected languages, as language codes such as en, es, or fr.

result.detectedLanguages: Optional[List[str]]

clientToken

Caller-provided correlation token, echoed back unchanged when supplied. Use this if you want to match the response to your own request ID.

result.clientToken: Optional[str]

Sub-types

PerspectiveAnalyzeCommentAttributeScore

Google-style attribute score entry returned by analyzeComment.

FieldTypeDescription
summaryScorePerspectiveScoreOverall score for the attribute. This is the main score most integrations use for thresholds and moderation decisions.
spanScoresOptional[List[PerspectiveAnalyzeCommentSpanScore]]Optional scores for specific spans of text that contributed to the attribute. Returned only when span annotations were requested.

PerspectiveAnalyzeCommentSpanScore

Google-style span score for a specific part of the comment.

FieldTypeDescription
beginintStart offset for the span in UTF-16 code units
endintEnd offset for the span in UTF-16 code units
scorePerspectiveScoreScore for this specific span

PerspectiveScore

Google-style score object used in Perspective compatibility responses.

FieldTypeDescription
valuefloat # 0.0-1.0Probability-style score between 0.0 and 1.0. Higher numbers mean more of the requested attribute.
typestrScore type. Respectify currently returns PROBABILITY, meaning the value is a 0 to 1 probability-style score.