Skip to main content

vertexai-preview.api

API Report File for "@firebase/vertexai-preview"

Do not edit this file. It is a report generated by API Extractor.


import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
import { FirebaseApp } from '@firebase/app';
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
import { FirebaseError } from '@firebase/util';

// @public
export interface BaseParams {
// (undocumented)
generationConfig?: GenerationConfig;
// (undocumented)
safetySettings?: SafetySetting[];
}

// @public
export enum BlockReason {
// (undocumented)
BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED",
// (undocumented)
OTHER = "OTHER",
// (undocumented)
SAFETY = "SAFETY"
}

// @public
export class ChatSession {
// Warning: (ae-forgotten-export) The symbol "ApiSettings" needs to be exported by the entry point index.d.ts
constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
getHistory(): Promise<Content[]>;
// (undocumented)
model: string;
// (undocumented)
params?: StartChatParams | undefined;
// (undocumented)
requestOptions?: RequestOptions | undefined;
sendMessage(request: string | Array<string | Part>): Promise<GenerateContentResult>;
sendMessageStream(request: string | Array<string | Part>): Promise<GenerateContentStreamResult>;
}

// @public
export interface Citation {
// (undocumented)
endIndex?: number;
// (undocumented)
license?: string;
// (undocumented)
publicationDate?: Date_2;
// (undocumented)
startIndex?: number;
// (undocumented)
title?: string;
// (undocumented)
uri?: string;
}

// @public
export interface CitationMetadata {
// (undocumented)
citations: Citation[];
}

// @public
export interface Content {
// (undocumented)
parts: Part[];
// (undocumented)
role: Role;
}

// @public
export interface CountTokensRequest {
// (undocumented)
contents: Content[];
}

// @public
export interface CountTokensResponse {
totalBillableCharacters?: number;
totalTokens: number;
}

// @public
export interface CustomErrorData {
errorDetails?: ErrorDetails[];
response?: GenerateContentResponse;
status?: number;
statusText?: string;
}

// @public
interface Date_2 {
// (undocumented)
day: number;
// (undocumented)
month: number;
// (undocumented)
year: number;
}

export { Date_2 as Date }

// @public
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
// (undocumented)
functionCalls: () => FunctionCall[] | undefined;
text: () => string;
}

// @public
export interface ErrorDetails {
// (undocumented)
'@type'?: string;
[key: string]: unknown;
domain?: string;
metadata?: Record<string, unknown>;
reason?: string;
}

// @public
export interface FileData {
// (undocumented)
fileUri: string;
// (undocumented)
mimeType: string;
}

// @public
export interface FileDataPart {
// (undocumented)
fileData: FileData;
// (undocumented)
functionCall?: never;
// (undocumented)
functionResponse?: never;
// (undocumented)
inlineData?: never;
// (undocumented)
text?: never;
}

// @public
export enum FinishReason {
// (undocumented)
FINISH_REASON_UNSPECIFIED = "FINISH_REASON_UNSPECIFIED",
// (undocumented)
MAX_TOKENS = "MAX_TOKENS",
// (undocumented)
OTHER = "OTHER",
// (undocumented)
RECITATION = "RECITATION",
// (undocumented)
SAFETY = "SAFETY",
// (undocumented)
STOP = "STOP"
}

// @public
export interface FunctionCall {
// (undocumented)
args: object;
// (undocumented)
name: string;
}

// @public (undocumented)
export interface FunctionCallingConfig {
// (undocumented)
allowedFunctionNames?: string[];
// (undocumented)
mode?: FunctionCallingMode;
}

// @public (undocumented)
export enum FunctionCallingMode {
// (undocumented)
ANY = "ANY",
// (undocumented)
AUTO = "AUTO",
// (undocumented)
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
// (undocumented)
NONE = "NONE"
}

// @public
export interface FunctionCallPart {
// (undocumented)
functionCall: FunctionCall;
// (undocumented)
functionResponse?: never;
// (undocumented)
inlineData?: never;
// (undocumented)
text?: never;
}

// @public
export interface FunctionDeclaration {
description?: string;
name: string;
parameters?: FunctionDeclarationSchema;
}

// @public
export interface FunctionDeclarationSchema {
description?: string;
properties: {
[k: string]: FunctionDeclarationSchemaProperty;
};
required?: string[];
type: FunctionDeclarationSchemaType;
}

// @public
export interface FunctionDeclarationSchemaProperty {
description?: string;
enum?: string[];
example?: unknown;
format?: string;
items?: FunctionDeclarationSchema;
nullable?: boolean;
properties?: {
[k: string]: FunctionDeclarationSchema;
};
required?: string[];
type?: FunctionDeclarationSchemaType;
}

// @public
export enum FunctionDeclarationSchemaType {
ARRAY = "ARRAY",
BOOLEAN = "BOOLEAN",
INTEGER = "INTEGER",
NUMBER = "NUMBER",
OBJECT = "OBJECT",
STRING = "STRING"
}

// @public
export interface FunctionDeclarationsTool {
functionDeclarations?: FunctionDeclaration[];
}

// @public
export interface FunctionResponse {
// (undocumented)
name: string;
// (undocumented)
response: object;
}

// @public
export interface FunctionResponsePart {
// (undocumented)
functionCall?: never;
// (undocumented)
functionResponse: FunctionResponse;
// (undocumented)
inlineData?: never;
// (undocumented)
text?: never;
}

// @public
export interface GenerateContentCandidate {
// (undocumented)
citationMetadata?: CitationMetadata;
// (undocumented)
content: Content;
// (undocumented)
finishMessage?: string;
// (undocumented)
finishReason?: FinishReason;
// (undocumented)
groundingMetadata?: GroundingMetadata;
// (undocumented)
index: number;
// (undocumented)
safetyRatings?: SafetyRating[];
}

// @public
export interface GenerateContentRequest extends BaseParams {
// (undocumented)
contents: Content[];
// (undocumented)
systemInstruction?: string | Part | Content;
// (undocumented)
toolConfig?: ToolConfig;
// (undocumented)
tools?: Tool[];
}

// @public
export interface GenerateContentResponse {
// (undocumented)
candidates?: GenerateContentCandidate[];
// (undocumented)
promptFeedback?: PromptFeedback;
// (undocumented)
usageMetadata?: UsageMetadata;
}

// @public
export interface GenerateContentResult {
// (undocumented)
response: EnhancedGenerateContentResponse;
}

// @public
export interface GenerateContentStreamResult {
// (undocumented)
response: Promise<EnhancedGenerateContentResponse>;
// (undocumented)
stream: AsyncGenerator<EnhancedGenerateContentResponse>;
}

// @public
export interface GenerationConfig {
// (undocumented)
candidateCount?: number;
// (undocumented)
frequencyPenalty?: number;
// (undocumented)
maxOutputTokens?: number;
// (undocumented)
presencePenalty?: number;
responseMimeType?: string;
// (undocumented)
stopSequences?: string[];
// (undocumented)
temperature?: number;
// (undocumented)
topK?: number;
// (undocumented)
topP?: number;
}

// @public
export interface GenerativeContentBlob {
data: string;
// (undocumented)
mimeType: string;
}

// @public
export class GenerativeModel {
constructor(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions);
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
// (undocumented)
generationConfig: GenerationConfig;
// (undocumented)
model: string;
// (undocumented)
requestOptions?: RequestOptions;
// (undocumented)
safetySettings: SafetySetting[];
startChat(startChatParams?: StartChatParams): ChatSession;
// (undocumented)
systemInstruction?: Content;
// (undocumented)
toolConfig?: ToolConfig;
// (undocumented)
tools?: Tool[];
}

// @public
export function getGenerativeModel(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;

// @public
export function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;

// @public (undocumented)
export interface GroundingAttribution {
// (undocumented)
confidenceScore?: number;
// (undocumented)
retrievedContext?: RetrievedContextAttribution;
// (undocumented)
segment: Segment;
// (undocumented)
web?: WebAttribution;
}

// @public
export interface GroundingMetadata {
// (undocumented)
groundingAttributions: GroundingAttribution[];
// (undocumented)
retrievalQueries?: string[];
// (undocumented)
webSearchQueries?: string[];
}

// @public (undocumented)
export enum HarmBlockMethod {
// (undocumented)
HARM_BLOCK_METHOD_UNSPECIFIED = "HARM_BLOCK_METHOD_UNSPECIFIED",
// (undocumented)
PROBABILITY = "PROBABILITY",
// (undocumented)
SEVERITY = "SEVERITY"
}

// @public
export enum HarmBlockThreshold {
// (undocumented)
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
// (undocumented)
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
// (undocumented)
BLOCK_NONE = "BLOCK_NONE",
// (undocumented)
BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
// (undocumented)
HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"
}

// @public
export enum HarmCategory {
// (undocumented)
HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT",
// (undocumented)
HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT",
// (undocumented)
HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
// (undocumented)
HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
// (undocumented)
HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED"
}

// @public
export enum HarmProbability {
// (undocumented)
HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
// (undocumented)
HIGH = "HIGH",
// (undocumented)
LOW = "LOW",
// (undocumented)
MEDIUM = "MEDIUM",
// (undocumented)
NEGLIGIBLE = "NEGLIGIBLE"
}

// @public
export enum HarmSeverity {
// (undocumented)
HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH",
// (undocumented)
HARM_SEVERITY_LOW = "HARM_SEVERITY_LOW",
// (undocumented)
HARM_SEVERITY_MEDIUM = "HARM_SEVERITY_MEDIUM",
// (undocumented)
HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
// (undocumented)
HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED"
}

// @public
export interface InlineDataPart {
// (undocumented)
functionCall?: never;
// (undocumented)
functionResponse?: never;
// (undocumented)
inlineData: GenerativeContentBlob;
// (undocumented)
text?: never;
videoMetadata?: VideoMetadata;
}

// @public
export interface ModelParams extends BaseParams {
// (undocumented)
model: string;
// (undocumented)
systemInstruction?: string | Part | Content;
// (undocumented)
toolConfig?: ToolConfig;
// (undocumented)
tools?: Tool[];
}

// @public
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;

// @public
export const POSSIBLE_ROLES: readonly ["user", "model", "function", "system"];

// @public
export interface PromptFeedback {
// (undocumented)
blockReason: BlockReason;
// (undocumented)
blockReasonMessage?: string;
// (undocumented)
safetyRatings: SafetyRating[];
}

// @public
export interface RequestOptions {
baseUrl?: string;
timeout?: number;
}

// @public (undocumented)
export interface RetrievedContextAttribution {
// (undocumented)
title: string;
// (undocumented)
uri: string;
}

// @public
export type Role = (typeof POSSIBLE_ROLES)[number];

// @public
export interface SafetyRating {
// (undocumented)
blocked: boolean;
// (undocumented)
category: HarmCategory;
// (undocumented)
probability: HarmProbability;
// (undocumented)
probabilityScore: number;
// (undocumented)
severity: HarmSeverity;
// (undocumented)
severityScore: number;
}

// @public
export interface SafetySetting {
// (undocumented)
category: HarmCategory;
// (undocumented)
method: HarmBlockMethod;
// (undocumented)
threshold: HarmBlockThreshold;
}

// @public (undocumented)
export interface Segment {
// (undocumented)
endIndex: number;
// (undocumented)
partIndex: number;
// (undocumented)
startIndex: number;
}

// @public
export interface StartChatParams extends BaseParams {
// (undocumented)
history?: Content[];
// (undocumented)
systemInstruction?: string | Part | Content;
// (undocumented)
toolConfig?: ToolConfig;
// (undocumented)
tools?: Tool[];
}

// @public
export interface TextPart {
// (undocumented)
functionCall?: never;
// (undocumented)
functionResponse?: never;
// (undocumented)
inlineData?: never;
// (undocumented)
text: string;
}

// @public
export type Tool = FunctionDeclarationsTool;

// @public
export interface ToolConfig {
// (undocumented)
functionCallingConfig: FunctionCallingConfig;
}

// @public
export interface UsageMetadata {
// (undocumented)
candidatesTokenCount: number;
// (undocumented)
promptTokenCount: number;
// (undocumented)
totalTokenCount: number;
}

// @public
export interface VertexAI {
app: FirebaseApp;
// (undocumented)
location: string;
}

// @public
export class VertexAIError extends FirebaseError {
constructor(code: VertexAIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
// (undocumented)
readonly code: VertexAIErrorCode;
// (undocumented)
readonly customErrorData?: CustomErrorData | undefined;
// (undocumented)
readonly message: string;
}

// @public
export const enum VertexAIErrorCode {
ERROR = "error",
FETCH_ERROR = "fetch-error",
INVALID_CONTENT = "invalid-content",
NO_API_KEY = "no-api-key",
NO_MODEL = "no-model",
NO_PROJECT_ID = "no-project-id",
PARSE_FAILED = "parse-failed",
REQUEST_ERROR = "request-error",
RESPONSE_ERROR = "response-error"
}

// @public
export interface VertexAIOptions {
// (undocumented)
location?: string;
}

// @public
export interface VideoMetadata {
endOffset: string;
startOffset: string;
}

// @public (undocumented)
export interface WebAttribution {
// (undocumented)
title: string;
// (undocumented)
uri: string;
}