TextPart

class TextPart : Part


Represents text or string based data sent to and received from requests.

Summary

Public companion functions

TextPart
@PublicPreviewAPI
createWithThinking(
    text: String,
    isThought: Boolean,
    thoughtSignature: String?
)

Creates a TextPart with advanced thinking metadata.

Public constructors

TextPart(text: String, speechMetadata: SpeechMetadata)

Public properties

open Boolean

Indicates whether the response is a thought.

SpeechMetadata?

Optional SpeechMetadata used to guide speech generation for this text, such as the speaker and vocal style.

String

The text content of the part.

String?

Optional A blob used to by the model to preserve state.

Public companion functions

createWithThinking

@PublicPreviewAPI
fun createWithThinking(
    text: String,
    isThought: Boolean,
    thoughtSignature: String?
): TextPart

Creates a TextPart with advanced thinking metadata.

Parameters
text: String

The text content of the part.

isThought: Boolean

Indicates whether the response is a thought.

thoughtSignature: String?

The signature associated with the thought, if any.

Public constructors

TextPart

TextPart(text: String)

TextPart

TextPart(text: String, speechMetadata: SpeechMetadata)
Parameters
text: String

The text content of the part.

speechMetadata: SpeechMetadata

The SpeechMetadata used to guide speech generation for this text.

Public properties

isThought

open val isThought: Boolean

Indicates whether the response is a thought.

speechMetadata

@PublicPreviewAPI
val speechMetadata: SpeechMetadata?

Optional SpeechMetadata used to guide speech generation for this text, such as the speaker and vocal style.

text

val text: String

The text content of the part.

thoughtSignature

val thoughtSignature: String?

Optional A blob used to by the model to preserve state.