Skip to content

FilePartInput

Namespace: Vercel.AI.Prompt

public sealed class FilePartInput

A file-part value before it is converted to the v4 provider shape.

Inheritance: object

View source

public byte[]? Bytes { get; }

Inline bytes.

Value: byte[]

View source

public bool IsArrayBuffer { get; }

True when Bytes came from an ArrayBuffer and should be copied.

Value: bool

View source

public IReadOnlyDictionary<string, string>? Reference { get; }

Provider reference.

Value: IReadOnlyDictionary<string, string>

View source

public string? Text { get; }

Text payload.

Value: string

View source

public string? TextData { get; }

Inline base64 or any non-URL string.

Value: string

View source

public string? Type { get; }

Tagged type, when this value is already tagged.

Value: string

View source

public Uri? Url { get; }

URL instance.

Value: Uri

View source

public string? UrlText { get; }

URL string that has not been parsed yet.

Value: string

View source

public static FilePartInput FromArrayBuffer(byte[] bytes)

Creates an ArrayBuffer payload. The bytes are copied during conversion.

Parameters

Name Type Description
bytes byte[]

Returns: FilePartInput

View source

public static FilePartInput FromBytes(byte[] bytes)

Creates inline bytes.

Parameters

Name Type Description
bytes byte[]

Returns: FilePartInput

View source

FromReference(IReadOnlyDictionary<string, string>)

Section titled “FromReference(IReadOnlyDictionary<string, string>)”
public static FilePartInput FromReference(IReadOnlyDictionary<string, string> reference)

Creates a provider reference.

Parameters

Name Type Description
reference IReadOnlyDictionary<string, string>

Returns: FilePartInput

View source

public static FilePartInput FromString(string value)

Creates a string payload. URLs and data URLs are detected during conversion.

Parameters

Name Type Description
value string

Returns: FilePartInput

View source

public static FilePartInput FromUrl(Uri url)

Creates a URL payload.

Parameters

Name Type Description
url Uri

Returns: FilePartInput

View source

public static FilePartInput TaggedData(byte[] bytes)

Creates tagged inline bytes.

Parameters

Name Type Description
bytes byte[]

Returns: FilePartInput

View source

public static FilePartInput TaggedData(string data)

Creates tagged inline text. A data URL is rejected.

Parameters

Name Type Description
data string

Returns: FilePartInput

View source

public static FilePartInput TaggedDataBuffer(byte[] bytes)

Creates tagged inline bytes copied from an ArrayBuffer.

Parameters

Name Type Description
bytes byte[]

Returns: FilePartInput

View source

TaggedReference(IReadOnlyDictionary<string, string>)

Section titled “TaggedReference(IReadOnlyDictionary<string, string>)”
public static FilePartInput TaggedReference(IReadOnlyDictionary<string, string> reference)

Creates a tagged provider reference.

Parameters

Name Type Description
reference IReadOnlyDictionary<string, string>

Returns: FilePartInput

View source

public static FilePartInput TaggedText(string text)

Creates a tagged text part.

Parameters

Name Type Description
text string

Returns: FilePartInput

View source

public static FilePartInput TaggedUrl(Uri url)

Creates a tagged URL.

Parameters

Name Type Description
url Uri

Returns: FilePartInput

View source

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