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 -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Part.Builderbuilder()Instantiates a builder for Part.abstract Optional<CodeExecutionResult>Optional.abstract Optional<ExecutableCode>Optional.fileData()Optional.static PartConstructs a InlineData Part from a byte array and MIME type.static PartfromFunctionCall(String name, Map<String, Object> args) Constructs a FunctionCall Part from a function name and args.static PartfromFunctionResponse(String name, Map<String, Object> response, FunctionResponsePart... functionResponseParts) Constructs a FunctionResponse Part from a function name, response and function response parts.static PartDeserializes a JSON string to a Part object.static PartConstructs a Text Part from a text string.static PartConstructs a FileData Part from a file URI and MIME type.abstract Optional<FunctionCall>Optional.abstract Optional<FunctionResponse>Optional.Optional.abstract Optional<PartMediaResolution>Media resolution for the input media.text()Optional.thought()Optional.abstract Optional<byte[]>Optional.abstract Part.BuilderCreates a builder with the same values as this instance.abstract Optional<VideoMetadata>Optional.Methods inherited from class com.google.genai.JsonSerializable
setMaxReadLength, stringToJsonNode, toJson
-
Constructor Details
-
Part
public Part()
-
-
Method Details
-
mediaResolution
Media resolution for the input media. -
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. -
inlineData
Optional. Inlined bytes data. -
text
Optional. Text part (can be code). -
thought
Optional. Indicates if the part is thought from the model. -
thoughtSignature
Optional. An opaque signature for the thought so it can be reused in subsequent requests. -
videoMetadata
Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data. -
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
public static Part fromFunctionResponse(String name, Map<String, Object> response, FunctionResponsePart... functionResponseParts) Constructs a FunctionResponse Part from a function name, response and function response parts.
-