Skip to content

Commit 8f65c98

Browse files
committed
Merge branch 'main' into dl/vertex-integration
2 parents 62dab2b + 35ad526 commit 8f65c98

File tree

82 files changed

+571
-309
lines changed

Some content is hidden

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

82 files changed

+571
-309
lines changed

.changeset/dirty-crews-cross.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@firebase/auth": patch
3+
"@firebase/database": patch
4+
"@firebase/firestore": patch
5+
"@firebase/functions": patch
6+
"@firebase/storage": patch
7+
---
8+
9+
Revert "Fixed scroll behavior (#9043)"

.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/tall-zoos-stare.md

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

.vscode/launch.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "node",
1010
"request": "launch",
1111
"program": "${workspaceFolder}/node_modules/.bin/_mocha",
12-
"cwd": "${workspaceRoot}/packages/vertexai",
12+
"cwd": "${workspaceRoot}/packages/ai",
1313
"args": [
1414
"--require",
1515
"ts-node/register",
@@ -24,6 +24,26 @@
2424
},
2525
"sourceMaps": true
2626
},
27+
{
28+
"name": "AI Integration Tests (node)",
29+
"type": "node",
30+
"request": "launch",
31+
"program": "${workspaceFolder}/node_modules/.bin/_mocha",
32+
"cwd": "${workspaceRoot}/packages/ai",
33+
"args": [
34+
"--require",
35+
"ts-node/register",
36+
"--require",
37+
"src/index.node.ts",
38+
"--timeout",
39+
"5000",
40+
"integration/**/*.test.ts"
41+
],
42+
"env": {
43+
"TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}"
44+
},
45+
"sourceMaps": true
46+
},
2747
{
2848
"type": "node",
2949
"request": "launch",

integration/compat-interop/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
"test:debug": "karma start --browsers Chrome --auto-watch"
99
},
1010
"dependencies": {
11-
"@firebase/app": "0.12.3",
12-
"@firebase/app-compat": "0.3.3",
13-
"@firebase/analytics": "0.10.15",
14-
"@firebase/analytics-compat": "0.2.21",
15-
"@firebase/auth": "1.10.4",
16-
"@firebase/auth-compat": "0.5.24",
17-
"@firebase/functions": "0.12.6",
18-
"@firebase/functions-compat": "0.3.23",
19-
"@firebase/messaging": "0.12.20",
20-
"@firebase/messaging-compat": "0.2.20",
21-
"@firebase/performance": "0.7.5",
22-
"@firebase/performance-compat": "0.2.18",
23-
"@firebase/remote-config": "0.6.3",
24-
"@firebase/remote-config-compat": "0.2.16"
11+
"@firebase/app": "0.13.0",
12+
"@firebase/app-compat": "0.4.0",
13+
"@firebase/analytics": "0.10.16",
14+
"@firebase/analytics-compat": "0.2.22",
15+
"@firebase/auth": "1.10.5",
16+
"@firebase/auth-compat": "0.5.25",
17+
"@firebase/functions": "0.12.7",
18+
"@firebase/functions-compat": "0.3.24",
19+
"@firebase/messaging": "0.12.21",
20+
"@firebase/messaging-compat": "0.2.21",
21+
"@firebase/performance": "0.7.6",
22+
"@firebase/performance-compat": "0.2.19",
23+
"@firebase/remote-config": "0.6.4",
24+
"@firebase/remote-config-compat": "0.2.17"
2525
},
2626
"devDependencies": {
2727
"typescript": "5.5.4"

integration/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"test:memory:debug": "yarn build:memory; karma start --auto-watch --browsers Chrome"
1515
},
1616
"dependencies": {
17-
"@firebase/app": "0.12.3",
18-
"@firebase/firestore": "4.7.14"
17+
"@firebase/app": "0.13.0",
18+
"@firebase/firestore": "4.7.15"
1919
},
2020
"devDependencies": {
2121
"@types/mocha": "9.1.1",

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test:manual": "mocha --exit"
1010
},
1111
"devDependencies": {
12-
"firebase": "11.7.3",
12+
"firebase": "11.8.0",
1313
"chai": "4.5.0",
1414
"chromedriver": "119.0.1",
1515
"express": "4.21.2",

packages/ai/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# @firebase/ai
22

3+
## 1.3.0
4+
5+
### Minor Changes
6+
7+
- [`e99683b`](https://github.com/firebase/firebase-js-sdk/commit/e99683b17cf75c581bd362a1d7cb85f0b9c110ba) [#8922](https://github.com/firebase/firebase-js-sdk/pull/8922) - Add support for Gemini multimodal output
8+
9+
- [`d5082f9`](https://github.com/firebase/firebase-js-sdk/commit/d5082f9f2fc4de98a6bfd1c6a5af4571af4d0bc6) [#8931](https://github.com/firebase/firebase-js-sdk/pull/8931) - Add support for the Gemini Developer API, enabling usage in a free tier, and add new `AI` API to accomodate new product naming.
10+
11+
### Patch Changes
12+
13+
- [`050c1b6`](https://github.com/firebase/firebase-js-sdk/commit/050c1b6a099b87be1488b9207e4fad4da9f8f64b) [#8972](https://github.com/firebase/firebase-js-sdk/pull/8972) - Pass `GenerativeModel`'s `BaseParams` to created chat sessions. This fixes an issue where `GenerationConfig` would not be inherited from `ChatSession`.
14+
15+
- Updated dependencies [[`8a03143`](https://github.com/firebase/firebase-js-sdk/commit/8a03143b9217effdd86d68bdf195493c0979aa27)]:
16+
- @firebase/util@1.12.0
17+
- @firebase/component@0.6.17
18+
319
## 1.2.4
420

521
### Patch Changes

packages/ai/integration/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import { initializeApp } from '@firebase/app';
19-
import { AI, Backend, BackendType, VertexAIBackend, getAI } from '../src';
19+
import { AI, Backend, BackendType, GoogleAIBackend, VertexAIBackend, getAI } from '../src';
2020
import { FIREBASE_CONFIG } from './firebase-config';
2121

2222
const app = initializeApp(FIREBASE_CONFIG);
@@ -36,7 +36,7 @@ function formatConfigAsString(config: { ai: AI; model: string }): string {
3636
}
3737

3838
const backends: readonly Backend[] = [
39-
// new GoogleAIBackend(), TODO: activate once live
39+
new GoogleAIBackend(),
4040
new VertexAIBackend()
4141
];
4242

packages/ai/integration/count-tokens.test.ts

Lines changed: 40 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import {
2828
Part,
2929
CountTokensRequest,
3030
InlineDataPart,
31-
FileDataPart
31+
FileDataPart,
32+
BackendType
3233
} from '../src';
3334
import {
3435
AUDIO_MIME_TYPE,
@@ -87,14 +88,21 @@ describe('Count Tokens', () => {
8788

8889
const response = await model.countTokens('Why is the sky blue?');
8990

90-
expect(response.totalTokens).to.equal(6);
91-
expect(response.totalBillableCharacters).to.equal(16);
9291
expect(response.promptTokensDetails).to.not.be.null;
9392
expect(response.promptTokensDetails!.length).to.equal(1);
9493
expect(response.promptTokensDetails![0].modality).to.equal(
9594
Modality.TEXT
9695
);
97-
expect(response.promptTokensDetails![0].tokenCount).to.equal(6);
96+
97+
if (testConfig.ai.backend.backendType === BackendType.GOOGLE_AI) {
98+
expect(response.totalTokens).to.equal(7);
99+
expect(response.totalBillableCharacters).to.be.undefined;
100+
expect(response.promptTokensDetails![0].tokenCount).to.equal(7);
101+
} else if (testConfig.ai.backend.backendType === BackendType.VERTEX_AI) {
102+
expect(response.totalTokens).to.equal(6);
103+
expect(response.totalBillableCharacters).to.equal(16);
104+
expect(response.promptTokensDetails![0].tokenCount).to.equal(6);
105+
}
98106
});
99107

100108
it('image input', async () => {
@@ -108,28 +116,25 @@ describe('Count Tokens', () => {
108116
}
109117
};
110118
const response = await model.countTokens([imagePart]);
111-
112-
const expectedImageTokens = 258;
113-
expect(
114-
response.totalTokens,
115-
'totalTokens should have correct token count'
116-
).to.equal(expectedImageTokens);
117-
expect(
118-
response.totalBillableCharacters,
119-
'totalBillableCharacters should be undefined'
120-
).to.be.undefined; // Incorrect behavior
121-
expect(
122-
response.promptTokensDetails!.length,
123-
'promptTokensDetails should have one entry'
124-
).to.equal(1);
125-
expect(
126-
response.promptTokensDetails![0].modality,
127-
'modality should be IMAGE'
128-
).to.equal(Modality.IMAGE);
129-
expect(
130-
response.promptTokensDetails![0].tokenCount,
131-
'promptTokenDetails tokenCount should be correct'
132-
).to.equal(expectedImageTokens);
119+
console.log(JSON.stringify(response));
120+
121+
if (testConfig.ai.backend.backendType === BackendType.GOOGLE_AI) {
122+
const expectedImageTokens = 259;
123+
124+
} else if (testConfig.ai.backend.backendType === BackendType.VERTEX_AI) {
125+
const expectedImageTokens = 258;
126+
expect(response.totalTokens).to.equal(expectedImageTokens);
127+
expect(
128+
response.totalBillableCharacters,
129+
).to.be.undefined; // Incorrect behavior
130+
expect(
131+
response.promptTokensDetails!.length,
132+
).to.equal(1);
133+
expect(
134+
response.promptTokensDetails![0].modality,
135+
).to.equal(Modality.IMAGE);
136+
expect(response.promptTokensDetails![0].tokenCount).to.equal(expectedImageTokens);
137+
}
133138
});
134139

135140
it('audio input', async () => {
@@ -144,25 +149,19 @@ describe('Count Tokens', () => {
144149
};
145150

146151
const response = await model.countTokens([audioPart]);
152+
console.log(JSON.stringify(response));
147153
// This may be different on Google AI
148-
expect(response.totalTokens, 'totalTokens is expected to be undefined')
149-
.to.be.undefined;
154+
expect(response.totalTokens).to.be.undefined;
150155
expect(
151156
response.totalBillableCharacters,
152-
'totalBillableCharacters should be undefined'
153157
).to.be.undefined; // Incorrect behavior
154158
expect(
155159
response.promptTokensDetails!.length,
156-
'promptTokensDetails should have one entry'
157160
).to.equal(1);
158161
expect(
159162
response.promptTokensDetails![0].modality,
160-
'modality should be AUDIO'
161163
).to.equal(Modality.AUDIO);
162-
expect(
163-
response.promptTokensDetails![0].tokenCount,
164-
'promptTokenDetails tokenCount is expected to be undefined'
165-
).to.be.undefined;
164+
expect(response.promptTokensDetails![0].tokenCount).to.be.undefined;
166165
});
167166

168167
it('text, image, and audio input', async () => {
@@ -181,20 +180,14 @@ describe('Count Tokens', () => {
181180
contents: [{ role: 'user', parts: [textPart, imagePart, audioPart] }]
182181
};
183182
const response = await model.countTokens(request);
183+
console.log(JSON.stringify(response));
184184

185-
expect(
186-
response.totalTokens,
187-
'totalTokens should have correct token count'
188-
).to.equal(261);
185+
expect(response.totalTokens).to.equal(261);
189186
expect(
190187
response.totalBillableCharacters,
191-
'totalBillableCharacters should have correct count'
192188
).to.equal('Describe these:'.length - 1); // For some reason it's the length-1
193189

194-
expect(
195-
response.promptTokensDetails!.length,
196-
'promptTokensDetails should have three entries'
197-
).to.equal(3);
190+
expect(response.promptTokensDetails!.length).to.equal(3);
198191

199192
const textDetails = response.promptTokensDetails!.find(
200193
d => d.modality === Modality.TEXT
@@ -228,16 +221,11 @@ describe('Count Tokens', () => {
228221
}
229222
};
230223
const response = await model.countTokens([filePart]);
224+
console.log(JSON.stringify(response));
231225

232226
const expectedFileTokens = 258;
233-
expect(
234-
response.totalTokens,
235-
'totalTokens should have correct token count'
236-
).to.equal(expectedFileTokens);
237-
expect(
238-
response.totalBillableCharacters,
239-
'totalBillableCharacters should be undefined'
240-
).to.be.undefined;
227+
expect(response.totalTokens).to.equal(expectedFileTokens);
228+
expect(response.totalBillableCharacters).to.be.undefined;
241229
expect(response.promptTokensDetails).to.not.be.null;
242230
expect(response.promptTokensDetails!.length).to.equal(1);
243231
expect(response.promptTokensDetails![0].modality).to.equal(

packages/ai/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/ai",
3-
"version": "1.2.4",
3+
"version": "1.3.0",
44
"description": "The Firebase AI SDK",
55
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
66
"engines": {
@@ -50,14 +50,14 @@
5050
},
5151
"dependencies": {
5252
"@firebase/app-check-interop-types": "0.3.3",
53-
"@firebase/component": "0.6.16",
53+
"@firebase/component": "0.6.17",
5454
"@firebase/logger": "0.4.4",
55-
"@firebase/util": "1.11.3",
55+
"@firebase/util": "1.12.0",
5656
"tslib": "^2.1.0"
5757
},
5858
"license": "Apache-2.0",
5959
"devDependencies": {
60-
"@firebase/app": "0.12.3",
60+
"@firebase/app": "0.13.0",
6161
"@rollup/plugin-json": "6.1.0",
6262
"rollup": "2.79.2",
6363
"rollup-plugin-replace": "2.2.0",

packages/analytics-compat/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @firebase/analytics-compat
22

3+
## 0.2.22
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`8a03143`](https://github.com/firebase/firebase-js-sdk/commit/8a03143b9217effdd86d68bdf195493c0979aa27)]:
8+
- @firebase/util@1.12.0
9+
- @firebase/analytics@0.10.16
10+
- @firebase/component@0.6.17
11+
312
## 0.2.21
413

514
### Patch Changes

0 commit comments

Comments
 (0)