GenerateObjectResponse

class GenerateObjectResponse<T : Any>


A GenerateContentResponse augmented with class information.

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

Summary

Public functions

T?
getObject(candidateIndex: Int)

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

Public properties

GenerateContentResponse

Public functions

getObject

fun getObject(candidateIndex: Int = 0): T?

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

Parameters
candidateIndex: Int = 0

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

Public properties