Package @google-cloud/vertexai (1.9.0)

Classes

ChatSession

The ChatSession class is used to make multiturn send message requests. You can instantiate this class by using the startChat method in the GenerativeModel class. The sendMessage method makes an async call to get the response of a chat message at at once. The sendMessageStream method makes an async call to stream the response of a chat message as it's being generated.

ChatSessionPreview

The ChatSessionPreview class is used to make multiturn send message requests. You can instantiate this class by using the startChat method in the GenerativeModelPreview class. The sendMessage method makes an async call to get the response of a chat message at at once. The sendMessageStream method makes an async call to stream the response of a chat message as it's being generated.

ClientError

ClientError is thrown when http 4XX status is received. For details please refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses

GenerateContentResponseHandler

Helper class to render any extra properties out of GenerateContentResponse or properties of GenerateContentResponse

GenerativeModel

The GenerativeModel class is the base class for the generative models on Vertex AI. NOTE: Don't instantiate this class directly. Use vertexai.getGenerativeModel() instead.

GenerativeModelPreview

The GenerativeModelPreview class is the base class for the generative models that are in preview. NOTE: Don't instantiate this class directly. Use vertexai.preview.getGenerativeModel() instead.

GoogleApiError

GoogleApiError is thrown when http 4XX status is received. See https://cloud.google.com/apis/design/errors

GoogleAuthError

GoogleAuthError is thrown when there is authentication issue with the request

GoogleGenerativeAIError

GoogleGenerativeAIError is thrown when http response is not ok and status code is not 4XX For details please refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

IllegalArgumentError

IllegalArgumentError is thrown when the request or operation is invalid

VertexAI

The VertexAI class is the base class for authenticating to Vertex AI. To use Vertex AI's generative AI models, use the getGenerativeModel method. To use generative AI features that are in Preview, use the preview namespace.

Interfaces

BaseModelParams

Base params for initializing a model or calling GenerateContent.

BasePart

A part of a turn in a conversation with the model with a fixed MIME type. It has one of the following mutually exclusive fields: 1. text 2. inlineData 3. fileData 4. functionResponse 5. functionCall

CachedContent

A resource used in LLM queries for users to explicitly specify what to cache and how to cache.

CachedContentUsageMetadata

Metadata on the usage of the cached content.

Citation

Source attributions for content.

CitationMetadata

A collection of source attributions for a piece of content.

Content

The base structured datatype containing multi-part content of a message.

CountTokensRequest

Params used to call the countTokens method.

CountTokensResponse

Response returned from countTokens method.

ErrorDetails

Google API Error Details object that may be included in an error response. See https://cloud.google.com/apis/design/errors

FileData

URI based data.

FileDataPart

A file data part of a conversation with the model.

FunctionCall

A predicted FunctionCall returned from the model that contains a string representating the FunctionDeclaration.name with the parameters and their values.

FunctionCallingConfig

FunctionCallPart

A function call part of a conversation with the model.

FunctionDeclaration

Structured representation of a function declaration as defined by the [OpenAPI 3.0 specification](https://spec.openapis.org/oas/v3.0.3). Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client.

FunctionDeclarationSchema

Schema for parameters passed to FunctionDeclaration.parameters.

FunctionDeclarationsTool

A FunctionDeclarationsTool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

FunctionResponse

The result output of a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function call. It is used as context to the model.

FunctionResponsePart

A function response part of a conversation with the model.

GenerateContentCandidate

A response candidate generated from the model.

GenerateContentRequest

Params used to call the generateContent method.

GenerateContentResponse

Response from the model supporting multiple candidates.

GenerateContentResult

Wrapper for respones from a generateContent request.

GenerationConfig

Configuration options for model generation and outputs.

GenerativeContentBlob

Raw media bytes sent directly in the request. Text should not be sent as raw bytes.

GetGenerativeModelParams

Params used to call the getGenerativeModel method.

GoogleDate

Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following:

A full date, with non-zero year, month, and day values. A month and day, with a zero year (for example, an anniversary). A year on its own, with a zero month and a zero day. A year and month, with a zero day (for example, a credit card expiration date).

GoogleSearchRetrieval

Tool to retrieve public web data for grounding, powered by Google.

GoogleSearchRetrievalTool

Defines a retrieval tool that model can call to access external knowledge.

GroundingAttributionRetrievedContext

GroundingAttributionSegment

GroundingAttributionWeb

GroundingChunk

Grounding chunk.

GroundingChunkRetrievedContext

Grounding chunk from context retrieved by the retrieval tools.

GroundingChunkWeb

Grounding chunk from the web.

GroundingMetadata

A collection of grounding attributions for a piece of content.

GroundingSupport

Grounding support.

GroundingSupportSegment

Grounding support segment.

InlineDataPart

An inline data part of a conversation with the model.

ListCachedContentsResponse

Response with a list of CachedContents.

ModelParams

Configuration for initializing a model, for example via getGenerativeModel in VertexAI class.

PromptFeedback

Content filter results for a prompt sent in the request.

RagResource

Config of Vertex RagStore grounding checking.

RequestOptions

Request options params passed to getGenerativeModel method in VertexAI class.

ResponseSchema

Schema passed to GenerationConfig.responseSchema

Retrieval

Defines a retrieval tool that model can call to access external knowledge.

RetrievalTool

Defines a retrieval tool that model can call to access external knowledge.

SafetyRating

Safety rating corresponding to the generated content.

SafetySetting

Safety feedback for an entire request.

Schema

Schema is used to define the format of input/output data. Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed.

SearchEntryPoint

Google search entry point.

StartChatParams

Params to initiate a multiturn chat with the model via startChat.

StartChatSessionRequest

All params passed to initiate multiturn chat via startChat.

StreamGenerateContentResult

Wrapper for respones from a generateContentStream method.

TextPart

A text part of a conversation with the model.

ToolConfig

This config is shared for all tools provided in the request.

UsageMetadata

Usage metadata about response(s).

VertexAISearch

Retrieve from Vertex AI Search datastore for grounding.

VertexInit

Params used to initialize the Vertex SDK.

VertexRagStore

Enums

BlockedReason

The reason why the reponse is blocked.

FinishReason

The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.

FunctionCallingMode

Function calling mode.

HarmBlockThreshold

Probability based thresholds levels for blocking.

HarmCategory

Harm categories that will block the content.

HarmProbability

Harm probability levels in the content.

HarmSeverity

Harm severity levels

SchemaType

The list of OpenAPI data types as defined by https://swagger.io/docs/specification/data-models/data-types/

Variables

FunctionDeclarationSchemaType

FunctionDeclarationSchemaType: {
    STRING: SchemaType.STRING;
    NUMBER: SchemaType.NUMBER;
    INTEGER: SchemaType.INTEGER;
    BOOLEAN: SchemaType.BOOLEAN;
    ARRAY: SchemaType.ARRAY;
    OBJECT: SchemaType.OBJECT;
}

Type Aliases

FunctionDeclarationSchemaProperty

export type FunctionDeclarationSchemaProperty = Schema;

FunctionDeclarationSchemaProperty is used to define the format of input/output data. Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed.

FunctionDeclarationSchemaType

export declare type FunctionDeclarationSchemaType = SchemaType;

Contains the list of OpenAPI data types as defined by https://swagger.io/docs/specification/data-models/data-types/

Part

export declare type Part = TextPart | InlineDataPart | FileDataPart | FunctionResponsePart | FunctionCallPart;

A datatype containing media that is part of a multi-part Content message. A Part is a union type of TextPart, InlineDataPart, FileDataPart, and FunctionResponsePart. A Part has one of the following mutually exclusive fields: 1. text 2. inlineData 3. fileData 4. functionResponse

Tool

export declare type Tool = FunctionDeclarationsTool | RetrievalTool | GoogleSearchRetrievalTool;

Defines a tool that model can call to access external knowledge.