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

To use, you will need to have one of the following authentication methods in place:

  • You are logged into an account permitted to the Google Cloud project using Vertex AI.
  • You are running this on a machine using a service account permitted to the Google Cloud project using Vertex AI.
  • The GOOGLE_APPLICATION_CREDENTIALS environment variable is set to the path of a credentials file for a service account permitted to the Google Cloud project using Vertex AI.

Hierarchy

  • BaseChatGoogleVertexAI<GoogleAuthOptions>
    • 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, GoogleAuthOptions<JSONClient>>
examples: ChatExample[] = []
lc_kwargs: SerializedFields
lc_namespace: string[] = ...
lc_serializable: boolean = true
maxOutputTokens: number = 1024
model: string = "chat-bison"
streamedConnection: GoogleVertexAILLMConnection<BaseLanguageModelCallOptions, GoogleVertexAIChatInstance, GoogleVertexAIChatPrediction, GoogleAuthOptions<JSONClient>>
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[]
lc_runnable: boolean = true

Accessors

  • get lc_attributes(): undefined | {
        [key: string]: undefined;
    }
  • Returns undefined | {
        [key: string]: undefined;
    }

  • get lc_secrets(): undefined | {
        [key: string]: string;
    }
  • A map of secrets, which will be omitted from serialization. Keys are paths to the secret in constructor args, e.g. "foo.bar.baz". Values are the secret ids, which will be used when deserializing.

    Returns undefined | {
        [key: string]: string;
    }

Methods

  • Get the identifying parameters of the LLM.

    Returns Record<string, any>

  • 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>

  • Create a unique cache key for a specific call to a specific language model.

    Parameters

    Returns string

    A unique cache key.

  • Helper method to transform an Iterator of Input values into an Iterator of Output values, with callbacks. Use this to implement stream() or transform() in Runnable subclasses.

    Type Parameters

    Parameters

    • inputGenerator: AsyncGenerator<I, any, unknown>
    • transformer: ((generator, runManager?, options?) => AsyncGenerator<O, any, unknown>)
    • Optional options: BaseLanguageModelCallOptions & {
          runType?: string;
      }

    Returns AsyncGenerator<O, any, unknown>

Generated using TypeDoc