Skip to content

Commit fce2470

Browse files
committed
feat!(ai): remove vertexai APIs
BREAKING CHANGE
1 parent 40be2db commit fce2470

File tree

7 files changed

+3
-294
lines changed

7 files changed

+3
-294
lines changed

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
@@ -423,9 +419,6 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOpti
423419
// @beta
424420
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
425421

426-
// @public @deprecated (undocumented)
427-
export function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
428-
429422
// @public
430423
export class GoogleAIBackend extends Backend {
431424
constructor();
@@ -921,27 +914,12 @@ export interface UsageMetadata {
921914
totalTokenCount: number;
922915
}
923916

924-
// @public @deprecated (undocumented)
925-
export type VertexAI = AI;
926-
927917
// @public
928918
export class VertexAIBackend extends Backend {
929919
constructor(location?: string);
930920
readonly location: string;
931921
}
932922

933-
// @public @deprecated (undocumented)
934-
export const VertexAIError: typeof AIError;
935-
936-
// @public @deprecated (undocumented)
937-
export const VertexAIModel: typeof AIModel;
938-
939-
// @public
940-
export interface VertexAIOptions {
941-
// (undocumented)
942-
location?: string;
943-
}
944-
945923
// @public
946924
export interface VideoMetadata {
947925
endOffset: string;

docs-devsite/_toc.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ toc:
144144
path: /docs/reference/js/ai.usagemetadata.md
145145
- title: VertexAIBackend
146146
path: /docs/reference/js/ai.vertexaibackend.md
147-
- title: VertexAIOptions
148-
path: /docs/reference/js/ai.vertexaioptions.md
149147
- title: VideoMetadata
150148
path: /docs/reference/js/ai.videometadata.md
151149
- 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. |
@@ -121,7 +120,6 @@ The Firebase AI Web SDK.
121120
| [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. |
122121
| [ToolConfig](./ai.toolconfig.md#toolconfig_interface) | Tool config. This config is shared for all tools provided in the request. |
123122
| [UsageMetadata](./ai.usagemetadata.md#usagemetadata_interface) | Usage metadata about a [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
124-
| [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. |
125123
| [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. |
126124
| [WebAttribution](./ai.webattribution.md#webattribution_interface) | |
127125

@@ -132,8 +130,6 @@ The Firebase AI Web SDK.
132130
| [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. |
133131
| [POSSIBLE\_ROLES](./ai.md#possible_roles) | Possible roles. |
134132
| [ResponseModality](./ai.md#responsemodality) | <b><i>(Public Preview)</i></b> Generation modalities to be returned in generation responses. |
135-
| [VertexAIError](./ai.md#vertexaierror) | |
136-
| [VertexAIModel](./ai.md#vertexaimodel) | |
137133

138134
## Type Aliases
139135

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

150145
## function(app, ...)
151146

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

199194
```
200195

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

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

323-
## VertexAIError
324-
325-
> Warning: This API is now obsolete.
326-
>
327-
> 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)<!-- -->.
328-
>
329-
> Error class for the Firebase AI SDK.
330-
>
331-
332-
<b>Signature:</b>
333-
334-
```typescript
335-
VertexAIError: typeof AIError
336-
```
337-
338-
## VertexAIModel
339-
340-
> Warning: This API is now obsolete.
341-
>
342-
> 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)<!-- -->.
343-
>
344-
> Base class for Firebase AI model APIs.
345-
>
346-
347-
<b>Signature:</b>
348-
349-
```typescript
350-
VertexAIModel: typeof AIModel
351-
```
352-
353292
## BackendType
354293

355294
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.
413352
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
414353
```
415354

416-
## VertexAI
417-
418-
> Warning: This API is now obsolete.
419-
>
420-
> 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)<!-- -->.
421-
>
422-
> An instance of the Firebase AI SDK.
423-
>
424-
425-
<b>Signature:</b>
426-
427-
```typescript
428-
export type VertexAI = AI;
429-
```
430-
431355
## AIErrorCode
432356

433357
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

packages/ai/src/backwards-compatbility.test.ts

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

0 commit comments

Comments
 (0)