Skip to content

AnthropicFiles

Namespace: Vercel.AI.Anthropic

public sealed class AnthropicFiles : IFileStore

Anthropic Files API upload.

Inheritance: object

Implements: IFileStore

View source

AnthropicFiles(ProviderHttp, Func<string>, Func<IReadOnlyDictionary<string, string?>>, string)

Section titled “AnthropicFiles(ProviderHttp, Func<string>, Func<IReadOnlyDictionary<string, string?>>, string)”
public AnthropicFiles(ProviderHttp http, Func<string> baseUrl, Func<IReadOnlyDictionary<string, string?>> headers, string provider)

Creates a files client.

Parameters

Name Type Description
http ProviderHttp
baseUrl Func<string>
headers Func<IReadOnlyDictionary<string, string>>
provider string

View source

public string Provider { get; }

Provider id.

Value: string

View source

public string SpecificationVersion { get; }

Specification version.

Value: string

View source

UploadAsync(string, byte[], string, bool?, CancellationToken)

Section titled “UploadAsync(string, byte[], string, bool?, CancellationToken)”
public Task<AnthropicUploadedFile> UploadAsync(string fileName, byte[] data, string mediaType, bool? downloadable, CancellationToken cancellationToken)

Uploads a file and returns the parsed Files API body.

Parameters

Name Type Description
fileName string
data byte[]
mediaType string
downloadable bool?
cancellationToken CancellationToken

Returns: Task<AnthropicUploadedFile>

View source

UploadFileAsync(string, byte[], string, CancellationToken)

Section titled “UploadFileAsync(string, byte[], string, CancellationToken)”
public Task<UploadedFile> UploadFileAsync(string fileName, byte[] data, string mediaType, CancellationToken cancellationToken)

Uploads a file.

Parameters

Name Type Description
fileName string
data byte[]
mediaType string
cancellationToken CancellationToken

Returns: Task<UploadedFile>

View source

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