Skip to content

feat!(ai): remove VertexAI APIs #9063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/thirty-eggs-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/ai': major
'firebase': major
---

Remove `VertexAI` APIs.
24 changes: 1 addition & 23 deletions common/api-review/ai.api.md
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ export class AIError extends FirebaseError {
}

// @public
const enum AIErrorCode {
export const enum AIErrorCode {
API_NOT_ENABLED = "api-not-enabled",
ERROR = "error",
FETCH_ERROR = "fetch-error",
@@ -43,10 +43,6 @@ const enum AIErrorCode {
UNSUPPORTED = "unsupported"
}

export { AIErrorCode }

export { AIErrorCode as VertexAIErrorCode }

// @public
export abstract class AIModel {
// @internal
@@ -424,9 +420,6 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOpti
// @beta
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;

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

// @public
export class GoogleAIBackend extends Backend {
constructor();
@@ -926,27 +919,12 @@ export interface UsageMetadata {
totalTokenCount: number;
}

// @public @deprecated (undocumented)
export type VertexAI = AI;

// @public
export class VertexAIBackend extends Backend {
constructor(location?: string);
readonly location: string;
}

// @public @deprecated (undocumented)
export const VertexAIError: typeof AIError;

// @public @deprecated (undocumented)
export const VertexAIModel: typeof AIModel;

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

// @public
export interface VideoMetadata {
endOffset: string;
2 changes: 0 additions & 2 deletions docs-devsite/_toc.yaml
Original file line number Diff line number Diff line change
@@ -144,8 +144,6 @@ toc:
path: /docs/reference/js/ai.usagemetadata.md
- title: VertexAIBackend
path: /docs/reference/js/ai.vertexaibackend.md
- title: VertexAIOptions
path: /docs/reference/js/ai.vertexaioptions.md
- title: VideoMetadata
path: /docs/reference/js/ai.videometadata.md
- title: WebAttribution
76 changes: 0 additions & 76 deletions docs-devsite/ai.md
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ The Firebase AI Web SDK.
| --- | --- |
| <b>function(app, ...)</b> |
| [getAI(app, options)](./ai.md#getai_a94a413) | Returns the default [AI](./ai.ai.md#ai_interface) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with the default settings. |
| [getVertexAI(app, options)](./ai.md#getvertexai_04094cf) | |
| <b>function(ai, ...)</b> |
| [getGenerativeModel(ai, modelParams, requestOptions)](./ai.md#getgenerativemodel_80bd839) | Returns a [GenerativeModel](./ai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. |
| [getImagenModel(ai, modelParams, requestOptions)](./ai.md#getimagenmodel_e1f6645) | <b><i>(Public Preview)</i></b> Returns an [ImagenModel](./ai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.<!-- -->Only Imagen 3 models (named <code>imagen-3.0-*</code>) are supported. |
@@ -121,7 +120,6 @@ The Firebase AI Web SDK.
| [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. |
| [ToolConfig](./ai.toolconfig.md#toolconfig_interface) | Tool config. This config is shared for all tools provided in the request. |
| [UsageMetadata](./ai.usagemetadata.md#usagemetadata_interface) | Usage metadata about a [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
| [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. |
| [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. |
| [WebAttribution](./ai.webattribution.md#webattribution_interface) | |

@@ -132,8 +130,6 @@ The Firebase AI Web SDK.
| [BackendType](./ai.md#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 <code>backendType</code> property within the specific backend configuration objects ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class) or [VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)<!-- -->) to identify which service to target. |
| [POSSIBLE\_ROLES](./ai.md#possible_roles) | Possible roles. |
| [ResponseModality](./ai.md#responsemodality) | <b><i>(Public Preview)</i></b> Generation modalities to be returned in generation responses. |
| [VertexAIError](./ai.md#vertexaierror) | |
| [VertexAIModel](./ai.md#vertexaimodel) | |

## Type Aliases

@@ -145,7 +141,6 @@ The Firebase AI Web SDK.
| [Role](./ai.md#role) | Role is the producer of the content. |
| [Tool](./ai.md#tool) | Defines a tool that model can call to access external knowledge. |
| [TypedSchema](./ai.md#typedschema) | A type that includes all specific Schema types. |
| [VertexAI](./ai.md#vertexai) | |

## function(app, ...)

@@ -198,32 +193,6 @@ const ai = getAI(app, { backend: new VertexAIBackend() });

```

### getVertexAI(app, options) {:#getvertexai_04094cf}

> Warning: This API is now obsolete.
>
> Use the new [getAI()](./ai.md#getai_a94a413) instead. The Vertex AI in Firebase SDK has been replaced with the Firebase AI SDK to accommodate the evolving set of supported features and services. For migration details, see the [migration guide](https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk)<!-- -->.
>
> Returns a [VertexAI](./ai.md#vertexai) instance for the given app, configured to use the Vertex AI Gemini API. This instance will be configured to use the Vertex AI Gemini API.
>

<b>Signature:</b>

```typescript
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) to use. |
| options | [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options to configure the Vertex AI instance, including the location. |

<b>Returns:</b>

[VertexAI](./ai.md#vertexai)

## function(ai, ...)

### getGenerativeModel(ai, modelParams, requestOptions) {:#getgenerativemodel_80bd839}
@@ -320,36 +289,6 @@ ResponseModality: {
}
```

## VertexAIError

> Warning: This API is now obsolete.
>
> Use the new [AIError](./ai.aierror.md#aierror_class) instead. The Vertex AI in Firebase SDK has been replaced with the Firebase AI SDK to accommodate the evolving set of supported features and services. For migration details, see the [migration guide](https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk)<!-- -->.
>
> Error class for the Firebase AI SDK.
>

<b>Signature:</b>

```typescript
VertexAIError: typeof AIError
```

## VertexAIModel

> Warning: This API is now obsolete.
>
> Use the new [AIModel](./ai.aimodel.md#aimodel_class) instead. The Vertex AI in Firebase SDK has been replaced with the Firebase AI SDK to accommodate the evolving set of supported features and services. For migration details, see the [migration guide](https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk)<!-- -->.
>
> Base class for Firebase AI model APIs.
>

<b>Signature:</b>

```typescript
VertexAIModel: typeof AIModel
```

## BackendType

Type alias representing valid backend types. It can be either `'VERTEX_AI'` or `'GOOGLE_AI'`<!-- -->.
@@ -413,21 +352,6 @@ A type that includes all specific Schema types.
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
```

## VertexAI

> Warning: This API is now obsolete.
>
> Use the new [AI](./ai.ai.md#ai_interface) instead. The Vertex AI in Firebase SDK has been replaced with the Firebase AI SDK to accommodate the evolving set of supported features and services. For migration details, see the [migration guide](https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk)<!-- -->.
>
> An instance of the Firebase AI SDK.
>

<b>Signature:</b>

```typescript
export type VertexAI = AI;
```

## AIErrorCode

Standardized error codes that [AIError](./ai.aierror.md#aierror_class) can have.
33 changes: 0 additions & 33 deletions docs-devsite/ai.vertexaioptions.md

This file was deleted.

57 changes: 2 additions & 55 deletions packages/ai/src/api.ts
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import { Provider } from '@firebase/component';
import { getModularInstance } from '@firebase/util';
import { AI_TYPE } from './constants';
import { AIService } from './service';
import { AI, AIOptions, VertexAI, VertexAIOptions } from './public-types';
import { AI, AIOptions } from './public-types';
import {
ImagenModelParams,
ModelParams,
@@ -30,73 +30,20 @@ import {
import { AIError } from './errors';
import { AIModel, GenerativeModel, ImagenModel } from './models';
import { encodeInstanceIdentifier } from './helpers';
import { GoogleAIBackend, VertexAIBackend } from './backend';
import { GoogleAIBackend } from './backend';

export { ChatSession } from './methods/chat-session';
export * from './requests/schema-builder';
export { ImagenImageFormat } from './requests/imagen-image-format';
export { AIModel, GenerativeModel, ImagenModel, AIError };
export { Backend, VertexAIBackend, GoogleAIBackend } from './backend';

export { AIErrorCode as VertexAIErrorCode };

/**
* @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
*
* Base class for Firebase AI model APIs.
*
* @public
*/
export const VertexAIModel = AIModel;

/**
* @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
*
* Error class for the Firebase AI SDK.
*
* @public
*/
export const VertexAIError = AIError;

declare module '@firebase/component' {
interface NameServiceMapping {
[AI_TYPE]: AIService;
}
}

/**
* @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
*
* Returns a {@link VertexAI} instance for the given app, configured to use the
* Vertex AI Gemini API. This instance will be
* configured to use the Vertex AI Gemini API.
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
* @param options - Options to configure the Vertex AI instance, including the location.
*
* @public
*/
export function getVertexAI(
app: FirebaseApp = getApp(),
options?: VertexAIOptions
): VertexAI {
app = getModularInstance(app);
// Dependencies
const AIProvider: Provider<'AI'> = _getProvider(app, AI_TYPE);

const backend = new VertexAIBackend(options?.location);
const identifier = encodeInstanceIdentifier(backend);
return AIProvider.getImmediate({
identifier
});
}

/**
* Returns the default {@link AI} instance that is associated with the provided
* {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new instance with the
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.