Skip to content

Commit ec5f374

Browse files
authored
feat!(ai): remove VertexAI APIs (#9063)
1 parent 6ab4e13 commit ec5f374

File tree

8 files changed

+9
-294
lines changed

8 files changed

+9
-294
lines changed

.changeset/thirty-eggs-laugh.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/ai': major
3+
'firebase': major
4+
---
5+
6+
Remove `VertexAI` APIs.

common/api-review/ai.api.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class AIError extends FirebaseError {
2727
}
2828

2929
// @public
30-
const enum AIErrorCode {
30+
export const enum AIErrorCode {
3131
API_NOT_ENABLED = "api-not-enabled",
3232
ERROR = "error",
3333
FETCH_ERROR = "fetch-error",
@@ -43,10 +43,6 @@ const enum AIErrorCode {
4343
UNSUPPORTED = "unsupported"
4444
}
4545

46-
export { AIErrorCode }
47-
48-
export { AIErrorCode as VertexAIErrorCode }
49-
5046
// @public
5147
export abstract class AIModel {
5248
// @internal
@@ -425,9 +421,6 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOpti
425421
// @beta
426422
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
427423

428-
// @public @deprecated (undocumented)
429-
export function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
430-
431424
// @public
432425
export class GoogleAIBackend extends Backend {
433426
constructor();
@@ -958,27 +951,12 @@ export interface UsageMetadata {
958951
totalTokenCount: number;
959952
}
960953

961-
// @public @deprecated (undocumented)
962-
export type VertexAI = AI;
963-
964954
// @public
965955
export class VertexAIBackend extends Backend {
966956
constructor(location?: string);
967957
readonly location: string;
968958
}
969959

970-
// @public @deprecated (undocumented)
971-
export const VertexAIError: typeof AIError;
972-
973-
// @public @deprecated (undocumented)
974-
export const VertexAIModel: typeof AIModel;
975-
976-
// @public
977-
export interface VertexAIOptions {
978-
// (undocumented)
979-
location?: string;
980-
}
981-
982960
// @public
983961
export interface VideoMetadata {
984962
endOffset: string;

docs-devsite/_toc.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ toc:
156156
path: /docs/reference/js/ai.usagemetadata.md
157157
- title: VertexAIBackend
158158
path: /docs/reference/js/ai.vertexaibackend.md
159-
- title: VertexAIOptions
160-
path: /docs/reference/js/ai.vertexaioptions.md
161159
- title: VideoMetadata
162160
path: /docs/reference/js/ai.videometadata.md
163161
- title: WebAttribution

docs-devsite/ai.md

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ The Firebase AI Web SDK.
1818
| --- | --- |
1919
| <b>function(app, ...)</b> |
2020
| [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. |
21-
| [getVertexAI(app, options)](./ai.md#getvertexai_04094cf) | |
2221
| <b>function(ai, ...)</b> |
2322
| [getGenerativeModel(ai, modelParams, requestOptions)](./ai.md#getgenerativemodel_80bd839) | Returns a [GenerativeModel](./ai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. |
2423
| [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. |
@@ -127,7 +126,6 @@ The Firebase AI Web SDK.
127126
| [ThinkingConfig](./ai.thinkingconfig.md#thinkingconfig_interface) | 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. |
128127
| [ToolConfig](./ai.toolconfig.md#toolconfig_interface) | Tool config. This config is shared for all tools provided in the request. |
129128
| [UsageMetadata](./ai.usagemetadata.md#usagemetadata_interface) | Usage metadata about a [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
130-
| [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. |
131129
| [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. |
132130
| [WebAttribution](./ai.webattribution.md#webattribution_interface) | |
133131
| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web.<!-- -->Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". |
@@ -139,8 +137,6 @@ The Firebase AI Web SDK.
139137
| [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. |
140138
| [POSSIBLE\_ROLES](./ai.md#possible_roles) | Possible roles. |
141139
| [ResponseModality](./ai.md#responsemodality) | <b><i>(Public Preview)</i></b> Generation modalities to be returned in generation responses. |
142-
| [VertexAIError](./ai.md#vertexaierror) | |
143-
| [VertexAIModel](./ai.md#vertexaimodel) | |
144140

145141
## Type Aliases
146142

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

157152
## function(app, ...)
158153

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

206201
```
207202

208-
### getVertexAI(app, options) {:#getvertexai_04094cf}
209-
210-
> Warning: This API is now obsolete.
211-
>
212-
> 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)<!-- -->.
213-
>
214-
> 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.
215-
>
216-
217-
<b>Signature:</b>
218-
219-
```typescript
220-
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
221-
```
222-
223-
#### Parameters
224-
225-
| Parameter | Type | Description |
226-
| --- | --- | --- |
227-
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) to use. |
228-
| options | [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options to configure the Vertex AI instance, including the location. |
229-
230-
<b>Returns:</b>
231-
232-
[VertexAI](./ai.md#vertexai)
233-
234203
## function(ai, ...)
235204

236205
### getGenerativeModel(ai, modelParams, requestOptions) {:#getgenerativemodel_80bd839}
@@ -327,36 +296,6 @@ ResponseModality: {
327296
}
328297
```
329298

330-
## VertexAIError
331-
332-
> Warning: This API is now obsolete.
333-
>
334-
> 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)<!-- -->.
335-
>
336-
> Error class for the Firebase AI SDK.
337-
>
338-
339-
<b>Signature:</b>
340-
341-
```typescript
342-
VertexAIError: typeof AIError
343-
```
344-
345-
## VertexAIModel
346-
347-
> Warning: This API is now obsolete.
348-
>
349-
> 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)<!-- -->.
350-
>
351-
> Base class for Firebase AI model APIs.
352-
>
353-
354-
<b>Signature:</b>
355-
356-
```typescript
357-
VertexAIModel: typeof AIModel
358-
```
359-
360299
## BackendType
361300

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

423-
## VertexAI
424-
425-
> Warning: This API is now obsolete.
426-
>
427-
> 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)<!-- -->.
428-
>
429-
> An instance of the Firebase AI SDK.
430-
>
431-
432-
<b>Signature:</b>
433-
434-
```typescript
435-
export type VertexAI = AI;
436-
```
437-
438362
## AIErrorCode
439363

440364
Standardized error codes that [AIError](./ai.aierror.md#aierror_class) can have.

docs-devsite/ai.vertexaioptions.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/ai/src/api.ts

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Provider } from '@firebase/component';
2020
import { getModularInstance } from '@firebase/util';
2121
import { AI_TYPE } from './constants';
2222
import { AIService } from './service';
23-
import { AI, AIOptions, VertexAI, VertexAIOptions } from './public-types';
23+
import { AI, AIOptions } from './public-types';
2424
import {
2525
ImagenModelParams,
2626
ModelParams,
@@ -30,73 +30,20 @@ import {
3030
import { AIError } from './errors';
3131
import { AIModel, GenerativeModel, ImagenModel } from './models';
3232
import { encodeInstanceIdentifier } from './helpers';
33-
import { GoogleAIBackend, VertexAIBackend } from './backend';
33+
import { GoogleAIBackend } from './backend';
3434

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

41-
export { AIErrorCode as VertexAIErrorCode };
42-
43-
/**
44-
* @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
45-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
46-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
47-
*
48-
* Base class for Firebase AI model APIs.
49-
*
50-
* @public
51-
*/
52-
export const VertexAIModel = AIModel;
53-
54-
/**
55-
* @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
56-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
57-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
58-
*
59-
* Error class for the Firebase AI SDK.
60-
*
61-
* @public
62-
*/
63-
export const VertexAIError = AIError;
64-
6541
declare module '@firebase/component' {
6642
interface NameServiceMapping {
6743
[AI_TYPE]: AIService;
6844
}
6945
}
7046

71-
/**
72-
* @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
73-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
74-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
75-
*
76-
* Returns a {@link VertexAI} instance for the given app, configured to use the
77-
* Vertex AI Gemini API. This instance will be
78-
* configured to use the Vertex AI Gemini API.
79-
*
80-
* @param app - The {@link @firebase/app#FirebaseApp} to use.
81-
* @param options - Options to configure the Vertex AI instance, including the location.
82-
*
83-
* @public
84-
*/
85-
export function getVertexAI(
86-
app: FirebaseApp = getApp(),
87-
options?: VertexAIOptions
88-
): VertexAI {
89-
app = getModularInstance(app);
90-
// Dependencies
91-
const AIProvider: Provider<'AI'> = _getProvider(app, AI_TYPE);
92-
93-
const backend = new VertexAIBackend(options?.location);
94-
const identifier = encodeInstanceIdentifier(backend);
95-
return AIProvider.getImmediate({
96-
identifier
97-
});
98-
}
99-
10047
/**
10148
* Returns the default {@link AI} instance that is associated with the provided
10249
* {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new instance with the

0 commit comments

Comments
 (0)