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
Returns
AIError
Overrides
FirebaseError.constructor
Properties
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
Returns
AIModel
Properties
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
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
Returns
AnyOfSchema
Overrides
Schema.constructor
Properties
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
Returns
AnyOfSchema
Inherited from
Schema.anyOf
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
Inherited from
Schema.array
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Inherited from
Schema.boolean
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
Inherited from
Schema.enumString
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Inherited from
Schema.integer
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
Inherited from
Schema.number
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
Inherited from
Schema.object
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
ArraySchema
Overrides
Schema.constructor
Properties
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
Returns
AnyOfSchema
Inherited from
Schema.anyOf
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
Inherited from
Schema.array
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Inherited from
Schema.boolean
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
Inherited from
Schema.enumString
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Inherited from
Schema.integer
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
Inherited from
Schema.number
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
Inherited from
Schema.object
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
Backend
Properties
BooleanSchema
Schema class for “boolean” types.
Extends
Indexable
[key: string]: unknown
Constructors
Constructor
new BooleanSchema(schemaParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Overrides
Schema.constructor
Properties
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
Returns
AnyOfSchema
Inherited from
Schema.anyOf
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
Inherited from
Schema.array
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Inherited from
Schema.boolean
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
Inherited from
Schema.enumString
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Inherited from
Schema.integer
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
Inherited from
Schema.number
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
Inherited from
Schema.object
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
ChatSession
Overrides
ChatSessionBase.constructor
Properties
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
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
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
Returns
GenerativeModel
Overrides
AIModel.constructor
Properties
Methods
countTokens()
countTokens(request: RequestInput | GenerateContentRequestShape, singleRequestOptions?: SingleRequestOptions): Promise<CountTokensResponse>;
Parameters
Returns
Promise<CountTokensResponse>
generateContent()
generateContent(request: RequestInput | GenerateContentRequestShape, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
Parameters
Returns
Promise<GenerateContentResult>
generateContentStream()
generateContentStream(request: RequestInput | GenerateContentRequestShape, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
Parameters
Returns
Promise<GenerateContentStreamResult>
startChat()
startChat(startChatParams?: StartChatParams): ChatSession;
Parameters
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
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
IntegerSchema
Schema class for “integer” types.
Extends
Indexable
[key: string]: unknown
Constructors
Constructor
new IntegerSchema(schemaParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Overrides
Schema.constructor
Properties
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
Returns
AnyOfSchema
Inherited from
Schema.anyOf
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
Inherited from
Schema.array
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Inherited from
Schema.boolean
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
Inherited from
Schema.enumString
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Inherited from
Schema.integer
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
Inherited from
Schema.number
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
Inherited from
Schema.object
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
NumberSchema
Overrides
Schema.constructor
Properties
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
Returns
AnyOfSchema
Inherited from
Schema.anyOf
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
Inherited from
Schema.array
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Inherited from
Schema.boolean
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
Inherited from
Schema.enumString
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Inherited from
Schema.integer
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
Inherited from
Schema.number
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
Inherited from
Schema.object
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
ObjectSchema
Overrides
Schema.constructor
Properties
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
Returns
AnyOfSchema
Inherited from
Schema.anyOf
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
Inherited from
Schema.array
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Inherited from
Schema.boolean
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
Inherited from
Schema.enumString
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Inherited from
Schema.integer
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
Inherited from
Schema.number
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
Inherited from
Schema.object
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
Schema
Properties
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
Returns
AnyOfSchema
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
StringSchema
Overrides
Schema.constructor
Properties
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
Returns
AnyOfSchema
Inherited from
Schema.anyOf
array()
static array(arrayParams: SchemaParams & {
items: TypedSchema;
}): ArraySchema;
Parameters
Returns
ArraySchema
Inherited from
Schema.array
boolean()
static boolean(booleanParams?: SchemaParams): BooleanSchema;
Parameters
Returns
BooleanSchema
Inherited from
Schema.boolean
enumString()
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
Parameters
Returns
StringSchema
Inherited from
Schema.enumString
integer()
static integer(integerParams?: SchemaParams): IntegerSchema;
Parameters
Returns
IntegerSchema
Inherited from
Schema.integer
number()
static number(numberParams?: SchemaParams): NumberSchema;
Parameters
Returns
NumberSchema
Inherited from
Schema.number
object()
static object(objectParams: SchemaParams & {
optionalProperties?: string[];
properties: Record<string, TypedSchema>;
}): ObjectSchema;
Parameters
Returns
ObjectSchema
Inherited from
Schema.object
string()
static string(stringParams?: SchemaParams): StringSchema;
Parameters
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
Returns
VertexAIBackend
Overrides
Backend.constructor
Properties
Interfaces
AI
Sandbox AI handle. Direct sandbox handles have no app.
Properties
AIOptions
Initialization options; engine is the sandbox-only answer-engine seam.
Properties
BaseParams
Extended by
Properties
Citation
Properties
Properties
CodeExecutionResult
Properties
CodeExecutionResultPart
Properties
Properties
Content
Properties
CountTokensRequest
Properties
CountTokensResponse
Properties
CustomErrorData
Data from a bad HTTP response (upstream CustomErrorData shape).
Properties
Date
Properties
EnhancedGenerateContentResponse
Extends
Properties
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
ExecutableCode
Properties
ExecutableCodePart
Properties
FileData
Properties
FileDataPart
Properties
FunctionCall
Properties
FunctionCallingConfig
Properties
FunctionCallPart
Properties
FunctionDeclaration
Properties
Properties
FunctionResponse
Properties
FunctionResponsePart
Properties
GenerateContentCandidate
Properties
GenerateContentRequest
Properties
GenerateContentResponse
Extended by
Properties
GenerateContentResult
Properties
GenerateContentStreamResult
Properties
GenerationConfig
Properties
GenerativeContentBlob
Properties
GoogleMaps
Properties
GoogleMapsGroundingChunk
Properties
Properties
GoogleSearch
Properties
GroundingChunk
Properties
Properties
GroundingSupport
Properties
ImageConfig
Properties
InlineDataPart
Properties
LatLng
Properties
ModalityTokenCount
Properties
ModelParams
Extends
Properties
ObjectSchemaRequest
Extends
Indexable
[key: string]: unknown
Properties
PromptFeedback
Properties
RequestOptions
Properties
RetrievalConfig
Properties
SafetyRating
Properties
SafetySetting
Properties
SchemaInterface
Extends
Indexable
[key: string]: unknown
Properties
SchemaParams
Params accepted by the static builders (upstream SchemaParams shape).
Indexable
[key: string]: unknown
Properties
SchemaRequest
Extends
Extended by
Indexable
[key: string]: unknown
Properties
SchemaShared
Extended by
Type Parameters
Indexable
[key: string]: unknown
Properties
SearchEntrypoint
Properties
Segment
Properties
SingleRequestOptions
Properties
StartChatParams
Extends
Properties
TextPart
Properties
ThinkingConfig
Properties
Properties
URLContext
URLContextMetadata
Properties
URLContextTool
Properties
Properties
Properties
Properties
WebGroundingChunk
Properties
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 target —
getAI(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];
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";
readonly MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL";
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";
readonly TOO_MANY_TOOL_CALLS: "TOO_MANY_TOOL_CALLS";
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
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
Returns
AppAI
getGenerativeModel()
function getGenerativeModel(
ai: AI,
modelParams: ModelParams,
requestOptions?: RequestOptions): GenerativeModel;
Return a sandbox-backed model with the canonical Firebase method shape.
Parameters
Returns
GenerativeModel