Skip to content

Commit 2d3cd31

Browse files
committed
Merge remote-tracking branch 'origin/main' into DbDeletedListener
2 parents 2ff82d8 + b97eab3 commit 2d3cd31

File tree

11 files changed

+59
-14
lines changed

11 files changed

+59
-14
lines changed

.changeset/brave-boats-arrive.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@firebase/remote-config': patch
3+
'@firebase/analytics': patch
4+
'firebase': patch
5+
---
6+
7+
Add rollup config to generate modular typings for google3

.changeset/old-candles-confess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/ai': patch
3+
---
4+
5+
Add deprecation label to `totalBillableCharacters`. `totalTokens` should be used instead.

common/api-review/ai.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export interface CountTokensRequest {
164164
// @public
165165
export interface CountTokensResponse {
166166
promptTokensDetails?: ModalityTokenCount[];
167+
// @deprecated (undocumented)
167168
totalBillableCharacters?: number;
168169
totalTokens: number;
169170
}

docs-devsite/ai.counttokensresponse.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface CountTokensResponse
2323
| Property | Type | Description |
2424
| --- | --- | --- |
2525
| [promptTokensDetails](./ai.counttokensresponse.md#counttokensresponseprompttokensdetails) | [ModalityTokenCount](./ai.modalitytokencount.md#modalitytokencount_interface)<!-- -->\[\] | The breakdown, by modality, of how many tokens are consumed by the prompt. |
26-
| [totalBillableCharacters](./ai.counttokensresponse.md#counttokensresponsetotalbillablecharacters) | number | The total number of billable characters counted across all instances from the request.<!-- -->This property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)<!-- -->). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this property is not supported and will default to 0. |
26+
| [totalBillableCharacters](./ai.counttokensresponse.md#counttokensresponsetotalbillablecharacters) | number | |
2727
| [totalTokens](./ai.counttokensresponse.md#counttokensresponsetotaltokens) | number | The total number of tokens counted across all instances from the request. |
2828

2929
## CountTokensResponse.promptTokensDetails
@@ -38,9 +38,12 @@ promptTokensDetails?: ModalityTokenCount[];
3838

3939
## CountTokensResponse.totalBillableCharacters
4040

41-
The total number of billable characters counted across all instances from the request.
42-
43-
This property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)<!-- -->). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this property is not supported and will default to 0.
41+
> Warning: This API is now obsolete.
42+
>
43+
> Use `totalTokens` instead. This property is undefined when using models greater than `gemini-1.5-*`<!-- -->.
44+
>
45+
> The total number of billable characters counted across all instances from the request.
46+
>
4447

4548
<b>Signature:</b>
4649

packages/ai/src/requests/stream-reader.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ describe('processStream', () => {
102102
expect(response.text()).to.not.be.empty;
103103
}
104104
const aggregatedResponse = await result.response;
105-
expect(aggregatedResponse.text()).to.include('**Cats:**');
106-
expect(aggregatedResponse.text()).to.include('to their owners.');
105+
expect(aggregatedResponse.text()).to.include('Okay');
106+
expect(aggregatedResponse.text()).to.include('brewing delicious coffee');
107107
});
108108
it('streaming response - long - big chunk', async () => {
109109
const fakeResponse = getMockResponseStreaming(
@@ -116,8 +116,8 @@ describe('processStream', () => {
116116
expect(response.text()).to.not.be.empty;
117117
}
118118
const aggregatedResponse = await result.response;
119-
expect(aggregatedResponse.text()).to.include('**Cats:**');
120-
expect(aggregatedResponse.text()).to.include('to their owners.');
119+
expect(aggregatedResponse.text()).to.include('Okay');
120+
expect(aggregatedResponse.text()).to.include('brewing delicious coffee');
121121
});
122122
it('streaming response - utf8', async () => {
123123
const fakeResponse = getMockResponseStreaming(

packages/ai/src/types/responses.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,10 @@ export interface CountTokensResponse {
270270
*/
271271
totalTokens: number;
272272
/**
273+
* @deprecated Use `totalTokens` instead. This property is undefined when using models greater than `gemini-1.5-*`.
274+
*
273275
* The total number of billable characters counted across all instances
274276
* from the request.
275-
*
276-
* This property is only supported when using the Vertex AI Gemini API ({@link VertexAIBackend}).
277-
* When using the Gemini Developer API ({@link GoogleAIBackend}), this property is not supported and will default to 0.
278277
*/
279278
totalBillableCharacters?: number;
280279
/**

packages/analytics/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"devDependencies": {
5050
"@firebase/app": "0.13.1",
5151
"rollup": "2.79.2",
52+
"rollup-plugin-dts": "5.3.1",
5253
"@rollup/plugin-commonjs": "21.1.0",
5354
"@rollup/plugin-json": "6.1.0",
5455
"@rollup/plugin-node-resolve": "16.0.0",

packages/analytics/rollup.config.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import json from '@rollup/plugin-json';
1919
import typescriptPlugin from 'rollup-plugin-typescript2';
2020
import replace from 'rollup-plugin-replace';
2121
import typescript from 'typescript';
22+
import dts from 'rollup-plugin-dts';
2223
import { generateBuildTargetReplaceConfig } from '../../scripts/build/rollup_replace_build_target';
2324
import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file';
2425
import pkg from './package.json';
@@ -77,4 +78,17 @@ const cjsBuilds = [
7778
}
7879
];
7980

80-
export default [...esmBuilds, ...cjsBuilds];
81+
const google3TypingsBuild = {
82+
input: 'dist/src/index.d.ts',
83+
output: {
84+
file: 'dist/src/global_index.d.ts',
85+
format: 'es'
86+
},
87+
plugins: [
88+
dts({
89+
respectExternal: true
90+
})
91+
]
92+
};
93+
94+
export default [...esmBuilds, ...cjsBuilds, google3TypingsBuild];

packages/remote-config/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"devDependencies": {
5151
"@firebase/app": "0.13.1",
5252
"rollup": "2.79.2",
53+
"rollup-plugin-dts": "5.3.1",
5354
"rollup-plugin-typescript2": "0.36.0",
5455
"typescript": "5.5.4"
5556
},

packages/remote-config/rollup.config.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import json from '@rollup/plugin-json'; // Enables package.json import in TypeSc
1919
import typescriptPlugin from 'rollup-plugin-typescript2';
2020
import replace from 'rollup-plugin-replace';
2121
import typescript from 'typescript';
22+
import dts from 'rollup-plugin-dts';
2223
import { generateBuildTargetReplaceConfig } from '../../scripts/build/rollup_replace_build_target';
2324
import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file';
2425
import pkg from './package.json';
@@ -70,4 +71,17 @@ const cjsBuild = {
7071
]
7172
};
7273

73-
export default [esmBuild, cjsBuild];
74+
const google3TypingsBuild = {
75+
input: 'dist/src/index.d.ts',
76+
output: {
77+
file: 'dist/src/global_index.d.ts',
78+
format: 'es'
79+
},
80+
plugins: [
81+
dts({
82+
respectExternal: true
83+
})
84+
]
85+
};
86+
87+
export default [esmBuild, cjsBuild, google3TypingsBuild];

0 commit comments

Comments
 (0)