Pyric
Navigate

API reference

pyric/ai

132 published symbols from pyric

Generated from the TypeScript declarations shipped at this import path.

Check behavioral conformance

Classes

AIError

Error class for the AI mirror — constructor and message format copied from the installed SDK: AI: <message> (AI/<code>), code set to the short code, customErrorData carried through.

Extends

Constructors

Constructor
new AIError(
   code: AIErrorCode,
   message: string,
   customErrorData?: CustomErrorData): AIError;
Parameters
ParameterType
codeAIErrorCode
messagestring
customErrorData?CustomErrorData
Returns

AIError

Overrides

FirebaseError.constructor

Properties

PropertyModifierTypeDefault valueOverrides
codereadonlyAIErrorCodeundefinedFirebaseError.code
customData?readonlyRecord<string, unknown>undefined-
customErrorData?readonlyCustomErrorDataundefined-
namereadonly"FirebaseError""FirebaseError"-

abstract AIModel

Base class for AI model APIs; holds the normalized model resource name.

Extended by

Constructors

Constructor
protected new AIModel(modelName: string): AIModel;
Parameters
ParameterType
modelNamestring
Returns

AIModel

Properties

PropertyModifierTypeDescription
modelreadonlystringFully qualified model resource name (models/<name> on GoogleAI).

Methods

normalizeModelName()
static normalizeModelName(modelName: string): string;

GoogleAI normalization WITHOUT the installed 2.12.0 double-prefix wart: models/x stays models/x, a short name gains the prefix (registry row ai#model-name-prefixed).

Parameters
ParameterType
modelNamestring
Returns

string


AnyOfSchema

Schema for a value conforming to ANY of the provided sub-schemas.

Extends

Indexable

[key: string]: unknown

Constructors

Constructor
new AnyOfSchema(schemaParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
schemaParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Overrides

Schema.constructor

Properties

PropertyType
anyOfTypedSchema[]
format?string
nullableboolean
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

Overrides

Schema.toJSON

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Inherited from

Schema.anyOf

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

Inherited from

Schema.array

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

Inherited from

Schema.boolean

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

Inherited from

Schema.enumString

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

Inherited from

Schema.integer

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

Inherited from

Schema.number

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

Inherited from

Schema.object

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema

Inherited from

Schema.string


ArraySchema

Schema class for “array” types; items is the member schema.

Extends

Indexable

[key: string]: unknown

Constructors

Constructor
new ArraySchema(schemaParams: SchemaParams, items: TypedSchema): ArraySchema;
Parameters
ParameterType
schemaParamsSchemaParams
itemsTypedSchema
Returns

ArraySchema

Overrides

Schema.constructor

Properties

PropertyType
format?string
itemsTypedSchema
nullableboolean
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

Overrides

Schema.toJSON

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Inherited from

Schema.anyOf

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

Inherited from

Schema.array

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

Inherited from

Schema.boolean

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

Inherited from

Schema.enumString

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

Inherited from

Schema.integer

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

Inherited from

Schema.number

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

Inherited from

Schema.object

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema

Inherited from

Schema.string


abstract Backend

Abstract base class representing the configuration for an AI service backend. Do not instantiate directly — use GoogleAIBackend or VertexAIBackend.

Extended by

Constructors

Constructor
protected new Backend(type: BackendType): Backend;
Parameters
ParameterType
typeBackendType
Returns

Backend

Properties

PropertyModifierType
backendTypereadonlyBackendType

BooleanSchema

Schema class for “boolean” types.

Extends

Indexable

[key: string]: unknown

Constructors

Constructor
new BooleanSchema(schemaParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
schemaParams?SchemaParams
Returns

BooleanSchema

Overrides

Schema.constructor

Properties

PropertyType
format?string
nullableboolean
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

Inherited from

Schema.toJSON

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Inherited from

Schema.anyOf

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

Inherited from

Schema.array

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

Inherited from

Schema.boolean

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

Inherited from

Schema.enumString

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

Inherited from

Schema.integer

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

Inherited from

Schema.number

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

Inherited from

Schema.object

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema

Inherited from

Schema.string


ChatSession

Chat session for multi-turn conversations on a sandbox target.

Extends

Constructors

Constructor
new ChatSession(
   target: AITarget,
   model: string,
   params?: StartChatParams,
   requestOptions?: RequestOptions): ChatSession;
Parameters
ParameterType
targetAITarget
modelstring
params?StartChatParams
requestOptions?RequestOptions
Returns

ChatSession

Overrides

ChatSessionBase.constructor

Properties

PropertyModifierType
modelreadonlystring
paramsreadonlyStartChatParams
requestOptionsreadonlyRequestOptions

Methods

getHistory()
getHistory(): Promise<ContentShape[]>;

Chat history so far. Blocked prompts leave no trace: neither blocked candidates nor the prompts that generated them are recorded. Returns a defensive clone — mutations never corrupt the session.

Returns

Promise<ContentShape[]>

Inherited from

ChatSessionBase.getHistory

sendMessage()
sendMessage(request: RequestInput, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
Parameters
ParameterType
requestRequestInput
singleRequestOptions?SingleRequestOptions
Returns

Promise<GenerateContentResult>

sendMessageStream()
sendMessageStream(request: RequestInput, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;

Streaming chat turn — 2.13.0 FIXED semantics: the incoming content is threaded into the request exactly once, and exactly one user turn lands in history per call (registry row ai#chat-stream-single-user-turn).

Parameters
ParameterType
requestRequestInput
singleRequestOptions?SingleRequestOptions
Returns

Promise<GenerateContentStreamResult>


abstract ChatSessionBase

Base class for chat sessions: history storage and the sequential-send guarantee (_sendPromise chain, upstream pattern — later sends and getHistory() observe earlier turns in order).

Extended by

Constructors

Constructor
new ChatSessionBase(): ChatSessionBase;
Returns

ChatSessionBase

Methods

getHistory()
getHistory(): Promise<ContentShape[]>;

Chat history so far. Blocked prompts leave no trace: neither blocked candidates nor the prompts that generated them are recorded. Returns a defensive clone — mutations never corrupt the session.

Returns

Promise<ContentShape[]>


GenerativeModel

Class for generative model APIs on a sandbox target.

Extends

Constructors

Constructor
new GenerativeModel(
   target: AITarget,
   modelParams: ModelParams,
   requestOptions?: RequestOptions): GenerativeModel;
Parameters
ParameterType
targetAITarget
modelParamsModelParams
requestOptions?RequestOptions
Returns

GenerativeModel

Overrides

AIModel.constructor

Properties

PropertyModifierTypeDescription
generationConfigreadonlyRecord<string, unknown>-
modelreadonlystringFully qualified model resource name (models/<name> on GoogleAI).
requestOptionsreadonlyRequestOptions-
safetySettingsreadonlyunknown[]-
systemInstruction?readonlyContentShape-
toolConfig?readonlyunknown-
tools?readonlyunknown[]-

Methods

countTokens()
countTokens(request: RequestInput | GenerateContentRequestShape, singleRequestOptions?: SingleRequestOptions): Promise<CountTokensResponse>;
Parameters
ParameterType
requestRequestInput | GenerateContentRequestShape
singleRequestOptions?SingleRequestOptions
Returns

Promise<CountTokensResponse>

generateContent()
generateContent(request: RequestInput | GenerateContentRequestShape, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
Parameters
ParameterType
requestRequestInput | GenerateContentRequestShape
singleRequestOptions?SingleRequestOptions
Returns

Promise<GenerateContentResult>

generateContentStream()
generateContentStream(request: RequestInput | GenerateContentRequestShape, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
Parameters
ParameterType
requestRequestInput | GenerateContentRequestShape
singleRequestOptions?SingleRequestOptions
Returns

Promise<GenerateContentStreamResult>

startChat()
startChat(startChatParams?: StartChatParams): ChatSession;
Parameters
ParameterType
startChatParams?StartChatParams
Returns

ChatSession

normalizeModelName()
static normalizeModelName(modelName: string): string;

GoogleAI normalization WITHOUT the installed 2.12.0 double-prefix wart: models/x stays models/x, a short name gains the prefix (registry row ai#model-name-prefixed).

Parameters
ParameterType
modelNamestring
Returns

string

Inherited from

AIModel.normalizeModelName


GoogleAIBackend

Configuration class for the Gemini Developer API backend (the default).

Extends

Constructors

Constructor
new GoogleAIBackend(): GoogleAIBackend;
Returns

GoogleAIBackend

Overrides

Backend.constructor

Properties

PropertyModifierType
backendTypereadonlyBackendType

IntegerSchema

Schema class for “integer” types.

Extends

Indexable

[key: string]: unknown

Constructors

Constructor
new IntegerSchema(schemaParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
schemaParams?SchemaParams
Returns

IntegerSchema

Overrides

Schema.constructor

Properties

PropertyType
format?string
nullableboolean
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

Inherited from

Schema.toJSON

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Inherited from

Schema.anyOf

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

Inherited from

Schema.array

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

Inherited from

Schema.boolean

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

Inherited from

Schema.enumString

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

Inherited from

Schema.integer

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

Inherited from

Schema.number

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

Inherited from

Schema.object

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema

Inherited from

Schema.string


NumberSchema

Schema class for “number” types.

Extends

Indexable

[key: string]: unknown

Constructors

Constructor
new NumberSchema(schemaParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
schemaParams?SchemaParams
Returns

NumberSchema

Overrides

Schema.constructor

Properties

PropertyType
format?string
nullableboolean
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

Inherited from

Schema.toJSON

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Inherited from

Schema.anyOf

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

Inherited from

Schema.array

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

Inherited from

Schema.boolean

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

Inherited from

Schema.enumString

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

Inherited from

Schema.integer

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

Inherited from

Schema.number

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

Inherited from

Schema.object

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema

Inherited from

Schema.string


ObjectSchema

Schema class for “object” types; properties maps names to Schemas.

Extends

Indexable

[key: string]: unknown

Constructors

Constructor
new ObjectSchema(
   schemaParams: SchemaParams,
   properties: Record<string, TypedSchema>,
   optionalProperties?: string[]): ObjectSchema;
Parameters
ParameterType
schemaParamsSchemaParams
propertiesRecord<string, TypedSchema>
optionalProperties?string[]
Returns

ObjectSchema

Overrides

Schema.constructor

Properties

PropertyType
format?string
nullableboolean
optionalPropertiesstring[]
propertiesRecord<string, TypedSchema>
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

Overrides

Schema.toJSON

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Inherited from

Schema.anyOf

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

Inherited from

Schema.array

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

Inherited from

Schema.boolean

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

Inherited from

Schema.enumString

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

Inherited from

Schema.integer

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

Inherited from

Schema.number

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

Inherited from

Schema.object

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema

Inherited from

Schema.string


abstract Schema

Parent class encompassing all Schema types. Converts with JSON.stringify() into the JSON string the REST endpoints accept.

Extended by

Indexable

[key: string]: unknown

Constructors

Constructor
new Schema(schemaParams: SchemaParams): Schema;
Parameters
ParameterType
schemaParamsSchemaParams
Returns

Schema

Properties

PropertyType
format?string
nullableboolean
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema


StringSchema

Schema class for “string” types, with or without enum values.

Extends

Indexable

[key: string]: unknown

Constructors

Constructor
new StringSchema(schemaParams?: SchemaParams, enumValues?: string[]): StringSchema;
Parameters
ParameterType
schemaParams?SchemaParams
enumValues?string[]
Returns

StringSchema

Overrides

Schema.constructor

Properties

PropertyType
enum?string[]
format?string
nullableboolean
type?SchemaType

Methods

toJSON()
toJSON(): Record<string, unknown>;

Serialization the request body applies via JSON.stringify.

Returns

Record<string, unknown>

Overrides

Schema.toJSON

anyOf()
static anyOf(anyOfParams: SchemaParams & {
  anyOf: TypedSchema[];
}): AnyOfSchema;
Parameters
ParameterType
anyOfParamsSchemaParams & { anyOf: TypedSchema[]; }
Returns

AnyOfSchema

Inherited from

Schema.anyOf

array()
static array(arrayParams: SchemaParams & {
  items: TypedSchema;
}): ArraySchema;
Parameters
ParameterType
arrayParamsSchemaParams & { items: TypedSchema; }
Returns

ArraySchema

Inherited from

Schema.array

boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
ParameterType
booleanParams?SchemaParams
Returns

BooleanSchema

Inherited from

Schema.boolean

enumString()
static enumString(stringParams: SchemaParams & {
  enum: string[];
}): StringSchema;
Parameters
ParameterType
stringParamsSchemaParams & { enum: string[]; }
Returns

StringSchema

Inherited from

Schema.enumString

integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
ParameterType
integerParams?SchemaParams
Returns

IntegerSchema

Inherited from

Schema.integer

number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
ParameterType
numberParams?SchemaParams
Returns

NumberSchema

Inherited from

Schema.number

object()
static object(objectParams: SchemaParams & {
  optionalProperties?: string[];
  properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
ParameterType
objectParamsSchemaParams & { optionalProperties?: string[]; properties: Record<string, TypedSchema>; }
Returns

ObjectSchema

Inherited from

Schema.object

string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
ParameterType
stringParams?SchemaParams
Returns

StringSchema

Inherited from

Schema.string


VertexAIBackend

Configuration class for the Vertex AI Gemini API backend.

Extends

Constructors

Constructor
new VertexAIBackend(location?: string): VertexAIBackend;
Parameters
ParameterType
location?string
Returns

VertexAIBackend

Overrides

Backend.constructor

Properties

PropertyModifierType
backendTypereadonlyBackendType
locationreadonlystring

Interfaces

AI

Sandbox AI handle. Direct sandbox handles have no app.

Properties

PropertyType
app?FirebaseApp
backendBackend
locationstring
options?AIOptions

AIOptions

Initialization options; engine is the sandbox-only answer-engine seam.

Properties

PropertyTypeDescription
backend?Backend-
engine?EngineConfig | AnswerEngineSandbox targets only: engine config (scripted default) or a custom engine.
useLimitedUseAppCheckTokens?boolean-

BaseParams

Extended by

Properties

PropertyType
generationConfig?Record<string, unknown>
safetySettings?unknown[]

Citation

Properties

PropertyType
endIndex?number
license?string
publicationDate?Date
startIndex?number
title?string
uri?string

CitationMetadata

Properties

PropertyType
citationsCitation[]

CodeExecutionResult

Properties

PropertyType
outcome?string
output?string

CodeExecutionResultPart

Properties

PropertyType
codeExecutionResult?CodeExecutionResult
executableCode?never
fileDatanever
functionCall?never
functionResponse?never
inlineData?never
text?never
thought?never

CodeExecutionTool

Properties

PropertyType
codeExecutionRecord<string, never>

Content

Properties

PropertyType
partsPart[]
role"function" | "model" | "user" | "system"

CountTokensRequest

Properties

PropertyType
contentsContent[]
generationConfig?GenerationConfig
systemInstruction?string | Content | Part
tools?Tool[]

CountTokensResponse

Properties

PropertyType
promptTokensDetails?ModalityTokenCount[]
totalBillableCharacters?number
totalTokensnumber

CustomErrorData

Data from a bad HTTP response (upstream CustomErrorData shape).

Properties

PropertyType
errorDetails?Record<string, unknown>[]
response?unknown
status?number
statusText?string

Date

Properties

PropertyType
daynumber
monthnumber
yearnumber

EnhancedGenerateContentResponse

Extends

Properties

PropertyType
candidates?GenerateContentCandidate[]
promptFeedback?PromptFeedback
usageMetadata?UsageMetadata

Methods

functionCalls()
functionCalls(): FunctionCall[];
Returns

FunctionCall[]

inlineDataParts()
inlineDataParts(): InlineDataPart[];
Returns

InlineDataPart[]

text()
text(): string;
Returns

string

thoughtSummary()
thoughtSummary(): string;
Returns

string


ErrorDetails

Indexable

[key: string]: unknown

Properties

PropertyType
@type?string
domain?string
metadata?Record<string, unknown>
reason?string

ExecutableCode

Properties

PropertyType
code?string
language?string

ExecutableCodePart

Properties

PropertyType
codeExecutionResult?never
executableCode?ExecutableCode
fileDatanever
functionCall?never
functionResponse?never
inlineData?never
text?never
thought?never

FileData

Properties

PropertyType
fileUristring
mimeTypestring

FileDataPart

Properties

PropertyType
codeExecutionResult?never
executableCode?never
fileDataFileData
functionCall?never
functionResponse?never
inlineData?never
text?never
thought?boolean

FunctionCall

Properties

PropertyType
argsobject
id?string
namestring

FunctionCallingConfig

Properties

PropertyType
allowedFunctionNames?string[]
mode?FunctionCallingMode

FunctionCallPart

Properties

PropertyType
codeExecutionResult?never
executableCode?never
functionCallFunctionCall
functionResponse?never
inlineData?never
text?never
thought?boolean

FunctionDeclaration

Properties

PropertyType
descriptionstring
functionReference?Function
namestring
parameters?ObjectSchemaInstance | ObjectSchemaRequest

FunctionDeclarationsTool

Properties

PropertyType
functionDeclarations?FunctionDeclaration[]

FunctionResponse

Properties

PropertyType
id?string
namestring
parts?Part[]
responseobject

FunctionResponsePart

Properties

PropertyType
codeExecutionResult?never
executableCode?never
functionCall?never
functionResponseFunctionResponse
inlineData?never
text?never
thought?boolean

GenerateContentCandidate

Properties

PropertyType
citationMetadata?CitationMetadata
contentContent
finishMessage?string
finishReason?FinishReason
groundingMetadata?GroundingMetadata
indexnumber
safetyRatings?SafetyRating[]
urlContextMetadata?URLContextMetadata

GenerateContentRequest

Properties

PropertyType
contentsContent[]
generationConfig?GenerationConfig
safetySettings?SafetySetting[]
systemInstruction?string | Content | Part
toolConfig?ToolConfig
tools?Tool[]

GenerateContentResponse

Extended by

Properties

PropertyType
candidates?GenerateContentCandidate[]
promptFeedback?PromptFeedback
usageMetadata?UsageMetadata

GenerateContentResult

Properties

PropertyType
responseEnhancedResponse

GenerateContentStreamResult

Properties

PropertyType
responsePromise<EnhancedResponse>
streamAsyncGenerator<EnhancedResponse>

GenerationConfig

Properties

PropertyType
candidateCount?number
frequencyPenalty?number
imageConfig?ImageConfig
maxOutputTokens?number
presencePenalty?number
responseJsonSchema?Record<string, unknown>
responseMimeType?string
responseModalities?ResponseModality[]
responseSchema?TypedSchema | SchemaRequest
stopSequences?string[]
temperature?number
thinkingConfig?ThinkingConfig
topK?number
topP?number

GenerativeContentBlob

Properties

PropertyType
datastring
mimeTypestring

GoogleMaps

Properties

PropertyType
enableWidget?boolean

GoogleMapsGroundingChunk

Properties

PropertyType
placeId?string
text?string
title?string
uri?string

GoogleMapsTool

Properties

PropertyType
googleMapsGoogleMaps

GoogleSearch


GoogleSearchTool

Properties

PropertyType
googleSearchGoogleSearch

GroundingChunk

Properties


GroundingMetadata

Properties

PropertyType
googleMapsWidgetContextToken?string
groundingChunks?GroundingChunk[]
groundingSupports?GroundingSupport[]
retrievalQueries?string[]
searchEntryPoint?SearchEntrypoint
webSearchQueries?string[]

GroundingSupport

Properties

PropertyType
groundingChunkIndices?number[]
segment?Segment

ImageConfig

Properties

PropertyType
aspectRatio?ImageConfigAspectRatio
imageSize?ImageConfigImageSize

InlineDataPart

Properties

PropertyType
codeExecutionResult?never
executableCode?never
functionCall?never
functionResponse?never
inlineDataGenerativeContentBlob
text?never
thought?boolean
videoMetadata?VideoMetadata

LatLng

Properties

PropertyType
latitude?number
longitude?number

ModalityTokenCount

Properties

PropertyType
modalityModality
tokenCountnumber

ModelParams

Extends

Properties

PropertyType
generationConfig?Record<string, unknown>
modelstring
safetySettings?unknown[]
systemInstruction?| string | ContentShape | { text?: string; }
toolConfig?unknown
tools?unknown[]

ObjectSchemaRequest

Extends

Indexable

[key: string]: unknown

Properties

PropertyTypeOverrides
anyOf?SchemaRequest[]-
description?string-
enum?string[]-
example?unknown-
format?string-
items?SchemaRequest-
maximum?number-
maxItems?number-
minimum?number-
minItems?number-
nullable?boolean-
optionalProperties?never-
properties?Record<string, T>-
propertyOrdering?string[]-
required?string[]-
title?string-
type"object"SchemaRequest.type

PromptFeedback

Properties

PropertyType
blockReason?BlockReason
blockReasonMessage?string
safetyRatingsSafetyRating[]

RequestOptions

Properties

PropertyType
baseUrl?string
maxSequentialFunctionCalls?number
timeout?number

RetrievalConfig

Properties

PropertyType
languageCode?string
latLng?LatLng

SafetyRating

Properties

PropertyType
blockedboolean
categoryHarmCategory
probabilityHarmProbability
probabilityScorenumber
severityHarmSeverity
severityScorenumber

SafetySetting

Properties

PropertyType
categoryHarmCategory
method?HarmBlockMethod
thresholdHarmBlockThreshold

SchemaInterface

Extends

Indexable

[key: string]: unknown

Properties

PropertyType
anyOf?SchemaInterface[]
description?string
enum?string[]
example?unknown
format?string
items?SchemaInterface
maximum?number
maxItems?number
minimum?number
minItems?number
nullable?boolean
properties?Record<string, T>
propertyOrdering?string[]
title?string
type?SchemaType

SchemaParams

Params accepted by the static builders (upstream SchemaParams shape).

Indexable

[key: string]: unknown

Properties

PropertyType
anyOf?TypedSchema[]
description?string
enum?string[]
example?unknown
format?string
items?Schema
maximum?number
maxItems?number
minimum?number
minItems?number
nullable?boolean
optionalProperties?string[]
properties?Record<string, Schema>
propertyOrdering?string[]
title?string
type?SchemaType

SchemaRequest

Extends

Extended by

Indexable

[key: string]: unknown

Properties

PropertyType
anyOf?SchemaRequest[]
description?string
enum?string[]
example?unknown
format?string
items?SchemaRequest
maximum?number
maxItems?number
minimum?number
minItems?number
nullable?boolean
properties?Record<string, T>
propertyOrdering?string[]
required?string[]
title?string
type?SchemaType

SchemaShared

Extended by

Type Parameters

Type Parameter
T

Indexable

[key: string]: unknown

Properties

PropertyType
anyOf?T[]
description?string
enum?string[]
example?unknown
format?string
items?T
maximum?number
maxItems?number
minimum?number
minItems?number
nullable?boolean
properties?Record<string, T>
propertyOrdering?string[]
title?string

SearchEntrypoint

Properties

PropertyType
renderedContent?string

Segment

Properties

PropertyType
endIndexnumber
partIndexnumber
startIndexnumber
textstring

SingleRequestOptions

Properties

PropertyType
baseUrl?string
maxSequentialFunctionCalls?number
signal?AbortSignal
timeout?number

StartChatParams

Extends

Properties

PropertyType
generationConfig?Record<string, unknown>
history?ContentShape[]
safetySettings?unknown[]
systemInstruction?| string | ContentShape | { text?: string; }
toolConfig?unknown
tools?unknown[]

TextPart

Properties

PropertyType
codeExecutionResult?never
executableCode?never
functionCall?never
functionResponse?never
inlineData?never
textstring
thought?boolean

ThinkingConfig

Properties

PropertyType
includeThoughts?boolean
thinkingBudget?number
thinkingLevel?string

ToolConfig

Properties

PropertyType
functionCallingConfig?FunctionCallingConfig
retrievalConfig?RetrievalConfig

URLContext


URLContextMetadata

Properties

PropertyType
urlMetadataURLMetadata[]

URLContextTool

Properties

PropertyType
urlContextURLContext

URLMetadata

Properties

PropertyType
retrievedUrl?string
urlRetrievalStatus?string

UsageMetadata

Properties

PropertyType
cachedContentTokenCount?number
cacheTokensDetails?ModalityTokenCount[]
candidatesTokenCountnumber
candidatesTokensDetails?ModalityTokenCount[]
promptTokenCountnumber
promptTokensDetails?ModalityTokenCount[]
thoughtsTokenCount?number
toolUsePromptTokenCount?number
toolUsePromptTokensDetails?ModalityTokenCount[]
totalTokenCountnumber

VideoMetadata

Properties

PropertyType
endOffsetstring
startOffsetstring

WebGroundingChunk

Properties

PropertyType
domain?string
title?string
uri?string

Type Aliases

AIErrorCode

type AIErrorCode = typeof AIErrorCode[keyof typeof AIErrorCode];

pyric/ai — modular Web-SDK AI adapter for the Pyric sandbox.

Mirrors the admitted firebase/ai surface as a sandbox-only adapter. Availability and reviewed dispositions are owned only by packages/conformance/surfaces/ai.json; this barrel deliberately carries no copied counts or deny-list. Production selection happens before it loads: unmodified firebase/ai imports either remain Firebase or are swapped to this package by the Vite/import-map or Node register boundary.

  • Sandbox targetgetAI(sandbox) answers in-process through the AiBroker answer-engine seam (scripted default: zero-config, zero-I/O, deterministic; or openai: any OpenAI-compatible upstream). Scripting lives on the pyric/ai/scripting subpath. A TARGET_SYMBOL brand binds every AI handle to its sandbox broker. There is no production target or runtime Firebase dispatch here.

BackendType

type BackendType = typeof BackendType[keyof typeof BackendType];

BlockReason

type BlockReason = typeof BlockReason[keyof typeof BlockReason];

FinishReason

type FinishReason = typeof FinishReason[keyof typeof FinishReason];

FunctionCallingMode

type FunctionCallingMode = typeof FunctionCallingMode[keyof typeof FunctionCallingMode];

HarmBlockMethod

type HarmBlockMethod = typeof HarmBlockMethod[keyof typeof HarmBlockMethod];

HarmBlockThreshold

type HarmBlockThreshold = typeof HarmBlockThreshold[keyof typeof HarmBlockThreshold];

HarmCategory

type HarmCategory = typeof HarmCategory[keyof typeof HarmCategory];

HarmProbability

type HarmProbability = typeof HarmProbability[keyof typeof HarmProbability];

HarmSeverity

type HarmSeverity = typeof HarmSeverity[keyof typeof HarmSeverity];

ImageConfigAspectRatio

type ImageConfigAspectRatio = typeof ImageConfigAspectRatio[keyof typeof ImageConfigAspectRatio];

ImageConfigImageSize

type ImageConfigImageSize = typeof ImageConfigImageSize[keyof typeof ImageConfigImageSize];

Language

type Language = typeof Language[keyof typeof Language];

Modality

type Modality = typeof Modality[keyof typeof Modality];

Outcome

type Outcome = typeof Outcome[keyof typeof Outcome];

Part

type Part =
  | TextPart
  | InlineDataPart
  | FunctionCallPart
  | FunctionResponsePart
  | FileDataPart
  | ExecutableCodePart
  | CodeExecutionResultPart;

ResponseModality

type ResponseModality = typeof ResponseModality[keyof typeof ResponseModality];

Role

type Role = typeof POSSIBLE_ROLES[number];

The producer of the content.


SchemaType

type SchemaType = typeof SchemaType[keyof typeof SchemaType];

ThinkingLevel

type ThinkingLevel = typeof ThinkingLevel[keyof typeof ThinkingLevel];

Tool

type Tool =
  | FunctionDeclarationsTool
  | GoogleMapsTool
  | GoogleSearchTool
  | CodeExecutionTool
  | URLContextTool;

TypedSchema

type TypedSchema =
  | IntegerSchema
  | NumberSchema
  | StringSchema
  | BooleanSchema
  | ObjectSchema
  | ArraySchema
  | AnyOfSchema;

Union of all concrete schema classes.


URLRetrievalStatus

type URLRetrievalStatus = typeof URLRetrievalStatus[keyof typeof URLRetrievalStatus];

Variables

AIErrorCode

const AIErrorCode: {
  API_NOT_ENABLED: "api-not-enabled";
  ERROR: "error";
  FETCH_ERROR: "fetch-error";
  INVALID_CONTENT: "invalid-content";
  INVALID_SCHEMA: "invalid-schema";
  NO_API_KEY: "no-api-key";
  NO_APP_ID: "no-app-id";
  NO_MODEL: "no-model";
  NO_PROJECT_ID: "no-project-id";
  PARSE_FAILED: "parse-failed";
  REQUEST_ERROR: "request-error";
  RESPONSE_ERROR: "response-error";
  SESSION_CLOSED: "session-closed";
  UNSUPPORTED: "unsupported";
};

Standardized error codes the SDK can throw — 14 codes in 2.12.0.

Type Declaration

API_NOT_ENABLED
readonly API_NOT_ENABLED: "api-not-enabled";

ERROR
readonly ERROR: "error";

FETCH_ERROR
readonly FETCH_ERROR: "fetch-error";

INVALID_CONTENT
readonly INVALID_CONTENT: "invalid-content";

INVALID_SCHEMA
readonly INVALID_SCHEMA: "invalid-schema";

NO_API_KEY
readonly NO_API_KEY: "no-api-key";

NO_APP_ID
readonly NO_APP_ID: "no-app-id";

NO_MODEL
readonly NO_MODEL: "no-model";

NO_PROJECT_ID
readonly NO_PROJECT_ID: "no-project-id";

PARSE_FAILED
readonly PARSE_FAILED: "parse-failed";

REQUEST_ERROR
readonly REQUEST_ERROR: "request-error";

RESPONSE_ERROR
readonly RESPONSE_ERROR: "response-error";

SESSION_CLOSED
readonly SESSION_CLOSED: "session-closed";

UNSUPPORTED
readonly UNSUPPORTED: "unsupported";

BackendType

const BackendType: {
  GOOGLE_AI: "GOOGLE_AI";
  VERTEX_AI: "VERTEX_AI";
};

Identifies which backend service the SDK communicates with.

Type Declaration

GOOGLE_AI
readonly GOOGLE_AI: "GOOGLE_AI";

VERTEX_AI
readonly VERTEX_AI: "VERTEX_AI";

BlockReason

const BlockReason: {
  BLOCKLIST: "BLOCKLIST";
  OTHER: "OTHER";
  PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
  SAFETY: "SAFETY";
};

Reason that a prompt was blocked.

Type Declaration

BLOCKLIST
readonly BLOCKLIST: "BLOCKLIST";

OTHER
readonly OTHER: "OTHER";

PROHIBITED_CONTENT
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";

SAFETY
readonly SAFETY: "SAFETY";

FinishReason

const FinishReason: {
  BLOCKLIST: "BLOCKLIST";
  IMAGE_OTHER: "IMAGE_OTHER";
  IMAGE_PROHIBITED_CONTENT: "IMAGE_PROHIBITED_CONTENT";
  IMAGE_RECITATION: "IMAGE_RECITATION";
  IMAGE_SAFETY: "IMAGE_SAFETY";
  LANGUAGE: "LANGUAGE";
  MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL";
  MALFORMED_RESPONSE: "MALFORMED_RESPONSE";
  MAX_TOKENS: "MAX_TOKENS";
  MISSING_THOUGHT_SIGNATURE: "MISSING_THOUGHT_SIGNATURE";
  NO_IMAGE: "NO_IMAGE";
  OTHER: "OTHER";
  PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
  RECITATION: "RECITATION";
  SAFETY: "SAFETY";
  SPII: "SPII";
  STOP: "STOP";
  TOO_MANY_TOOL_CALLS: "TOO_MANY_TOOL_CALLS";
  UNEXPECTED_TOOL_CALL: "UNEXPECTED_TOOL_CALL";
};

Reason that a candidate run stopped generating tokens (19 values in 2.12.0).

Type Declaration

BLOCKLIST
readonly BLOCKLIST: "BLOCKLIST";

IMAGE_OTHER
readonly IMAGE_OTHER: "IMAGE_OTHER";

IMAGE_PROHIBITED_CONTENT
readonly IMAGE_PROHIBITED_CONTENT: "IMAGE_PROHIBITED_CONTENT";

IMAGE_RECITATION
readonly IMAGE_RECITATION: "IMAGE_RECITATION";

IMAGE_SAFETY
readonly IMAGE_SAFETY: "IMAGE_SAFETY";

LANGUAGE
readonly LANGUAGE: "LANGUAGE";

MALFORMED_FUNCTION_CALL
readonly MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL";

MALFORMED_RESPONSE
readonly MALFORMED_RESPONSE: "MALFORMED_RESPONSE";

MAX_TOKENS
readonly MAX_TOKENS: "MAX_TOKENS";

MISSING_THOUGHT_SIGNATURE
readonly MISSING_THOUGHT_SIGNATURE: "MISSING_THOUGHT_SIGNATURE";

NO_IMAGE
readonly NO_IMAGE: "NO_IMAGE";

OTHER
readonly OTHER: "OTHER";

PROHIBITED_CONTENT
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";

RECITATION
readonly RECITATION: "RECITATION";

SAFETY
readonly SAFETY: "SAFETY";

SPII
readonly SPII: "SPII";

STOP
readonly STOP: "STOP";

TOO_MANY_TOOL_CALLS
readonly TOO_MANY_TOOL_CALLS: "TOO_MANY_TOOL_CALLS";

UNEXPECTED_TOOL_CALL
readonly UNEXPECTED_TOOL_CALL: "UNEXPECTED_TOOL_CALL";

FunctionCallingMode

const FunctionCallingMode: {
  ANY: "ANY";
  AUTO: "AUTO";
  NONE: "NONE";
};

How the model may call functions: default, forced call, or no calls.

Type Declaration

ANY
readonly ANY: "ANY";

AUTO
readonly AUTO: "AUTO";

NONE
readonly NONE: "NONE";

HarmBlockMethod

const HarmBlockMethod: {
  PROBABILITY: "PROBABILITY";
  SEVERITY: "SEVERITY";
};

Probability-vs-severity blocking method (Vertex AI only).

Type Declaration

PROBABILITY
readonly PROBABILITY: "PROBABILITY";

SEVERITY
readonly SEVERITY: "SEVERITY";

HarmBlockThreshold

const HarmBlockThreshold: {
  BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
  BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
  BLOCK_NONE: "BLOCK_NONE";
  BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
  OFF: "OFF";
};

Threshold above which a prompt or candidate will be blocked.

Type Declaration

BLOCK_LOW_AND_ABOVE
readonly BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";

BLOCK_MEDIUM_AND_ABOVE
readonly BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";

BLOCK_NONE
readonly BLOCK_NONE: "BLOCK_NONE";

BLOCK_ONLY_HIGH
readonly BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";

OFF
readonly OFF: "OFF";

HarmCategory

const HarmCategory: {
  HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
  HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
  HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
  HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
};

Harm categories that would cause prompts or candidates to be blocked.

Type Declaration

HARM_CATEGORY_DANGEROUS_CONTENT
readonly HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";

HARM_CATEGORY_HARASSMENT
readonly HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";

HARM_CATEGORY_HATE_SPEECH
readonly HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";

HARM_CATEGORY_SEXUALLY_EXPLICIT
readonly HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";

HarmProbability

const HarmProbability: {
  HIGH: "HIGH";
  LOW: "LOW";
  MEDIUM: "MEDIUM";
  NEGLIGIBLE: "NEGLIGIBLE";
};

Probability that a prompt or candidate matches a harm category.

Type Declaration

HIGH
readonly HIGH: "HIGH";

LOW
readonly LOW: "LOW";

MEDIUM
readonly MEDIUM: "MEDIUM";

NEGLIGIBLE
readonly NEGLIGIBLE: "NEGLIGIBLE";

HarmSeverity

const HarmSeverity: {
  HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";
  HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";
  HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";
  HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";
  HARM_SEVERITY_UNSUPPORTED: "HARM_SEVERITY_UNSUPPORTED";
};

Harm severity levels (UNSUPPORTED is the GoogleAI fallback).

Type Declaration

HARM_SEVERITY_HIGH
readonly HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";

HARM_SEVERITY_LOW
readonly HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";

HARM_SEVERITY_MEDIUM
readonly HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";

HARM_SEVERITY_NEGLIGIBLE
readonly HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";

HARM_SEVERITY_UNSUPPORTED
readonly HARM_SEVERITY_UNSUPPORTED: "HARM_SEVERITY_UNSUPPORTED";

ImageConfigAspectRatio

const ImageConfigAspectRatio: {
  LANDSCAPE_16x9: "16:9";
  LANDSCAPE_3x2: "3:2";
  LANDSCAPE_4x1: "4:1";
  LANDSCAPE_4x3: "4:3";
  LANDSCAPE_5x4: "5:4";
  LANDSCAPE_8x1: "8:1";
  PORTRAIT_1x4: "1:4";
  PORTRAIT_1x8: "1:8";
  PORTRAIT_2x3: "2:3";
  PORTRAIT_3x4: "3:4";
  PORTRAIT_4x5: "4:5";
  PORTRAIT_9x16: "9:16";
  SQUARE_1x1: "1:1";
  ULTRAWIDE_21x9: "21:9";
};

Aspect ratios for Gemini image generation (ImageConfig.aspectRatio).

Type Declaration

LANDSCAPE_16x9
readonly LANDSCAPE_16x9: "16:9";

LANDSCAPE_3x2
readonly LANDSCAPE_3x2: "3:2";

LANDSCAPE_4x1
readonly LANDSCAPE_4x1: "4:1";

LANDSCAPE_4x3
readonly LANDSCAPE_4x3: "4:3";

LANDSCAPE_5x4
readonly LANDSCAPE_5x4: "5:4";

LANDSCAPE_8x1
readonly LANDSCAPE_8x1: "8:1";

PORTRAIT_1x4
readonly PORTRAIT_1x4: "1:4";

PORTRAIT_1x8
readonly PORTRAIT_1x8: "1:8";

PORTRAIT_2x3
readonly PORTRAIT_2x3: "2:3";

PORTRAIT_3x4
readonly PORTRAIT_3x4: "3:4";

PORTRAIT_4x5
readonly PORTRAIT_4x5: "4:5";

PORTRAIT_9x16
readonly PORTRAIT_9x16: "9:16";

SQUARE_1x1
readonly SQUARE_1x1: "1:1";

ULTRAWIDE_21x9
readonly ULTRAWIDE_21x9: "21:9";

ImageConfigImageSize

const ImageConfigImageSize: {
  SIZE_1K: "1K";
  SIZE_2K: "2K";
  SIZE_4K: "4K";
  SIZE_512: "512";
};

Sizes for Gemini generated images (ImageConfig.imageSize).

Type Declaration

SIZE_1K
readonly SIZE_1K: "1K";

SIZE_2K
readonly SIZE_2K: "2K";

SIZE_4K
readonly SIZE_4K: "4K";

SIZE_512
readonly SIZE_512: "512";

Language

const Language: {
  PYTHON: "PYTHON";
  UNSPECIFIED: "LANGUAGE_UNSPECIFIED";
};

Programming language of code the model executed.

Type Declaration

PYTHON
readonly PYTHON: "PYTHON";

UNSPECIFIED
readonly UNSPECIFIED: "LANGUAGE_UNSPECIFIED";

Modality

const Modality: {
  AUDIO: "AUDIO";
  DOCUMENT: "DOCUMENT";
  IMAGE: "IMAGE";
  MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
  TEXT: "TEXT";
  VIDEO: "VIDEO";
};

Content part modality.

Type Declaration

AUDIO
readonly AUDIO: "AUDIO";

DOCUMENT
readonly DOCUMENT: "DOCUMENT";

IMAGE
readonly IMAGE: "IMAGE";

MODALITY_UNSPECIFIED
readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";

TEXT
readonly TEXT: "TEXT";

VIDEO
readonly VIDEO: "VIDEO";

Outcome

const Outcome: {
  DEADLINE_EXCEEDED: "OUTCOME_DEADLINE_EXCEEDED";
  FAILED: "OUTCOME_FAILED";
  OK: "OUTCOME_OK";
  UNSPECIFIED: "OUTCOME_UNSPECIFIED";
};

Result of code the model ran.

Type Declaration

DEADLINE_EXCEEDED
readonly DEADLINE_EXCEEDED: "OUTCOME_DEADLINE_EXCEEDED";

FAILED
readonly FAILED: "OUTCOME_FAILED";

OK
readonly OK: "OUTCOME_OK";

UNSPECIFIED
readonly UNSPECIFIED: "OUTCOME_UNSPECIFIED";

POSSIBLE_ROLES

const POSSIBLE_ROLES: readonly ["user", "model", "function", "system"];

Possible roles (upstream POSSIBLE_ROLES).


ResponseModality

const ResponseModality: {
  AUDIO: "AUDIO";
  IMAGE: "IMAGE";
  TEXT: "TEXT";
};

Generation modalities in responses.

Type Declaration

AUDIO
readonly AUDIO: "AUDIO";

IMAGE
readonly IMAGE: "IMAGE";

TEXT
readonly TEXT: "TEXT";

SchemaType

const SchemaType: {
  ARRAY: "array";
  BOOLEAN: "boolean";
  INTEGER: "integer";
  NUMBER: "number";
  OBJECT: "object";
  STRING: "string";
};

OpenAPI data types for Schema.

Type Declaration

ARRAY
readonly ARRAY: "array";

BOOLEAN
readonly BOOLEAN: "boolean";

INTEGER
readonly INTEGER: "integer";

NUMBER
readonly NUMBER: "number";

OBJECT
readonly OBJECT: "object";

STRING
readonly STRING: "string";

TARGET_SYMBOL

const TARGET_SYMBOL: unique symbol;

ThinkingLevel

const ThinkingLevel: {
  HIGH: "HIGH";
  LOW: "LOW";
  MEDIUM: "MEDIUM";
  MINIMAL: "MINIMAL";
};

Preset controlling the thinking process of compatible models.

Type Declaration

HIGH
readonly HIGH: "HIGH";

LOW
readonly LOW: "LOW";

MEDIUM
readonly MEDIUM: "MEDIUM";

MINIMAL
readonly MINIMAL: "MINIMAL";

URLRetrievalStatus

const URLRetrievalStatus: {
  URL_RETRIEVAL_STATUS_ERROR: "URL_RETRIEVAL_STATUS_ERROR";
  URL_RETRIEVAL_STATUS_PAYWALL: "URL_RETRIEVAL_STATUS_PAYWALL";
  URL_RETRIEVAL_STATUS_SUCCESS: "URL_RETRIEVAL_STATUS_SUCCESS";
  URL_RETRIEVAL_STATUS_UNSAFE: "URL_RETRIEVAL_STATUS_UNSAFE";
  URL_RETRIEVAL_STATUS_UNSPECIFIED: "URL_RETRIEVAL_STATUS_UNSPECIFIED";
};

Status of a URL retrieval.

Type Declaration

URL_RETRIEVAL_STATUS_ERROR
readonly URL_RETRIEVAL_STATUS_ERROR: "URL_RETRIEVAL_STATUS_ERROR";

URL_RETRIEVAL_STATUS_PAYWALL
readonly URL_RETRIEVAL_STATUS_PAYWALL: "URL_RETRIEVAL_STATUS_PAYWALL";

URL_RETRIEVAL_STATUS_SUCCESS
readonly URL_RETRIEVAL_STATUS_SUCCESS: "URL_RETRIEVAL_STATUS_SUCCESS";

URL_RETRIEVAL_STATUS_UNSAFE
readonly URL_RETRIEVAL_STATUS_UNSAFE: "URL_RETRIEVAL_STATUS_UNSAFE";

URL_RETRIEVAL_STATUS_UNSPECIFIED
readonly URL_RETRIEVAL_STATUS_UNSPECIFIED: "URL_RETRIEVAL_STATUS_UNSPECIFIED";

Functions

getAI()

Call Signature

function getAI(sandbox: Sandbox, options?: AIOptions): AI;

Construct a sandbox-backed AI handle:

  • getAI() uses the default app initialized through package resolution.
  • getAI(sandbox, options?) answers through the sandbox engine.
  • getAI(app, options?) preserves ai.app === app.

Repeat calls for the same owner and backend return a stable handle; the first call’s options win. A later call passing a structurally different engine option is a no-op — console.warns once per sandbox so the silent drop has a signal.

Parameters
ParameterType
sandboxSandbox
options?AIOptions
Returns

AI

Call Signature

function getAI(app?: FirebaseApp, options?: AIOptions): AppAI;

Construct a sandbox-backed AI handle:

  • getAI() uses the default app initialized through package resolution.
  • getAI(sandbox, options?) answers through the sandbox engine.
  • getAI(app, options?) preserves ai.app === app.

Repeat calls for the same owner and backend return a stable handle; the first call’s options win. A later call passing a structurally different engine option is a no-op — console.warns once per sandbox so the silent drop has a signal.

Parameters
ParameterType
app?FirebaseApp
options?AIOptions
Returns

AppAI


getGenerativeModel()

function getGenerativeModel(
   ai: AI,
   modelParams: ModelParams,
   requestOptions?: RequestOptions): GenerativeModel;

Return a sandbox-backed model with the canonical Firebase method shape.

Parameters

ParameterType
aiAI
modelParamsModelParams
requestOptions?RequestOptions

Returns

GenerativeModel