The Firebase AI Web SDK.
Functions
Function | Description |
---|---|
function(app, ...) | |
getAI(app, options) | Returns the default AI instance that is associated with the provided FirebaseApp. If no instance exists, initializes a new instance with the default settings. |
function(ai, ...) | |
getGenerativeModel(ai, modelParams, requestOptions) | Returns a GenerativeModel class with methods for inference and other functionality. |
getImagenModel(ai, modelParams, requestOptions) | (Public Preview) Returns an ImagenModel class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-* ) are supported. |
Classes
Class | Description |
---|---|
AIError | Error class for the Firebase AI SDK. |
AIModel | Base class for Firebase AI model APIs.Instances of this class are associated with a specific Firebase AI Backend and provide methods for interacting with the configured generative model. |
AnyOfSchema | Schema class representing a value that can conform to any of the provided sub-schemas. This is useful when a field can accept multiple distinct types or structures. |
ArraySchema | Schema class for "array" types. The items param should refer to the type of item that can be a member of the array. |
Backend | Abstract base class representing the configuration for an AI service backend. This class should not be instantiated directly. Use its subclasses; GoogleAIBackend for the Gemini Developer API (via Google AI), and VertexAIBackend for the Vertex AI Gemini API. |
BooleanSchema | Schema class for "boolean" types. |
ChatSession | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. |
GenerativeModel | Class for generative model APIs. |
GoogleAIBackend | Configuration class for the Gemini Developer API.Use this with AIOptions when initializing the AI service via getAI() to specify the Gemini Developer API as the backend. |
ImagenImageFormat | (Public Preview) Defines the image format for images generated by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of ImagenModelParams. |
ImagenModel | (Public Preview) Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. |
IntegerSchema | Schema class for "integer" types. |
NumberSchema | Schema class for "number" types. |
ObjectSchema | Schema class for "object" types. The properties param must be a map of Schema objects. |
Schema | Parent class encompassing all Schema types, with static methods that allow building specific Schema types. This class can be converted with JSON.stringify() into a JSON string accepted by Vertex AI REST endpoints. (This string conversion is automatically done when calling SDK methods.) |
StringSchema | Schema class for "string" types. Can be used with or without enum values. |
VertexAIBackend | Configuration class for the Vertex AI Gemini API.Use this with AIOptions when initializing the AI service via getAI() to specify the Vertex AI Gemini API as the backend. |
Interfaces
Interface | Description |
---|---|
AI | An instance of the Firebase AI SDK.Do not create this instance directly. Instead, use getAI(). |
AIOptions | Options for initializing the AI service using getAI(). This allows specifying which backend to use (Vertex AI Gemini API or Gemini Developer API) and configuring its specific options (like location for Vertex AI). |
BaseParams | Base parameters for a number of methods. |
Citation | A single citation. |
CitationMetadata | Citation metadata that may be found on a GenerateContentCandidate. |
Content | Content type for both prompts and response candidates. |
CountTokensRequest | Params for calling GenerativeModel.countTokens() |
CountTokensResponse | Response from calling GenerativeModel.countTokens(). |
CustomErrorData | Details object that contains data originating from a bad HTTP response. |
Date_2 | Protobuf google.type.Date |
EnhancedGenerateContentResponse | Response object wrapped with helper methods. |
ErrorDetails | Details object that may be included in an error response. |
FileData | Data pointing to a file uploaded on Google Cloud Storage. |
FileDataPart | Content part interface if the part represents FileData |
FunctionCall | A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values. |
FunctionCallingConfig | |
FunctionCallPart | Content part interface if the part represents a FunctionCall. |
FunctionDeclaration | Structured representation of a function declaration as defined by the OpenAPI 3.0 specification. Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client. |
FunctionDeclarationsTool | A FunctionDeclarationsTool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. |
FunctionResponse | The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a FunctionCall made based on model prediction. |
FunctionResponsePart | Content part interface if the part represents FunctionResponse. |
GenerateContentCandidate | A candidate returned as part of a GenerateContentResponse. |
GenerateContentRequest | Request sent through GenerativeModel.generateContent() |
GenerateContentResponse | Individual response from GenerativeModel.generateContent() and GenerativeModel.generateContentStream(). generateContentStream() will return one in each chunk until the stream is done. |
GenerateContentResult | Result object returned from GenerativeModel.generateContent() call. |
GenerateContentStreamResult | Result object returned from GenerativeModel.generateContentStream() call. Iterate over stream to get chunks as they come in and/or use the response promise to get the aggregated response when the stream is done. |
GenerationConfig | Config options for content-related requests |
GenerativeContentBlob | Interface for sending an image. |
GoogleSearch | Specifies the Google Search configuration. |
GoogleSearchTool | A tool that allows a Gemini model to connect to Google Search to access and incorporate up-to-date information from the web into its responses.Important: If using Grounding with Google Search, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: Gemini Developer API or Vertex AI Gemini API (see Service Terms section within the Service Specific Terms). |
GroundingChunk | Represents a chunk of retrieved data that supports a claim in the model's response. This is part of the grounding information provided when grounding is enabled. |
GroundingMetadata | Metadata returned when grounding is enabled.Currently, only Grounding with Google Search is supported (see GoogleSearchTool).Important: If using Grounding with Google Search, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: Gemini Developer API or Vertex AI Gemini API (see Service Terms section within the Service Specific Terms). |
GroundingSupport | Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks. |
ImagenGCSImage | An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.This feature is not available yet. |
ImagenGenerationConfig | (Public Preview) Configuration options for generating images with Imagen.See the documentation for more details. |
ImagenGenerationResponse | (Public Preview) The response from a request to generate images with Imagen. |
ImagenInlineImage | (Public Preview) An image generated by Imagen, represented as inline data. |
ImagenModelParams | (Public Preview) Parameters for configuring an ImagenModel. |
ImagenSafetySettings | (Public Preview) Settings for controlling the aggressiveness of filtering out sensitive content.See the documentation for more details. |
InlineDataPart | Content part interface if the part represents an image. |
ModalityTokenCount | Represents token counting info for a single modality. |
ModelParams | Params passed to getGenerativeModel(). |
ObjectSchemaRequest | Interface for JSON parameters in a schema of "object" when not using the Schema.object() helper. |
PromptFeedback | If the prompt was blocked, this will be populated with blockReason and the relevant safetyRatings . |
RequestOptions | Params passed to getGenerativeModel(). |
RetrievedContextAttribution | |
SafetyRating | A safety rating associated with a GenerateContentCandidate |
SafetySetting | Safety setting that can be sent as part of request parameters. |
SchemaInterface | Interface for Schema class. |
SchemaParams | Params passed to Schema static methods to create specific Schema classes. |
SchemaRequest | Final format for Schema params passed to backend requests. |
SchemaShared | Basic Schema properties shared across several Schema-related types. |
SearchEntrypoint | Google search entry point. |
Segment | Represents a specific segment within a Content object, often used to pinpoint the exact location of text or data that grounding information refers to. |
StartChatParams | Params for GenerativeModel.startChat(). |
TextPart | Content part interface if the part represents a text string. |
ThinkingConfig | Configuration for "thinking" behavior of compatible Gemini models.Certain models utilize a thinking process before generating a response. This allows them to reason through complex problems and plan a more coherent and accurate answer. |
ToolConfig | Tool config. This config is shared for all tools provided in the request. |
UsageMetadata | Usage metadata about a GenerateContentResponse. |
VideoMetadata | Describes the input video content. |
WebAttribution | |
WebGroundingChunk | A grounding chunk from the web.Important: If using Grounding with Google Search, you are required to comply with the Service Specific Terms for "Grounding with Google Search". |
Variables
Variable | Description |
---|---|
AIErrorCode | Standardized error codes that AIError can have. |
BackendType | An enum-like object containing constants that represent the supported backends for the Firebase AI SDK. This determines which backend service (Vertex AI Gemini API or Gemini Developer API) the SDK will communicate with.These values are assigned to the backendType property within the specific backend configuration objects (GoogleAIBackend or VertexAIBackend) to identify which service to target. |
BlockReason | Reason that a prompt was blocked. |
FinishReason | Reason that a candidate finished. |
FunctionCallingMode | |
HarmBlockMethod | This property is not supported in the Gemini Developer API (GoogleAIBackend). |
HarmBlockThreshold | Threshold above which a prompt or candidate will be blocked. |
HarmCategory | Harm categories that would cause prompts or candidates to be blocked. |
HarmProbability | Probability that a prompt or candidate matches a harm category. |
HarmSeverity | Harm severity levels. |
ImagenAspectRatio | (Public Preview) Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your ImagenGenerationConfig.See the the documentation for more details and examples of the supported aspect ratios. |
ImagenPersonFilterLevel | (Public Preview) A filter level controlling whether generation of images containing people or faces is allowed.See the personGeneration documentation for more details. |
ImagenSafetyFilterLevel | (Public Preview) A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence , sexual , derogatory , and toxic ). This filter level controls how aggressively to filter out potentially harmful content from responses. See the documentation and the Responsible AI and usage guidelines for more details. |
Modality | Content part modality. |
POSSIBLE_ROLES | Possible roles. |
ResponseModality | (Public Preview) Generation modalities to be returned in generation responses. |
SchemaType | Contains the list of OpenAPI data types as defined by the OpenAPI specification |
Type Aliases
Type Alias | Description |
---|---|
AIErrorCode | Standardized error codes that AIError can have. |
BackendType | Type alias representing valid backend types. It can be either 'VERTEX_AI' or 'GOOGLE_AI' . |
BlockReason | Reason that a prompt was blocked. |
FinishReason | Reason that a candidate finished. |
FunctionCallingMode | |
HarmBlockMethod | This property is not supported in the Gemini Developer API (GoogleAIBackend). |
HarmBlockThreshold | Threshold above which a prompt or candidate will be blocked. |
HarmCategory | Harm categories that would cause prompts or candidates to be blocked. |
HarmProbability | Probability that a prompt or candidate matches a harm category. |
HarmSeverity | Harm severity levels. |
ImagenAspectRatio | (Public Preview) Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your ImagenGenerationConfig.See the the documentation for more details and examples of the supported aspect ratios. |
ImagenPersonFilterLevel | (Public Preview) A filter level controlling whether generation of images containing people or faces is allowed.See the personGeneration documentation for more details. |
ImagenSafetyFilterLevel | (Public Preview) A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence , sexual , derogatory , and toxic ). This filter level controls how aggressively to filter out potentially harmful content from responses. See the documentation and the Responsible AI and usage guidelines for more details. |
Modality | Content part modality. |
Part | Content part - includes text, image/video, or function call/response part types. |
ResponseModality | (Public Preview) Generation modalities to be returned in generation responses. |
Role | Role is the producer of the content. |
SchemaType | Contains the list of OpenAPI data types as defined by the OpenAPI specification |
Tool | Defines a tool that model can call to access external knowledge. |
TypedSchema | A type that includes all specific Schema types. |
function(app, ...)
getAI(app, options)
Returns the default AI instance that is associated with the provided FirebaseApp. If no instance exists, initializes a new instance with the default settings.
Signature:
export declare function getAI(app?: FirebaseApp, options?: AIOptions): AI;
Parameters
Parameter | Type | Description |
---|---|---|
app | FirebaseApp | The FirebaseApp to use. |
options | AIOptions | AIOptions that configure the AI instance. |
Returns:
The default AI instance for the given FirebaseApp.
Example 1
const ai = getAI(app);
Example 2
// Get an AI instance configured to use the Gemini Developer API (via Google AI).
const ai = getAI(app, { backend: new GoogleAIBackend() });
Example 3
// Get an AI instance configured to use the Vertex AI Gemini API.
const ai = getAI(app, { backend: new VertexAIBackend() });
function(ai, ...)
getGenerativeModel(ai, modelParams, requestOptions)
Returns a GenerativeModel class with methods for inference and other functionality.
Signature:
export declare function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
Parameters
Parameter | Type | Description |
---|---|---|
ai | AI | |
modelParams | ModelParams | |
requestOptions | RequestOptions |
Returns:
getImagenModel(ai, modelParams, requestOptions)
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Returns an ImagenModel class with methods for using Imagen.
Only Imagen 3 models (named imagen-3.0-*
) are supported.
Signature:
export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
Parameters
Parameter | Type | Description |
---|---|---|
ai | AI | An AI instance. |
modelParams | ImagenModelParams | Parameters to use when making Imagen requests. |
requestOptions | RequestOptions | Additional options to use when making requests. |
Returns:
Exceptions
If the apiKey
or projectId
fields are missing in your Firebase config.
AIErrorCode
Standardized error codes that AIError can have.
Signature:
AIErrorCode: {
readonly ERROR: "error";
readonly REQUEST_ERROR: "request-error";
readonly RESPONSE_ERROR: "response-error";
readonly FETCH_ERROR: "fetch-error";
readonly INVALID_CONTENT: "invalid-content";
readonly API_NOT_ENABLED: "api-not-enabled";
readonly INVALID_SCHEMA: "invalid-schema";
readonly NO_API_KEY: "no-api-key";
readonly NO_APP_ID: "no-app-id";
readonly NO_MODEL: "no-model";
readonly NO_PROJECT_ID: "no-project-id";
readonly PARSE_FAILED: "parse-failed";
readonly UNSUPPORTED: "unsupported";
}
BackendType
An enum-like object containing constants that represent the supported backends for the Firebase AI SDK. This determines which backend service (Vertex AI Gemini API or Gemini Developer API) the SDK will communicate with.
These values are assigned to the backendType
property within the specific backend configuration objects (GoogleAIBackend or VertexAIBackend) to identify which service to target.
Signature:
BackendType: {
readonly VERTEX_AI: "VERTEX_AI";
readonly GOOGLE_AI: "GOOGLE_AI";
}
BlockReason
Reason that a prompt was blocked.
Signature:
BlockReason: {
readonly SAFETY: "SAFETY";
readonly OTHER: "OTHER";
readonly BLOCKLIST: "BLOCKLIST";
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
}
FinishReason
Reason that a candidate finished.
Signature:
FinishReason: {
readonly STOP: "STOP";
readonly MAX_TOKENS: "MAX_TOKENS";
readonly SAFETY: "SAFETY";
readonly RECITATION: "RECITATION";
readonly OTHER: "OTHER";
readonly BLOCKLIST: "BLOCKLIST";
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
readonly SPII: "SPII";
readonly MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL";
}
FunctionCallingMode
Signature:
FunctionCallingMode: {
readonly AUTO: "AUTO";
readonly ANY: "ANY";
readonly NONE: "NONE";
}
HarmBlockMethod
This property is not supported in the Gemini Developer API (GoogleAIBackend).
Signature:
HarmBlockMethod: {
readonly SEVERITY: "SEVERITY";
readonly PROBABILITY: "PROBABILITY";
}
HarmBlockThreshold
Threshold above which a prompt or candidate will be blocked.
Signature:
HarmBlockThreshold: {
readonly BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
readonly BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
readonly BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
readonly BLOCK_NONE: "BLOCK_NONE";
readonly OFF: "OFF";
}
HarmCategory
Harm categories that would cause prompts or candidates to be blocked.
Signature:
HarmCategory: {
readonly HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
readonly HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
readonly HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
readonly HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
}
HarmProbability
Probability that a prompt or candidate matches a harm category.
Signature:
HarmProbability: {
readonly NEGLIGIBLE: "NEGLIGIBLE";
readonly LOW: "LOW";
readonly MEDIUM: "MEDIUM";
readonly HIGH: "HIGH";
}
HarmSeverity
Harm severity levels.
Signature:
HarmSeverity: {
readonly HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";
readonly HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";
readonly HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";
readonly HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";
readonly HARM_SEVERITY_UNSUPPORTED: "HARM_SEVERITY_UNSUPPORTED";
}
ImagenAspectRatio
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Aspect ratios for Imagen images.
To specify an aspect ratio for generated images, set the aspectRatio
property in your ImagenGenerationConfig.
See the documentation for more details and examples of the supported aspect ratios.
Signature:
ImagenAspectRatio: {
readonly SQUARE: "1:1";
readonly LANDSCAPE_3x4: "3:4";
readonly PORTRAIT_4x3: "4:3";
readonly LANDSCAPE_16x9: "16:9";
readonly PORTRAIT_9x16: "9:16";
}
ImagenPersonFilterLevel
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
A filter level controlling whether generation of images containing people or faces is allowed.
See the personGeneration documentation for more details.
Signature:
ImagenPersonFilterLevel: {
readonly BLOCK_ALL: "dont_allow";
readonly ALLOW_ADULT: "allow_adult";
readonly ALLOW_ALL: "allow_all";
}
ImagenSafetyFilterLevel
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
A filter level controlling how aggressively to filter sensitive content.
Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence
, sexual
, derogatory
, and toxic
). This filter level controls how aggressively to filter out potentially harmful content from responses. See the documentation and the Responsible AI and usage guidelines for more details.
Signature:
ImagenSafetyFilterLevel: {
readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
readonly BLOCK_ONLY_HIGH: "block_only_high";
readonly BLOCK_NONE: "block_none";
}
Modality
Content part modality.
Signature:
Modality: {
readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
readonly TEXT: "TEXT";
readonly IMAGE: "IMAGE";
readonly VIDEO: "VIDEO";
readonly AUDIO: "AUDIO";
readonly DOCUMENT: "DOCUMENT";
}
POSSIBLE_ROLES
Possible roles.
Signature:
POSSIBLE_ROLES: readonly ["user", "model", "function", "system"]
ResponseModality
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Generation modalities to be returned in generation responses.
Signature:
ResponseModality: {
readonly TEXT: "TEXT";
readonly IMAGE: "IMAGE";
}
SchemaType
Contains the list of OpenAPI data types as defined by the OpenAPI specification
Signature:
SchemaType: {
readonly STRING: "string";
readonly NUMBER: "number";
readonly INTEGER: "integer";
readonly BOOLEAN: "boolean";
readonly ARRAY: "array";
readonly OBJECT: "object";
}
AIErrorCode
Standardized error codes that AIError can have.
Signature:
export type AIErrorCode = (typeof AIErrorCode)[keyof typeof AIErrorCode];
BackendType
Type alias representing valid backend types. It can be either 'VERTEX_AI'
or 'GOOGLE_AI'
.
Signature:
export type BackendType = (typeof BackendType)[keyof typeof BackendType];
BlockReason
Reason that a prompt was blocked.
Signature:
export type BlockReason = (typeof BlockReason)[keyof typeof BlockReason];
FinishReason
Reason that a candidate finished.
Signature:
export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
FunctionCallingMode
Signature:
export type FunctionCallingMode = (typeof FunctionCallingMode)[keyof typeof FunctionCallingMode];
HarmBlockMethod
This property is not supported in the Gemini Developer API (GoogleAIBackend).
Signature:
export type HarmBlockMethod = (typeof HarmBlockMethod)[keyof typeof HarmBlockMethod];
HarmBlockThreshold
Threshold above which a prompt or candidate will be blocked.
Signature:
export type HarmBlockThreshold = (typeof HarmBlockThreshold)[keyof typeof HarmBlockThreshold];
HarmCategory
Harm categories that would cause prompts or candidates to be blocked.
Signature:
export type HarmCategory = (typeof HarmCategory)[keyof typeof HarmCategory];
HarmProbability
Probability that a prompt or candidate matches a harm category.
Signature:
export type HarmProbability = (typeof HarmProbability)[keyof typeof HarmProbability];
HarmSeverity
Harm severity levels.
Signature:
export type HarmSeverity = (typeof HarmSeverity)[keyof typeof HarmSeverity];
ImagenAspectRatio
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Aspect ratios for Imagen images.
To specify an aspect ratio for generated images, set the aspectRatio
property in your ImagenGenerationConfig.
See the the documentation for more details and examples of the supported aspect ratios.
Signature:
export type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
ImagenPersonFilterLevel
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
A filter level controlling whether generation of images containing people or faces is allowed.
See the personGeneration documentation for more details.
Signature:
export type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
ImagenSafetyFilterLevel
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
A filter level controlling how aggressively to filter sensitive content.
Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence
, sexual
, derogatory
, and toxic
). This filter level controls how aggressively to filter out potentially harmful content from responses. See the documentation and the Responsible AI and usage guidelines for more details.
Signature:
export type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
Modality
Content part modality.
Signature:
export type Modality = (typeof Modality)[keyof typeof Modality];
Part
Content part - includes text, image/video, or function call/response part types.
Signature:
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
ResponseModality
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Generation modalities to be returned in generation responses.
Signature:
export type ResponseModality = (typeof ResponseModality)[keyof typeof ResponseModality];
Role
Role is the producer of the content.
Signature:
export type Role = (typeof POSSIBLE_ROLES)[number];
SchemaType
Contains the list of OpenAPI data types as defined by the OpenAPI specification
Signature:
export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
Tool
Defines a tool that model can call to access external knowledge.
Signature:
export type Tool = FunctionDeclarationsTool | GoogleSearchTool;
TypedSchema
A type that includes all specific Schema types.
Signature:
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;