GenerateObjectResponse

public final class GenerateObjectResponse<T extends Object>


A GenerateContentResponse augmented with class information.

Use getObject to parse the response and extract the strongly typed object.

Summary

Public methods

final T
getObject(int candidateIndex)

Deserialize a candidate (default first) and convert it into the type associated with this response.

Public fields

response

public final @NonNull GenerateContentResponse response

Public methods

getObject

public final T getObject(int candidateIndex)

Deserialize a candidate (default first) and convert it into the type associated with this response.

Parameters
int candidateIndex

which candidate to deserialize

Throws
kotlin.RuntimeException kotlin.RuntimeException

if class is not @Serializable

com.google.firebase.ai.type.SerializationException com.google.firebase.ai.type.SerializationException

if an error occurs during deserialization