class_docstr: Perspective API predicts the perceived impact a comment may have on a conversation by evaluating that comment
  across a range of emotional concepts, called attributes. When you send a request to the API, you’ll request the
  specific attributes you want to receive scores for.
  
  The API is hosted on Google Cloud Platform.
  
  Source: https://developers.perspectiveapi.com/s/docs
class_docstr_tok: ["Perspective","API","predicts","the","perceived","impact","a","comment","may","have","on","a","conversation","by","evaluating","that","comment","across","a","range","of","emotional","concepts",",","called","attributes",".","When","you","send","a","request","to","the","API",",","you","\u2019","ll","request","the","specific","attributes","you","want","to","receive","scores","for",".","The","API","is","hosted","on","Google","Cloud","Platform",".","Source",":","https",":","\/\/developers.perspectiveapi.com\/s\/docs"]
docstr: Given a response from PerspectiveAPI, return `ToxicityScores`.
docstr_tok: ["Given","a","response","from","PerspectiveAPI",",","return","`","ToxicityScores","`","."]
code: def extract_toxicity_attributes(response: Dict) -> ToxicityAttributes:
      """Given a response from PerspectiveAPI, return `ToxicityScores`."""
      all_scores = {
          f"{attribute.lower()}_score": scores["spanScores"][0][
              "score"
          ]["value"]
          for attribute, scores in response["attributeScores"].items()
      }
      return from_dict(data_class=ToxicityAttributes, data=all_scores)
  
file_path: H2O/h2o_hf/helm/src/helm/proxy/clients/perspective_api_client.py
imports: import threading
  from dataclasses import asdict
  from typing import List, Dict, Optional
  from dacite import from_dict
  from googleapiclient import discovery
  from googleapiclient.errors import BatchError, HttpError
  from googleapiclient.http import BatchHttpRequest
  from httplib2 import HttpLib2Error
  from helm.common.cache import Cache, CacheConfig
  from helm.common.perspective_api_request import ToxicityAttributes, PerspectiveAPIRequest, PerspectiveAPIRequestResult
label_desc: Use image node_id 2 for calling the PerspectiveAPIClient obj's underlying member method code with example usage: obj.extract_toxicity_attributes(response) and returns: from_dict