Enables calls to the Google Cloud's Vertex AI API to access Large Language Models in a chat-like fashion.

This entrypoint and class are intended to be used in web environments like Edge functions where you do not have access to the file system. It supports passing service account credentials directly as a "GOOGLE_VERTEX_AI_WEB_CREDENTIALS" environment variable or directly as "authOptions.credentials".

Hierarchy

  • BaseChatGoogleVertexAI<WebGoogleAuthOptions>
    • ChatGoogleVertexAI

Constructors

Properties

ParsedCallOptions: Omit<BaseLanguageModelCallOptions, never>
caller: AsyncCaller

The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.

connection: GoogleVertexAILLMConnection<BaseLanguageModelCallOptions, GoogleVertexAIChatInstance, GoogleVertexAIChatPrediction, WebGoogleAuthOptions>
examples: ChatExample[] = []
maxOutputTokens: number = 1024
model: string = "chat-bison"
streamedConnection: GoogleVertexAILLMConnection<BaseLanguageModelCallOptions, GoogleVertexAIChatInstance, GoogleVertexAIChatPrediction, WebGoogleAuthOptions>
temperature: number = 0.2
topK: number = 40
topP: number = 0.8
verbose: boolean

Whether to print out response text.

callbacks?: Callbacks
metadata?: Record<string, unknown>
tags?: string[]

Accessors

Methods

  • Generates a prompt based on the input prompt values.

    Parameters

    Returns Promise<LLMResult>

    A Promise that resolves to an LLMResult.

  • Predicts the next message based on a text input.

    Parameters

    • text: string

      The text input.

    • Optional options: string[] | BaseLanguageModelCallOptions

      The call options or an array of stop sequences.

    • Optional callbacks: Callbacks

      The callbacks for the language model.

    Returns Promise<string>

    A Promise that resolves to a string.

  • Predicts the next message based on the input messages.

    Parameters

    Returns Promise<BaseMessage>

    A Promise that resolves to a BaseMessage.

  • Stream all output from a runnable, as reported to the callback system. This includes all inner runs of LLMs, Retrievers, Tools, etc. Output is streamed as Log objects, which include a list of jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops can be applied in order to construct state.

    Parameters

    Returns AsyncGenerator<RunLogPatch, any, unknown>

Generated using TypeDoc