Package com.google.genai.types
Class Part
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.Part
A datatype containing media content.
Exactly one field within a Part should be set, representing the specific type of content being conveyed. Using multiple fields within the same `Part` instance is considered invalid.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Part.Builder
builder()
Instantiates a builder for Part.abstract Optional<CodeExecutionResult>
Optional.abstract Optional<ExecutableCode>
Optional.fileData()
Optional.static Part
Constructs a InlineData Part from a byte array and MIME type.static Part
fromFunctionCall
(String name, Map<String, Object> args) Constructs a FunctionCall Part from a function name and args.static Part
fromFunctionResponse
(String name, Map<String, Object> response) Constructs a FunctionResponse Part from a function name and response.static Part
Deserializes a JSON string to a Part object.static Part
Constructs a Text Part from a text string.static Part
Constructs a FileData Part from a file URI and MIME type.abstract Optional<FunctionCall>
Optional.abstract Optional<FunctionResponse>
Optional.Optional.text()
Optional.thought()
Indicates if the part is thought from the model.abstract Part.Builder
Creates a builder with the same values as this instance.abstract Optional<VideoMetadata>
Metadata for a given video.Methods inherited from class com.google.genai.JsonSerializable
fromJsonString, toJson
-
Constructor Details
-
Part
public Part()
-
-
Method Details
-
videoMetadata
Metadata for a given video. -
thought
Indicates if the part is thought from the model. -
inlineData
Optional. Inlined bytes data. -
codeExecutionResult
Optional. Result of executing the [ExecutableCode]. -
executableCode
Optional. Code generated by the model that is meant to be executed. -
fileData
Optional. URI based data. -
functionCall
Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values. -
functionResponse
Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model. -
text
Optional. Text part (can be code). -
builder
Instantiates a builder for Part. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a Part object. -
fromText
Constructs a Text Part from a text string. -
fromUri
Constructs a FileData Part from a file URI and MIME type. -
fromBytes
Constructs a InlineData Part from a byte array and MIME type. -
fromFunctionCall
Constructs a FunctionCall Part from a function name and args. -
fromFunctionResponse
Constructs a FunctionResponse Part from a function name and response.
-