Response message for [PredictionService.GenerateContent].
Output only. Generated candidates.
modelVersion
string
Output only. The model version used to generate the response.
Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.
Usage metadata about the response(s).
JSON representation |
---|
{ "candidates": [ { object ( |
Candidate
A response candidate generated from the model.
index
integer
Output only. Index of the candidate.
Output only. Content parts of the candidate.
avgLogprobs
number
Output only. Average log probability score of the candidate.
Output only. log-likelihood scores for the response tokens and top tokens
Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
Output only. List of ratings for the safety of a response candidate.
There is at most one rating per category.
Output only. Source attribution of the generated content.
Output only. metadata specifies sources used to ground generated content.
finishMessage
string
Output only. Describes the reason the mode stopped generating tokens in more detail. This is only filled when finishReason
is set.
JSON representation |
---|
{ "index": integer, "content": { object ( |
LogprobsResult
Logprobs result
Length = total number of decoding steps.
Length = total number of decoding steps. The chosen candidates may or may not be in topCandidates.
JSON representation |
---|
{ "topCandidates": [ { object ( |
TopCandidates
Candidates with top log probabilities at each decoding step.
Sorted by log probability in descending order.
JSON representation |
---|
{
"candidates": [
{
object ( |
Candidate
Candidate for the logprobs token and score.
token
string
The candidate's token string value.
tokenId
integer
The candidate's token id value.
logProbability
number
The candidate's log probability.
JSON representation |
---|
{ "token": string, "tokenId": integer, "logProbability": number } |
FinishReason
The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
Enums | |
---|---|
FINISH_REASON_UNSPECIFIED |
The finish reason is unspecified. |
STOP |
token generation reached a natural stopping point or a configured stop sequence. |
MAX_TOKENS |
token generation reached the configured maximum output tokens. |
SAFETY |
token generation stopped because the content potentially contains safety violations. NOTE: When streaming, content is empty if content filters blocks the output. |
RECITATION |
token generation stopped because the content potentially contains copyright violations. |
OTHER |
All other reasons that stopped the token generation. |
BLOCKLIST |
token generation stopped because the content contains forbidden terms. |
PROHIBITED_CONTENT |
token generation stopped for potentially containing prohibited content. |
SPII |
token generation stopped because the content potentially contains Sensitive Personally Identifiable Information (SPII). |
MALFORMED_FUNCTION_CALL |
The function call generated by the model is invalid. |
SafetyRating
Safety rating corresponding to the generated content.
Output only. Harm category.
Output only. Harm probability levels in the content.
probabilityScore
number
Output only. Harm probability score.
Output only. Harm severity levels in the content.
severityScore
number
Output only. Harm severity score.
blocked
boolean
Output only. Indicates whether the content was filtered out because of this rating.
JSON representation |
---|
{ "category": enum ( |
HarmProbability
Harm probability levels in the content.
Enums | |
---|---|
HARM_PROBABILITY_UNSPECIFIED |
Harm probability unspecified. |
NEGLIGIBLE |
Negligible level of harm. |
LOW |
Low level of harm. |
MEDIUM |
Medium level of harm. |
HIGH |
High level of harm. |
HarmSeverity
Harm severity levels.
Enums | |
---|---|
HARM_SEVERITY_UNSPECIFIED |
Harm severity unspecified. |
HARM_SEVERITY_NEGLIGIBLE |
Negligible level of harm severity. |
HARM_SEVERITY_LOW |
Low level of harm severity. |
HARM_SEVERITY_MEDIUM |
Medium level of harm severity. |
HARM_SEVERITY_HIGH |
High level of harm severity. |
CitationMetadata
A collection of source attributions for a piece of content.
Output only. List of citations.
JSON representation |
---|
{
"citations": [
{
object ( |
Citation
Source attributions for content.
startIndex
integer
Output only. Start index into the content.
endIndex
integer
Output only. End index into the content.
uri
string
Output only. url reference of the attribution.
title
string
Output only. title of the attribution.
license
string
Output only. License of the attribution.
Output only. Publication date of the attribution.
JSON representation |
---|
{
"startIndex": integer,
"endIndex": integer,
"uri": string,
"title": string,
"license": string,
"publicationDate": {
object ( |
GroundingMetadata
metadata returned to client when grounding is enabled.
webSearchQueries[]
string
Optional. Web search queries for the following-up web search.
retrievalQueries[]
string
Optional. Queries executed by the retrieval tools.
List of supporting references retrieved from specified grounding source.
Optional. List of grounding support.
Optional. Google search entry for the following-up web searches.
Optional. Output only. Retrieval metadata.
JSON representation |
---|
{ "webSearchQueries": [ string ], "retrievalQueries": [ string ], "groundingChunks": [ { object ( |
SearchEntryPoint
Google search entry point.
renderedContent
string
Optional. Web content snippet that can be embedded in a web page or an app webview.
Optional. Base64 encoded JSON representing array of <search term, search url> tuple.
A base64-encoded string.
JSON representation |
---|
{ "renderedContent": string, "sdkBlob": string } |
GroundingChunk
Grounding chunk.
chunk_type
. Chunk type. chunk_type
can be only one of the following:Grounding chunk from the web.
Grounding chunk from context retrieved by the retrieval tools.
JSON representation |
---|
{ // Union field |
Web
Chunk from the web.
uri
string
URI reference of the chunk.
title
string
title of the chunk.
JSON representation |
---|
{ "uri": string, "title": string } |
RetrievedContext
Chunk from context retrieved by the retrieval tools.
uri
string
URI reference of the attribution.
title
string
title of the attribution.
JSON representation |
---|
{ "uri": string, "title": string } |
GroundingSupport
Grounding support.
groundingChunkIndices[]
integer
A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the retrieved content attributed to the claim.
confidenceScores[]
number
confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. This list must have the same size as the groundingChunkIndices.
Segment of the content this support belongs to.
JSON representation |
---|
{
"groundingChunkIndices": [
integer
],
"confidenceScores": [
number
],
"segment": {
object ( |
Segment
Segment of the content.
partIndex
integer
Output only. The index of a Part object within its parent Content object.
startIndex
integer
Output only. Start index in the given Part, measured in bytes. offset from the start of the Part, inclusive, starting at zero.
endIndex
integer
Output only. End index in the given Part, measured in bytes. offset from the start of the Part, exclusive, starting at zero.
text
string
Output only. The text corresponding to the segment from the response.
JSON representation |
---|
{ "partIndex": integer, "startIndex": integer, "endIndex": integer, "text": string } |
RetrievalMetadata
metadata related to retrieval in the grounding flow.
googleSearchDynamicRetrievalScore
number
Optional. Score indicating how likely information from Google Search could help answer the prompt. The score is in the range [0, 1]
, where 0 is the least likely and 1 is the most likely. This score is only populated when Google Search grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine whether to trigger Google Search.
JSON representation |
---|
{ "googleSearchDynamicRetrievalScore": number } |
PromptFeedback
Content filter results for a prompt sent in the request.
Output only. Blocked reason.
Output only. Safety ratings.
blockReasonMessage
string
Output only. A readable block reason message.
JSON representation |
---|
{ "blockReason": enum ( |
BlockedReason
Blocked reason enumeration.
Enums | |
---|---|
BLOCKED_REASON_UNSPECIFIED |
Unspecified blocked reason. |
SAFETY |
Candidates blocked due to safety. |
OTHER |
Candidates blocked due to other reason. |
BLOCKLIST |
Candidates blocked due to the terms which are included from the terminology blocklist. |
PROHIBITED_CONTENT |
Candidates blocked due to prohibited content. |
UsageMetadata
Usage metadata about response(s).
promptTokenCount
integer
Number of tokens in the request. When cachedContent
is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.
candidatesTokenCount
integer
Number of tokens in the response(s).
totalTokenCount
integer
Total token count for prompt and response candidates.
cachedContentTokenCount
integer
Output only. Number of tokens in the cached part in the input (the cached content).
JSON representation |
---|
{ "promptTokenCount": integer, "candidatesTokenCount": integer, "totalTokenCount": integer, "cachedContentTokenCount": integer } |