Skip to content

GoogleProvider

Namespace: Vercel.AI.Google

public class GoogleProvider : ProviderBase, IBatchProvider

Google Gemini provider.

Inheritance: object → ProviderBase

Implements: IBatchProvider

Derived: GoogleVertexProvider

View source

GoogleProvider(HttpClient, GoogleOptions?)

Section titled “GoogleProvider(HttpClient, GoogleOptions?)”
public GoogleProvider(HttpClient httpClient, GoogleOptions? options = null)

Creates a provider.

Parameters

Name Type Description
httpClient HttpClient
options GoogleOptions

View source

GoogleProvider(HttpClient, GoogleOptions?, string)

Section titled “GoogleProvider(HttpClient, GoogleOptions?, string)”
protected GoogleProvider(HttpClient httpClient, GoogleOptions? options, string modelProvider)

Creates a provider with an explicit model provider id.

Parameters

Name Type Description
httpClient HttpClient
options GoogleOptions
modelProvider string

View source

public const string ProviderName = "google"

Provider id.

Value: string

View source

public Func<DateTimeOffset> Clock { get; set; }

Clock used for response timestamps.

Value: Func<DateTimeOffset>

View source

public ProviderHttp Http { get; }

HTTP helper.

Value: ProviderHttp

View source

public string ModelProvider { get; }

Provider id recorded on models, such as google.generative-ai or google.vertex.chat.

Value: string

View source

public GoogleOptions Options { get; }

Options.

Value: GoogleOptions

View source

Create(GoogleOptions?, HttpMessageHandler?)

Section titled “Create(GoogleOptions?, HttpMessageHandler?)”
public static GoogleProvider Create(GoogleOptions? options = null, HttpMessageHandler? handler = null)

Creates a provider.

Parameters

Name Type Description
options GoogleOptions
handler HttpMessageHandler

Returns: GoogleProvider

View source

public DecisionLanguageModel DecisionModel(string modelId)

Experimental Choice/Score/Boolean decision model that uses Gemini structured output. The provider id is google.decision.

Parameters

Name Type Description
modelId string

Returns: DecisionLanguageModel

View source

public override IEmbeddingModel EmbeddingModel(string modelId)

Returns an embedding model.

Parameters

Name Type Description
modelId string

Returns: IEmbeddingModel

View source

public IBatchApi? ExperimentalBatch()

Gemini Batch API. Downloads batch results.

Returns: IBatchApi

View source

public override IImageModel ImageModel(string modelId)

Returns an image model.

Parameters

Name Type Description
modelId string

Returns: IImageModel

View source

public virtual ILanguageModel Interactions(string modelId)

Language model that posts to the Interactions API.

Parameters

Name Type Description
modelId string

Returns: ILanguageModel

View source

public virtual ILanguageModel Interactions(GoogleInteractionsAgent agent)

Language model that calls an agent through the Interactions API. The request sends agent instead of model.

Parameters

Name Type Description
agent GoogleInteractionsAgent

Returns: ILanguageModel

View source

public override ILanguageModel LanguageModel(string modelId)

Returns a language model.

Parameters

Name Type Description
modelId string

Returns: ILanguageModel

View source

public override IRealtimeModel RealtimeModel(string modelId)

Returns a realtime model.

Parameters

Name Type Description
modelId string

Returns: IRealtimeModel

View source

public override ISpeechModel SpeechModel(string modelId)

Returns a speech model.

Parameters

Name Type Description
modelId string

Returns: ISpeechModel

View source

public override ITranscriptionModel TranscriptionModel(string modelId)

Returns a transcription model.

Parameters

Name Type Description
modelId string

Returns: ITranscriptionModel

View source

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