Class GenerateContentResponse
Response message for PredictionService.GenerateContent.
public record GenerateContentResponse : IEquatable<GenerateContentResponse>
- Inheritance
-
GenerateContentResponse
- Implements
- Inherited Members
Properties
Candidates
Response variations returned by the model.
[JsonPropertyName("candidates")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<Candidate>? Candidates { get; set; }
Property Value
CodeExecutionResult
Returns the code execution result output from the first candidate's first result part. Returns null if no code execution result parts are present.
public string? CodeExecutionResult { get; }
Property Value
CreateTime
Timestamp when the request is made to the server.
[JsonPropertyName("createTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? CreateTime { get; set; }
Property Value
ExecutableCode
Returns the executable code string from the first candidate's first executable code part. Returns null if no executable code parts are present.
public string? ExecutableCode { get; }
Property Value
FunctionCalls
Returns the list of function calls from the first candidate. Returns null if no function call parts are present.
public List<FunctionCall>? FunctionCalls { get; }
Property Value
ModelStatus
Output only. The current model status of this model. This field is not supported in Vertex AI.
[JsonPropertyName("modelStatus")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ModelStatus? ModelStatus { get; set; }
Property Value
ModelVersion
Output only. The model version used to generate the response.
[JsonPropertyName("modelVersion")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ModelVersion { get; set; }
Property Value
Parts
Returns the parts from the first candidate's content. Returns null if there are no candidates or no content.
public List<Part>? Parts { get; }
Property Value
PromptFeedback
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.
[JsonPropertyName("promptFeedback")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GenerateContentResponsePromptFeedback? PromptFeedback { get; set; }
Property Value
ResponseId
Output only. response_id is used to identify each response. It is the encoding of the event_id.
[JsonPropertyName("responseId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ResponseId { get; set; }
Property Value
SdkHttpResponse
Used to retain the full HTTP response.
[JsonPropertyName("sdkHttpResponse")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpResponse? SdkHttpResponse { get; set; }
Property Value
Text
Returns the concatenation of all text parts from the first candidate. Non-text parts are ignored. Returns null if no text parts are present.
public string? Text { get; }
Property Value
UsageMetadata
Usage metadata about the response(s).
[JsonPropertyName("usageMetadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GenerateContentResponseUsageMetadata? UsageMetadata { get; set; }
Property Value
Methods
FromJson(string, JsonSerializerOptions?)
Deserializes a JSON string to a GenerateContentResponse object.
public static GenerateContentResponse? FromJson(string jsonString, JsonSerializerOptions? options = null)
Parameters
jsonStringstringThe JSON string to deserialize.
optionsJsonSerializerOptionsOptional JsonSerializerOptions.
Returns
- GenerateContentResponse
The deserialized GenerateContentResponse object, or null if deserialization fails.