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
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
-
Constructor Details
-
Part
public Part()
-
-
Method Details
-
mediaResolution
Media resolution for the input media. -
codeExecutionResult
Optional. The result of executing the ExecutableCode. -
executableCode
Optional. Code generated by the model that is intended to be executed. -
fileData
Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage. -
functionCall
Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function. -
functionResponse
Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted. -
inlineData
Optional. The inline data content of the part. This can be used to include images, audio, or video in a request. -
text
Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent. -
thought
Optional. Indicates whether the `part` represents the model's thought process or reasoning. -
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.
-