Skip to content

Commit c1dbb95

Browse files
committed
Merge branch 'main' into dl/schema-fields
2 parents c5089e2 + 40be2db commit c1dbb95

File tree

98 files changed

+2620
-1518
lines changed

Some content is hidden

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

98 files changed

+2620
-1518
lines changed

.changeset/eighty-starfishes-listen.md

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

.changeset/fast-mangos-chew.md

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

.changeset/ninety-ways-dress.md

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

.changeset/perfect-camels-try.md

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

.changeset/spotty-ghosts-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
Clean up leaked WebChannel instances when the Firestore instance is terminated.

.changeset/tall-zoos-stare.md

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

.changeset/three-singers-wonder.md

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

.changeset/tricky-years-pump.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'firebase': minor
3+
'@firebase/ai': minor
4+
---
5+
6+
Add `title`, `maximum`, `minimum`, `propertyOrdering` to Schema builder

.github/workflows/canary-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
7373
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
7474
NPM_TOKEN_AI: ${{secrets.NPM_TOKEN_AI}}
75+
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
7576
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
7677
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
7778
NPM_TOKEN_APP_COMPAT: ${{ secrets.NPM_TOKEN_APP_COMPAT }}

.github/workflows/prerelease-manual-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
7676
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
7777
NPM_TOKEN_AI: ${{secrets.NPM_TOKEN_AI}}
78+
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
7879
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
7980
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
8081
NPM_TOKEN_APP_COMPAT: ${{ secrets.NPM_TOKEN_APP_COMPAT }}

.github/workflows/release-prod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
8686
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
8787
NPM_TOKEN_AI: ${{secrets.NPM_TOKEN_AI}}
88+
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
8889
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
8990
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
9091
NPM_TOKEN_APP_COMPAT: ${{ secrets.NPM_TOKEN_APP_COMPAT }}

.github/workflows/release-staging.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ on:
3030
options:
3131
- main
3232
- v8
33+
- at-11-7-1
3334
verbose:
3435
description: 'Enable verbose logging'
3536
type: boolean
@@ -111,6 +112,7 @@ jobs:
111112
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
112113
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
113114
NPM_TOKEN_AI: ${{secrets.NPM_TOKEN_AI}}
115+
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
114116
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
115117
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
116118
NPM_TOKEN_APP_COMPAT: ${{ secrets.NPM_TOKEN_APP_COMPAT }}

common/api-review/ai.api.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ export enum HarmBlockThreshold {
518518
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
519519
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
520520
BLOCK_NONE = "BLOCK_NONE",
521-
BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH"
521+
BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
522+
OFF = "OFF"
522523
}
523524

524525
// @public
@@ -834,12 +835,16 @@ export interface SchemaShared<T> {
834835
example?: unknown;
835836
format?: string;
836837
items?: T;
838+
maximum?: number;
837839
maxItems?: number;
840+
minimum?: number;
838841
minItems?: number;
839842
nullable?: boolean;
840843
properties?: {
841844
[k: string]: T;
842845
};
846+
propertyOrdering?: string[];
847+
title?: string;
843848
}
844849

845850
// @public

config/karma.base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const config = {
6868
// test results reporter to use
6969
// possible values: 'dots', 'progress'
7070
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
71-
reporters: ['mocha', 'coverage-istanbul'],
71+
reporters: ['coverage-istanbul', 'mocha'],
7272

7373
// web server port
7474
port: 8089,

docs-devsite/ai.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,13 +448,13 @@ export declare const enum AIErrorCode
448448
| INVALID\_CONTENT | <code>&quot;invalid-content&quot;</code> | An error associated with a Content object. |
449449
| INVALID\_SCHEMA | <code>&quot;invalid-schema&quot;</code> | An error due to invalid Schema input. |
450450
| NO\_API\_KEY | <code>&quot;no-api-key&quot;</code> | An error occurred due to a missing Firebase API key. |
451-
| NO\_APP\_ID | <code>&quot;no-app-id&quot;</code> | An error occured due to a missing Firebase app ID. |
451+
| NO\_APP\_ID | <code>&quot;no-app-id&quot;</code> | An error occurred due to a missing Firebase app ID. |
452452
| NO\_MODEL | <code>&quot;no-model&quot;</code> | An error occurred due to a model name not being specified during initialization. |
453453
| NO\_PROJECT\_ID | <code>&quot;no-project-id&quot;</code> | An error occurred due to a missing project ID. |
454454
| PARSE\_FAILED | <code>&quot;parse-failed&quot;</code> | An error occurred while parsing. |
455455
| REQUEST\_ERROR | <code>&quot;request-error&quot;</code> | An error occurred in a request. |
456456
| RESPONSE\_ERROR | <code>&quot;response-error&quot;</code> | An error occurred in a response. |
457-
| UNSUPPORTED | <code>&quot;unsupported&quot;</code> | An error occured due an attempt to use an unsupported feature. |
457+
| UNSUPPORTED | <code>&quot;unsupported&quot;</code> | An error occurred due an attempt to use an unsupported feature. |
458458

459459
## BlockReason
460460

@@ -551,6 +551,7 @@ export declare enum HarmBlockThreshold
551551
| BLOCK\_MEDIUM\_AND\_ABOVE | <code>&quot;BLOCK_MEDIUM_AND_ABOVE&quot;</code> | Content with <code>NEGLIGIBLE</code> and <code>LOW</code> will be allowed. |
552552
| BLOCK\_NONE | <code>&quot;BLOCK_NONE&quot;</code> | All content will be allowed. |
553553
| BLOCK\_ONLY\_HIGH | <code>&quot;BLOCK_ONLY_HIGH&quot;</code> | Content with <code>NEGLIGIBLE</code>, <code>LOW</code>, and <code>MEDIUM</code> will be allowed. |
554+
| OFF | <code>&quot;OFF&quot;</code> | All content will be allowed. This is the same as <code>BLOCK_NONE</code>, but the metadata corresponding to the [HarmCategory](./ai.md#harmcategory) will not be present in the response. |
554555

555556
## HarmCategory
556557

docs-devsite/ai.schemashared.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ export interface SchemaShared<T>
2727
| [example](./ai.schemashared.md#schemasharedexample) | unknown | Optional. The example of the property. |
2828
| [format](./ai.schemashared.md#schemasharedformat) | string | Optional. The format of the property. When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this must be either <code>'enum'</code> or <code>'date-time'</code>, otherwise requests will fail. |
2929
| [items](./ai.schemashared.md#schemashareditems) | T | Optional. The items of the property. |
30+
| [maximum](./ai.schemashared.md#schemasharedmaximum) | number | The maximum value of a numeric type. |
3031
| [maxItems](./ai.schemashared.md#schemasharedmaxitems) | number | The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
32+
| [minimum](./ai.schemashared.md#schemasharedminimum) | number | The minimum value of a numeric type. |
3133
| [minItems](./ai.schemashared.md#schemasharedminitems) | number | The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
3234
| [nullable](./ai.schemashared.md#schemasharednullable) | boolean | Optional. Whether the property is nullable. |
3335
| [properties](./ai.schemashared.md#schemasharedproperties) | { \[k: string\]: T; } | Optional. Map of <code>Schema</code> objects. |
36+
| [propertyOrdering](./ai.schemashared.md#schemasharedpropertyordering) | string\[\] | A hint suggesting the order in which the keys should appear in the generated JSON string. |
37+
| [title](./ai.schemashared.md#schemasharedtitle) | string | The title of the property. This helps document the schema's purpose but does not typically constrain the generated value. It can subtly guide the model by clarifying the intent of a field. |
3438

3539
## SchemaShared.description
3640

@@ -82,6 +86,16 @@ Optional. The items of the property.
8286
items?: T;
8387
```
8488

89+
## SchemaShared.maximum
90+
91+
The maximum value of a numeric type.
92+
93+
<b>Signature:</b>
94+
95+
```typescript
96+
maximum?: number;
97+
```
98+
8599
## SchemaShared.maxItems
86100

87101
The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
@@ -92,6 +106,16 @@ The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./
92106
maxItems?: number;
93107
```
94108

109+
## SchemaShared.minimum
110+
111+
The minimum value of a numeric type.
112+
113+
<b>Signature:</b>
114+
115+
```typescript
116+
minimum?: number;
117+
```
118+
95119
## SchemaShared.minItems
96120

97121
The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
@@ -123,3 +147,23 @@ properties?: {
123147
[k: string]: T;
124148
};
125149
```
150+
151+
## SchemaShared.propertyOrdering
152+
153+
A hint suggesting the order in which the keys should appear in the generated JSON string.
154+
155+
<b>Signature:</b>
156+
157+
```typescript
158+
propertyOrdering?: string[];
159+
```
160+
161+
## SchemaShared.title
162+
163+
The title of the property. This helps document the schema's purpose but does not typically constrain the generated value. It can subtly guide the model by clarifying the intent of a field.
164+
165+
<b>Signature:</b>
166+
167+
```typescript
168+
title?: string;
169+
```

e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "",
1818
"license": "ISC",
1919
"dependencies": {
20-
"firebase": "11.3.0"
20+
"firebase": "^11.8.0-20250512211235"
2121
},
2222
"devDependencies": {
2323
"@babel/core": "7.26.8",

e2e/sample-apps/modular.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
onValue,
5959
off
6060
} from 'firebase/database';
61-
import { getGenerativeModel, getVertexAI, VertexAI } from 'firebase/vertexai';
61+
import { getGenerativeModel, getAI, VertexAIBackend } from 'firebase/ai';
6262
import { getDataConnect, DataConnect } from 'firebase/data-connect';
6363

6464
/**
@@ -307,15 +307,15 @@ function callPerformance(app) {
307307
}
308308

309309
/**
310-
* VertexAI smoke test.
310+
* AI smoke test.
311311
* Just make sure some functions can be called without obvious errors.
312312
*/
313-
async function callVertexAI(app) {
314-
console.log('[VERTEXAI] start');
315-
const vertexAI = getVertexAI(app);
316-
const model = getGenerativeModel(vertexAI, { model: 'gemini-1.5-flash' });
313+
async function callAI(app) {
314+
console.log('[AI] start');
315+
const ai = getAI(app, { backend: new VertexAIBackend() });
316+
const model = getGenerativeModel(ai, { model: 'gemini-1.5-flash' });
317317
const result = await model.countTokens('abcdefg');
318-
console.log(`[VERTEXAI] counted tokens: ${result.totalTokens}`);
318+
console.log(`[AI] counted tokens: ${result.totalTokens}`);
319319
}
320320

321321
/**
@@ -350,7 +350,7 @@ async function main() {
350350
callAnalytics(app);
351351
callPerformance(app);
352352
await callFunctions(app);
353-
await callVertexAI(app);
353+
await callAI(app);
354354
callDataConnect(app);
355355
await authLogout(app);
356356
console.log('DONE');

e2e/tests/modular.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ import {
8686
StorageReference,
8787
deleteObject
8888
} from 'firebase/storage';
89-
import { getGenerativeModel, getVertexAI, VertexAI } from 'firebase/vertexai';
89+
import {
90+
getGenerativeModel,
91+
getAI,
92+
AI,
93+
VertexAIBackend
94+
} from 'firebase/vertexai';
9095
import { getDataConnect, DataConnect } from 'firebase/data-connect';
9196
import { config, testAccount } from '../firebase-config';
9297
import 'jest';
@@ -307,13 +312,13 @@ describe('MODULAR', () => {
307312
});
308313
});
309314

310-
describe('VERTEXAI', () => {
311-
let vertexAI: VertexAI;
315+
describe('AI', () => {
316+
let ai: AI;
312317
it('getVertexAI()', () => {
313-
vertexAI = getVertexAI(app);
318+
ai = getAI(app, { backend: new VertexAIBackend() });
314319
});
315320
it('getGenerativeModel() and countTokens()', async () => {
316-
const model = getGenerativeModel(vertexAI, { model: 'gemini-1.5-flash' });
321+
const model = getGenerativeModel(ai, { model: 'gemini-1.5-flash' });
317322
expect(model.model).toMatch(/gemini-1.5-flash$/);
318323
const result = await model.countTokens('abcdefg');
319324
expect(result.totalTokens).toBeTruthy;

0 commit comments

Comments
 (0)