GenerateTextResponse

The response from the model, including candidate completions.

JSON representation
{
  "candidates": [
    {
      object (TextCompletion)
    }
  ],
  "filters": [
    {
      object (ContentFilter)
    }
  ],
  "safetyFeedback": [
    {
      object (SafetyFeedback)
    }
  ]
}
Fields
candidates[]

object (TextCompletion)

Candidate responses from the model.

filters[]

object (ContentFilter)

A set of content filtering metadata for the prompt and response text.

This indicates which SafetyCategory(s) blocked a candidate from this response, the lowest HarmProbability that triggered a block, and the HarmThreshold setting for that category. This indicates the smallest change to the SafetySettings that would be necessary to unblock at least 1 response.

The blocking is configured by the SafetySettings in the request (or the default SafetySettings of the API).

safetyFeedback[]

object (SafetyFeedback)

Returns any safety feedback related to content filtering.

TextCompletion

Output text returned from a model.

JSON representation
{
  "output": string,
  "safetyRatings": [
    {
      object (SafetyRating)
    }
  ],
  "citationMetadata": {
    object (CitationMetadata)
  }
}
Fields
output

string

Output only. The generated text returned from the model.

safetyRatings[]

object (SafetyRating)

Ratings for the safety of a response.

There is at most one rating per category.

citationMetadata

object (CitationMetadata)

Output only. Citation information for model-generated output in this TextCompletion.

This field may be populated with attribution information for any text included in the output.

SafetyRating

Safety rating for a piece of content.

The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here.

JSON representation
{
  "category": enum (HarmCategory),
  "probability": enum (HarmProbability)
}
Fields
category

enum (HarmCategory)

Required. The category for this rating.

probability

enum (HarmProbability)

Required. The probability of harm for this content.

HarmProbability

The probability that a piece of content is harmful.

The classification system gives the probability of the content being unsafe. This does not indicate the severity of harm for a piece of content.

Enums
HARM_PROBABILITY_UNSPECIFIED Probability is unspecified.
NEGLIGIBLE Content has a negligible chance of being unsafe.
LOW Content has a low chance of being unsafe.
MEDIUM Content has a medium chance of being unsafe.
HIGH Content has a high chance of being unsafe.

SafetyFeedback

Safety feedback for an entire request.

This field is populated if content in the input and/or response is blocked due to safety settings. SafetyFeedback may not exist for every HarmCategory. Each SafetyFeedback will return the safety settings used by the request as well as the lowest HarmProbability that should be allowed in order to return a result.

JSON representation
{
  "rating": {
    object (SafetyRating)
  },
  "setting": {
    object (SafetySetting)
  }
}
Fields
rating

object (SafetyRating)

Safety rating evaluated from content.

setting

object (SafetySetting)

Safety settings applied to the request.