FileContentPart
Namespace: Vercel.AI.Provider
public sealed class FileContentPart : UserContentPartA file or image in a user message.
Inheritance: object → UserContentPart
Constructors
Section titled “Constructors”FileContentPart(string, string?, byte[]?, string?)
Section titled “FileContentPart(string, string?, byte[]?, string?)”public FileContentPart(string mediaType, string? url, byte[]? data, string? fileName)Creates a file part.
Parameters
| Name | Type | Description |
|---|---|---|
mediaType |
string | |
url |
string | |
data |
byte[] | |
fileName |
string |
Properties
Section titled “Properties”public byte[]? Data { get; }Inline bytes.
Value: byte[]
FileName
Section titled “FileName”public string? FileName { get; }Optional file name.
Value: string
MediaType
Section titled “MediaType”public string MediaType { get; }IANA media type.
Value: string
ProviderOptions
Section titled “ProviderOptions”public IReadOnlyDictionary<string, JsonElement>? ProviderOptions { get; init; }Provider-specific options for this part, such as the xAI imageDetail.
Value: IReadOnlyDictionary<string, JsonElement>
ProviderReference
Section titled “ProviderReference”public IReadOnlyDictionary<string, string>? ProviderReference { get; }Map from provider name to an uploaded file id, used when there is no URL or inline data.
Value: IReadOnlyDictionary<string, string>
public string? Url { get; }Remote URL, when the file is not inlined.
Value: string
Methods
Section titled “Methods”FromProviderReference(string, IReadOnlyDictionary<string, string>, string?, IReadOnlyDictionary<string, JsonElement>?)
Section titled “FromProviderReference(string, IReadOnlyDictionary<string, string>, string?, IReadOnlyDictionary<string, JsonElement>?)”public static FileContentPart FromProviderReference(string mediaType, IReadOnlyDictionary<string, string> providerReference, string? fileName = null, IReadOnlyDictionary<string, JsonElement>? providerOptions = null)Creates a file part that refers to an uploaded file. Maps to data: { type: "reference", reference }.
Parameters
| Name | Type | Description |
|---|---|---|
mediaType |
string | IANA media type. |
providerReference |
IReadOnlyDictionary<string, string> | Map from provider name to the provider’s file id. |
fileName |
string | Optional file name. |
providerOptions |
IReadOnlyDictionary<string, JsonElement> | Provider-specific options for this part. |
Returns: FileContentPart
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product