messageContentDetailToGeminiPart
messageContentDetailToGeminiPart(
content
,client
):Promise
<Part
>
Defined in: .build/typescript/packages/providers/google/src/utils.ts:109
Converts a MessageContentDetail object into a Google Gemini Part object.
This function handles different content types appropriately for the Gemini API:
- Text content: Directly converts to Gemini text part
- Image URLs: Extracts MIME type and creates part from URI
- File/media content: Uploads to Google servers first, then creates part from uploaded URI
Parameters
Section titled “Parameters”content
Section titled “content”MessageContentDetail
The content to be converted (text, image URL, or base64 file data)
client
Section titled “client”GoogleGenAI
Google GenAI client
Returns
Section titled “Returns”Promise
<Part
>
Promise that resolves to a Gemini-compatible Part object
Throws
Section titled “Throws”When MIME type cannot be extracted from image URL
Throws
Section titled “Throws”When file upload fails
Throws
Section titled “Throws”When upload succeeds but URI or MIME type is missing from result