Skip to content

ApiOrProvider<TApi, TProvider>

Namespace: Vercel.AI

public sealed class ApiOrProvider<TApi, TProvider> where TApi : class where TProvider : class

An API or a provider that exposes one. Maps to the upstream Api | ProviderV4 unions.

Type parameters

Name Description
TApi The API type.
TProvider The provider type that exposes the API.

Inheritance: object

View source

public TApi? Api { get; }

The API, when this wraps one.

Value: TApi

View source

public TProvider? Provider { get; }

The provider, when this wraps one.

Value: TProvider

View source

public static ApiOrProvider<TApi, TProvider> FromApi(TApi api)

Wraps an API.

Parameters

Name Type Description
api TApi

Returns: ApiOrProvider<TApi, TProvider>

View source

public static ApiOrProvider<TApi, TProvider> FromProvider(TProvider provider)

Wraps a provider.

Parameters

Name Type Description
provider TProvider

Returns: ApiOrProvider<TApi, TProvider>

View source

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