Skip to content

Commit 4e831d1

Browse files
committed
Convert GenAI to new Firebase AI naming
1 parent c3ec037 commit 4e831d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+697
-694
lines changed

common/api-review/vertexai.api.md

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,62 @@ import { FirebaseApp } from '@firebase/app';
99
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
1010
import { FirebaseError } from '@firebase/util';
1111

12+
// @public
13+
export interface AI {
14+
app: FirebaseApp;
15+
backend: Backend;
16+
// @deprecated
17+
location: string;
18+
}
19+
20+
// @public
21+
export class AIError extends FirebaseError {
22+
constructor(code: AIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
23+
// (undocumented)
24+
readonly code: AIErrorCode;
25+
// (undocumented)
26+
readonly customErrorData?: CustomErrorData | undefined;
27+
}
28+
29+
// @public
30+
const enum AIErrorCode {
31+
API_NOT_ENABLED = "api-not-enabled",
32+
ERROR = "error",
33+
FETCH_ERROR = "fetch-error",
34+
INVALID_CONTENT = "invalid-content",
35+
INVALID_SCHEMA = "invalid-schema",
36+
NO_API_KEY = "no-api-key",
37+
NO_APP_ID = "no-app-id",
38+
NO_MODEL = "no-model",
39+
NO_PROJECT_ID = "no-project-id",
40+
PARSE_FAILED = "parse-failed",
41+
REQUEST_ERROR = "request-error",
42+
RESPONSE_ERROR = "response-error",
43+
UNSUPPORTED = "unsupported"
44+
}
45+
46+
export { AIErrorCode }
47+
48+
export { AIErrorCode as VertexAIErrorCode }
49+
50+
// @public
51+
export abstract class AIModel {
52+
// @internal
53+
protected constructor(ai: AI, modelName: string);
54+
// Warning: (ae-forgotten-export) The symbol "ApiSettings" needs to be exported by the entry point index.d.ts
55+
//
56+
// @internal (undocumented)
57+
protected _apiSettings: ApiSettings;
58+
readonly model: string;
59+
// @internal
60+
static normalizeModelName(modelName: string, backendType: BackendType): string;
61+
}
62+
63+
// @public
64+
export interface AIOptions {
65+
backend: Backend;
66+
}
67+
1268
// @public
1369
export class ArraySchema extends Schema {
1470
constructor(schemaParams: SchemaParams, items: TypedSchema);
@@ -53,7 +109,6 @@ export class BooleanSchema extends Schema {
53109

54110
// @public
55111
export class ChatSession {
56-
// Warning: (ae-forgotten-export) The symbol "ApiSettings" needs to be exported by the entry point index.d.ts
57112
constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
58113
getHistory(): Promise<Content[]>;
59114
// (undocumented)
@@ -251,60 +306,6 @@ export interface FunctionResponsePart {
251306
text?: never;
252307
}
253308

254-
// @public
255-
export interface GenAI {
256-
app: FirebaseApp;
257-
backend: Backend;
258-
// @deprecated
259-
location: string;
260-
}
261-
262-
// @public
263-
export class GenAIError extends FirebaseError {
264-
constructor(code: GenAIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
265-
// (undocumented)
266-
readonly code: GenAIErrorCode;
267-
// (undocumented)
268-
readonly customErrorData?: CustomErrorData | undefined;
269-
}
270-
271-
// @public
272-
const enum GenAIErrorCode {
273-
API_NOT_ENABLED = "api-not-enabled",
274-
ERROR = "error",
275-
FETCH_ERROR = "fetch-error",
276-
INVALID_CONTENT = "invalid-content",
277-
INVALID_SCHEMA = "invalid-schema",
278-
NO_API_KEY = "no-api-key",
279-
NO_APP_ID = "no-app-id",
280-
NO_MODEL = "no-model",
281-
NO_PROJECT_ID = "no-project-id",
282-
PARSE_FAILED = "parse-failed",
283-
REQUEST_ERROR = "request-error",
284-
RESPONSE_ERROR = "response-error",
285-
UNSUPPORTED = "unsupported"
286-
}
287-
288-
export { GenAIErrorCode }
289-
290-
export { GenAIErrorCode as VertexAIErrorCode }
291-
292-
// @public
293-
export abstract class GenAIModel {
294-
// @internal
295-
protected constructor(genAI: GenAI, modelName: string);
296-
// @internal (undocumented)
297-
protected _apiSettings: ApiSettings;
298-
readonly model: string;
299-
// @internal
300-
static normalizeModelName(modelName: string, backendType: BackendType): string;
301-
}
302-
303-
// @public
304-
export interface GenAIOptions {
305-
backend: Backend;
306-
}
307-
308309
// @public
309310
export interface GenerateContentCandidate {
310311
// (undocumented)
@@ -389,8 +390,8 @@ export interface GenerativeContentBlob {
389390
}
390391

391392
// @public
392-
export class GenerativeModel extends GenAIModel {
393-
constructor(genAI: GenAI, modelParams: ModelParams, requestOptions?: RequestOptions);
393+
export class GenerativeModel extends AIModel {
394+
constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions);
394395
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
395396
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
396397
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
@@ -410,13 +411,13 @@ export class GenerativeModel extends GenAIModel {
410411
}
411412

412413
// @public
413-
export function getGenAI(app?: FirebaseApp, options?: GenAIOptions): GenAI;
414+
export function getAI(app?: FirebaseApp, options?: AIOptions): AI;
414415

415416
// @public
416-
export function getGenerativeModel(genAI: GenAI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
417+
export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
417418

418419
// @beta
419-
export function getImagenModel(genAI: GenAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
420+
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
420421

421422
// @public
422423
export function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
@@ -539,8 +540,8 @@ export interface ImagenInlineImage {
539540
}
540541

541542
// @beta
542-
export class ImagenModel extends GenAIModel {
543-
constructor(genAI: GenAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined);
543+
export class ImagenModel extends AIModel {
544+
constructor(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined);
544545
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
545546
// @internal
546547
generateImagesGCS(prompt: string, gcsURI: string): Promise<ImagenGenerationResponse<ImagenGCSImage>>;
@@ -856,7 +857,7 @@ export interface UsageMetadata {
856857
}
857858

858859
// @public
859-
export type VertexAI = GenAI;
860+
export type VertexAI = AI;
860861

861862
// @public
862863
export type VertexAIBackend = {
@@ -868,10 +869,10 @@ export type VertexAIBackend = {
868869
export function vertexAIBackend(location?: string): VertexAIBackend;
869870

870871
// @public
871-
export const VertexAIError: typeof GenAIError;
872+
export const VertexAIError: typeof AIError;
872873

873874
// @public
874-
export const VertexAIModel: typeof GenAIModel;
875+
export const VertexAIModel: typeof AIModel;
875876

876877
// @public
877878
export interface VertexAIOptions {

docs-devsite/_toc.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,14 @@ toc:
472472
- title: vertexai
473473
path: /docs/reference/js/vertexai.md
474474
section:
475+
- title: AI
476+
path: /docs/reference/js/vertexai.ai.md
477+
- title: AIError
478+
path: /docs/reference/js/vertexai.aierror.md
479+
- title: AIModel
480+
path: /docs/reference/js/vertexai.aimodel.md
481+
- title: AIOptions
482+
path: /docs/reference/js/vertexai.aioptions.md
475483
- title: ArraySchema
476484
path: /docs/reference/js/vertexai.arrayschema.md
477485
- title: BaseParams
@@ -516,14 +524,6 @@ toc:
516524
path: /docs/reference/js/vertexai.functionresponse.md
517525
- title: FunctionResponsePart
518526
path: /docs/reference/js/vertexai.functionresponsepart.md
519-
- title: GenAI
520-
path: /docs/reference/js/vertexai.genai.md
521-
- title: GenAIError
522-
path: /docs/reference/js/vertexai.genaierror.md
523-
- title: GenAIModel
524-
path: /docs/reference/js/vertexai.genaimodel.md
525-
- title: GenAIOptions
526-
path: /docs/reference/js/vertexai.genaioptions.md
527527
- title: GenerateContentCandidate
528528
path: /docs/reference/js/vertexai.generatecontentcandidate.md
529529
- title: GenerateContentRequest

docs-devsite/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ https://github.com/firebase/firebase-js-sdk
2727
| [@firebase/performance](./performance.md#performance_package) | The Firebase Performance Monitoring Web SDK. This SDK does not work in a Node.js environment. |
2828
| [@firebase/remote-config](./remote-config.md#remote-config_package) | The Firebase Remote Config Web SDK. This SDK does not work in a Node.js environment. |
2929
| [@firebase/storage](./storage.md#storage_package) | Cloud Storage for Firebase |
30-
| [@firebase/vertexai](./vertexai.md#vertexai_package) | The Vertex AI in Firebase Web SDK. |
30+
| [@firebase/vertexai](./vertexai.md#vertexai_package) | The Firebase AI Web SDK. |
3131

docs-devsite/vertexai.ai.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# AI interface
13+
An instance of the Firebase AI SDK.
14+
15+
Do not create this instance directly. Instead, use [getAI()](./vertexai.md#getai_a94a413)<!-- -->.
16+
17+
<b>Signature:</b>
18+
19+
```typescript
20+
export interface AI
21+
```
22+
23+
## Properties
24+
25+
| Property | Type | Description |
26+
| --- | --- | --- |
27+
| [app](./vertexai.ai.md#aiapp) | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) this [AI](./vertexai.ai.md#ai_interface) instance is associated with. |
28+
| [backend](./vertexai.ai.md#aibackend) | [Backend](./vertexai.md#backend) | A [Backend](./vertexai.md#backend) instance that specifies the backend configuration. |
29+
| [location](./vertexai.ai.md#ailocation) | string | The location configured for this AI service instance, relevant for Vertex AI backends. |
30+
31+
## AI.app
32+
33+
The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) this [AI](./vertexai.ai.md#ai_interface) instance is associated with.
34+
35+
<b>Signature:</b>
36+
37+
```typescript
38+
app: FirebaseApp;
39+
```
40+
41+
## AI.backend
42+
43+
A [Backend](./vertexai.md#backend) instance that specifies the backend configuration.
44+
45+
<b>Signature:</b>
46+
47+
```typescript
48+
backend: Backend;
49+
```
50+
51+
## AI.location
52+
53+
> Warning: This API is now obsolete.
54+
>
55+
> use `AI.backend.location` instead.
56+
>
57+
58+
The location configured for this AI service instance, relevant for Vertex AI backends.
59+
60+
<b>Signature:</b>
61+
62+
```typescript
63+
location: string;
64+
```

docs-devsite/vertexai.genaierror.md renamed to docs-devsite/vertexai.aierror.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,56 @@ overwritten. Changes should be made in the source code at
99
https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

12-
# GenAIError class
13-
Error class for the Vertex AI in Firebase SDK.
12+
# AIError class
13+
Error class for the Firebase AI SDK.
1414

1515
<b>Signature:</b>
1616

1717
```typescript
18-
export declare class GenAIError extends FirebaseError
18+
export declare class AIError extends FirebaseError
1919
```
2020
<b>Extends:</b> [FirebaseError](./util.firebaseerror.md#firebaseerror_class)
2121
2222
## Constructors
2323
2424
| Constructor | Modifiers | Description |
2525
| --- | --- | --- |
26-
| [(constructor)(code, message, customErrorData)](./vertexai.genaierror.md#genaierrorconstructor) | | Constructs a new instance of the <code>GenAIError</code> class. |
26+
| [(constructor)(code, message, customErrorData)](./vertexai.aierror.md#aierrorconstructor) | | Constructs a new instance of the <code>AIError</code> class. |
2727
2828
## Properties
2929
3030
| Property | Modifiers | Type | Description |
3131
| --- | --- | --- | --- |
32-
| [code](./vertexai.genaierror.md#genaierrorcode) | | [GenAIErrorCode](./vertexai.md#genaierrorcode) | |
33-
| [customErrorData](./vertexai.genaierror.md#genaierrorcustomerrordata) | | [CustomErrorData](./vertexai.customerrordata.md#customerrordata_interface) \| undefined | |
32+
| [code](./vertexai.aierror.md#aierrorcode) | | [AIErrorCode](./vertexai.md#aierrorcode) | |
33+
| [customErrorData](./vertexai.aierror.md#aierrorcustomerrordata) | | [CustomErrorData](./vertexai.customerrordata.md#customerrordata_interface) \| undefined | |
3434
35-
## GenAIError.(constructor)
35+
## AIError.(constructor)
3636
37-
Constructs a new instance of the `GenAIError` class.
37+
Constructs a new instance of the `AIError` class.
3838
3939
<b>Signature:</b>
4040
4141
```typescript
42-
constructor(code: GenAIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
42+
constructor(code: AIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
4343
```
4444
4545
#### Parameters
4646
4747
| Parameter | Type | Description |
4848
| --- | --- | --- |
49-
| code | [GenAIErrorCode](./vertexai.md#genaierrorcode) | The error code from [GenAIErrorCode](./vertexai.md#genaierrorcode)<!-- -->. |
49+
| code | [AIErrorCode](./vertexai.md#aierrorcode) | The error code from [AIErrorCode](./vertexai.md#aierrorcode)<!-- -->. |
5050
| message | string | A human-readable message describing the error. |
5151
| customErrorData | [CustomErrorData](./vertexai.customerrordata.md#customerrordata_interface) \| undefined | Optional error data. |
5252
53-
## GenAIError.code
53+
## AIError.code
5454
5555
<b>Signature:</b>
5656
5757
```typescript
58-
readonly code: GenAIErrorCode;
58+
readonly code: AIErrorCode;
5959
```
6060
61-
## GenAIError.customErrorData
61+
## AIError.customErrorData
6262
6363
<b>Signature:</b>
6464

docs-devsite/vertexai.genaimodel.md renamed to docs-devsite/vertexai.aimodel.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ overwritten. Changes should be made in the source code at
99
https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

12-
# GenAIModel class
13-
Base class for Vertex AI in Firebase model APIs.
12+
# AIModel class
13+
Base class for Firebase AI model APIs.
1414

15-
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `GenAIModel` class.
15+
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `AIModel` class.
1616

1717
<b>Signature:</b>
1818

1919
```typescript
20-
export declare abstract class GenAIModel
20+
export declare abstract class AIModel
2121
```
2222

2323
## Properties
2424

2525
| Property | Modifiers | Type | Description |
2626
| --- | --- | --- | --- |
27-
| [model](./vertexai.genaimodel.md#genaimodelmodel) | | string | The fully qualified model resource name to use for generating images (for example, <code>publishers/google/models/imagen-3.0-generate-002</code>). |
27+
| [model](./vertexai.aimodel.md#aimodelmodel) | | string | The fully qualified model resource name to use for generating images (for example, <code>publishers/google/models/imagen-3.0-generate-002</code>). |
2828

29-
## GenAIModel.model
29+
## AIModel.model
3030

3131
The fully qualified model resource name to use for generating images (for example, `publishers/google/models/imagen-3.0-generate-002`<!-- -->).
3232

0 commit comments

Comments
 (0)