Skip to content

FileDataConversions

Namespace: Vercel.AI.ProviderUtils

public static class FileDataConversions

Converts file payloads to the forms providers send.

Inheritance: object

View source

ConvertImageModelFileToDataUri(ImageModelFile)

Section titled “ConvertImageModelFileToDataUri(ImageModelFile)”
public static string ConvertImageModelFileToDataUri(ImageModelFile file)

Returns the URL of a URL file, or a base64 data URI for a file with bytes. Maps to convertImageModelFileToDataUri.

Parameters

Name Type Description
file ImageModelFile

Returns: string

View source

ConvertInlineFileDataToUint8Array(LanguageModelFilePart)

Section titled “ConvertInlineFileDataToUint8Array(LanguageModelFilePart)”
public static byte[] ConvertInlineFileDataToUint8Array(LanguageModelFilePart part)

Returns the bytes of an inline data or text file part. Base64 data is decoded and text is UTF-8 encoded. Maps to convertInlineFileDataToUint8Array.

Parameters

Name Type Description
part LanguageModelFilePart

Returns: byte[]

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product