The Part type is a union type used to represent different types of content within a request or response in the Gemini API. It allows you to compose multi-modal inputs (text, images, files) or handle structured data like function calls and code execution results.
Depending on your use case, a Part can be one of the following:
TextPart: Plain text content.InlineDataPart: Base64 encoded data (e.g., images).FunctionCallPart: A request from the model to call a specific function.FunctionResponsePart: The result of a function call provided back to the model.FileDataPart: Reference to a file already uploaded to the Gemini File API.ExecutableCodePart: Code intended for execution.CodeExecutionResultPart: The output/result of executed code.
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;