Functions
messageContentDetailToGeminiPart
messageContentDetailToGeminiPart(
content
,client
):Promise
<Part
>
Defined in: 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
content
MessageContentDetail
The content to be converted (text, image URL, or base64 file data)
client
GoogleGenAI
Google GenAI client
Returns
Promise
<Part
>
Promise that resolves to a Gemini-compatible Part object
Throws
When MIME type cannot be extracted from image URL
Throws
When file upload fails
Throws
When upload succeeds but URI or MIME type is missing from result