Skip to content

Commit 70804ee

Browse files
committed
Merge branch 'main' into mila/fix-string-utf8-comparison
2 parents a3aea95 + 777f465 commit 70804ee

File tree

125 files changed

+4308
-563
lines changed

Some content is hidden

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

125 files changed

+4308
-563
lines changed

.changeset/chilled-tips-judge.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/vertexai': minor
3+
'firebase': minor
4+
---
5+
6+
Added support for modality-based token count.

.changeset/flat-plums-hope.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/remote-config': minor
3+
'firebase': minor
4+
---
5+
6+
Adds support for initial state hydration (from SSR contexts)

.changeset/forty-bags-arrive.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@firebase/database-compat': patch
3+
'@firebase/database': patch
4+
'firebase': patch
5+
---
6+
7+
Fixed: invoking `connectDatabaseEmulator` multiple times with the same parameters will no longer
8+
cause an error. Fixes [GitHub Issue #6824](https://github.com/firebase/firebase-js-sdk/issues/6824).

.changeset/lemon-candles-vanish.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@firebase/auth': patch
3+
'firebase': patch
4+
---
5+
6+
Fixed: invoking `connectAuthEmulator` multiple times with the same parameters will no longer cause
7+
an error. Fixes [GitHub Issue #6824](https://github.com/firebase/firebase-js-sdk/issues/6824).
8+

.changeset/seven-oranges-care.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/vertexai': patch
3+
---
4+
5+
Filter out empty text parts from streaming responses.

.changeset/stale-llamas-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/vertexai': patch
3+
---
4+
5+
Create Node CJS and ESM bundles.

.changeset/tame-parrots-tie.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/util': minor
3+
'firebase': minor
4+
---
5+
6+
Add support for the `FIREBASE_WEBAPP_CONFIG` environment variable at install time.

.changeset/tough-kiwis-smile.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app-check': patch
3+
---
4+
5+
Fixed a bug that caused an error to be thrown when the debug exchange failed.

.changeset/violet-planets-impress.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/vertexai': minor
4+
---
5+
6+
**Public Preview** Added support for generating images using the Imagen 3 model.

common/api-review/firestore-lite.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,4 +494,5 @@ export class WriteBatch {
494494
// @public
495495
export function writeBatch(firestore: Firestore): WriteBatch;
496496

497+
497498
```

common/api-review/remote-config.api.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,22 @@ export function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean>;
2424
// @public
2525
export function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;
2626

27+
// @public
28+
export interface FetchResponse {
29+
config?: FirebaseRemoteConfigObject;
30+
eTag?: string;
31+
status: number;
32+
}
33+
2734
// @public
2835
export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
2936

37+
// @public
38+
export interface FirebaseRemoteConfigObject {
39+
// (undocumented)
40+
[key: string]: string;
41+
}
42+
3043
// @public
3144
export function getAll(remoteConfig: RemoteConfig): Record<string, Value>;
3245

@@ -37,7 +50,7 @@ export function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;
3750
export function getNumber(remoteConfig: RemoteConfig, key: string): number;
3851

3952
// @public (undocumented)
40-
export function getRemoteConfig(app?: FirebaseApp): RemoteConfig;
53+
export function getRemoteConfig(app?: FirebaseApp, options?: RemoteConfigOptions): RemoteConfig;
4154

4255
// @public
4356
export function getString(remoteConfig: RemoteConfig, key: string): string;
@@ -62,6 +75,12 @@ export interface RemoteConfig {
6275
settings: RemoteConfigSettings;
6376
}
6477

78+
// @public
79+
export interface RemoteConfigOptions {
80+
initialFetchResponse?: FetchResponse;
81+
templateId?: string;
82+
}
83+
6584
// @public
6685
export interface RemoteConfigSettings {
6786
fetchTimeoutMillis: number;

common/api-review/vertexai.api.md

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export interface CountTokensRequest {
9292

9393
// @public
9494
export interface CountTokensResponse {
95+
promptTokensDetails?: ModalityTokenCount[];
9596
totalBillableCharacters?: number;
9697
totalTokens: number;
9798
}
@@ -323,16 +324,14 @@ export interface GenerativeContentBlob {
323324
}
324325

325326
// @public
326-
export class GenerativeModel {
327+
export class GenerativeModel extends VertexAIModel {
327328
constructor(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions);
328329
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
329330
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
330331
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
331332
// (undocumented)
332333
generationConfig: GenerationConfig;
333334
// (undocumented)
334-
model: string;
335-
// (undocumented)
336335
requestOptions?: RequestOptions;
337336
// (undocumented)
338337
safetySettings: SafetySetting[];
@@ -348,6 +347,9 @@ export class GenerativeModel {
348347
// @public
349348
export function getGenerativeModel(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
350349

350+
// @beta
351+
export function getImagenModel(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
352+
351353
// @public
352354
export function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
353355

@@ -429,6 +431,90 @@ export enum HarmSeverity {
429431
HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE"
430432
}
431433

434+
// @beta
435+
export enum ImagenAspectRatio {
436+
LANDSCAPE_16x9 = "16:9",
437+
LANDSCAPE_3x4 = "3:4",
438+
PORTRAIT_4x3 = "4:3",
439+
PORTRAIT_9x16 = "9:16",
440+
SQUARE = "1:1"
441+
}
442+
443+
// @public
444+
export interface ImagenGCSImage {
445+
gcsURI: string;
446+
mimeType: string;
447+
}
448+
449+
// @beta
450+
export interface ImagenGenerationConfig {
451+
addWatermark?: boolean;
452+
aspectRatio?: ImagenAspectRatio;
453+
imageFormat?: ImagenImageFormat;
454+
negativePrompt?: string;
455+
numberOfImages?: number;
456+
}
457+
458+
// @beta
459+
export interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
460+
filteredReason?: string;
461+
images: T[];
462+
}
463+
464+
// @beta
465+
export class ImagenImageFormat {
466+
compressionQuality?: number;
467+
static jpeg(compressionQuality?: number): ImagenImageFormat;
468+
mimeType: string;
469+
static png(): ImagenImageFormat;
470+
}
471+
472+
// @beta
473+
export interface ImagenInlineImage {
474+
bytesBase64Encoded: string;
475+
mimeType: string;
476+
}
477+
478+
// @beta
479+
export class ImagenModel extends VertexAIModel {
480+
constructor(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined);
481+
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
482+
// @internal
483+
generateImagesGCS(prompt: string, gcsURI: string): Promise<ImagenGenerationResponse<ImagenGCSImage>>;
484+
generationConfig?: ImagenGenerationConfig;
485+
// (undocumented)
486+
requestOptions?: RequestOptions | undefined;
487+
safetySettings?: ImagenSafetySettings;
488+
}
489+
490+
// @beta
491+
export interface ImagenModelParams {
492+
generationConfig?: ImagenGenerationConfig;
493+
model: string;
494+
safetySettings?: ImagenSafetySettings;
495+
}
496+
497+
// @beta
498+
export enum ImagenPersonFilterLevel {
499+
ALLOW_ADULT = "allow_adult",
500+
ALLOW_ALL = "allow_all",
501+
BLOCK_ALL = "dont_allow"
502+
}
503+
504+
// @beta
505+
export enum ImagenSafetyFilterLevel {
506+
BLOCK_LOW_AND_ABOVE = "block_low_and_above",
507+
BLOCK_MEDIUM_AND_ABOVE = "block_medium_and_above",
508+
BLOCK_NONE = "block_none",
509+
BLOCK_ONLY_HIGH = "block_only_high"
510+
}
511+
512+
// @beta
513+
export interface ImagenSafetySettings {
514+
personFilterLevel?: ImagenPersonFilterLevel;
515+
safetyFilterLevel?: ImagenSafetyFilterLevel;
516+
}
517+
432518
// @public
433519
export interface InlineDataPart {
434520
// (undocumented)
@@ -447,6 +533,22 @@ export class IntegerSchema extends Schema {
447533
constructor(schemaParams?: SchemaParams);
448534
}
449535

536+
// @public
537+
export enum Modality {
538+
AUDIO = "AUDIO",
539+
DOCUMENT = "DOCUMENT",
540+
IMAGE = "IMAGE",
541+
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
542+
TEXT = "TEXT",
543+
VIDEO = "VIDEO"
544+
}
545+
546+
// @public
547+
export interface ModalityTokenCount {
548+
modality: Modality;
549+
tokenCount: number;
550+
}
551+
450552
// @public
451553
export interface ModelParams extends BaseParams {
452554
// (undocumented)
@@ -682,8 +784,12 @@ export interface UsageMetadata {
682784
// (undocumented)
683785
candidatesTokenCount: number;
684786
// (undocumented)
787+
candidatesTokensDetails?: ModalityTokenCount[];
788+
// (undocumented)
685789
promptTokenCount: number;
686790
// (undocumented)
791+
promptTokensDetails?: ModalityTokenCount[];
792+
// (undocumented)
687793
totalTokenCount: number;
688794
}
689795

@@ -718,6 +824,16 @@ export const enum VertexAIErrorCode {
718824
RESPONSE_ERROR = "response-error"
719825
}
720826

827+
// @public
828+
export abstract class VertexAIModel {
829+
// @internal
830+
protected constructor(vertexAI: VertexAI, modelName: string);
831+
// @internal (undocumented)
832+
protected _apiSettings: ApiSettings;
833+
readonly model: string;
834+
static normalizeModelName(modelName: string): string;
835+
}
836+
721837
// @public
722838
export interface VertexAIOptions {
723839
// (undocumented)

docs-devsite/_toc.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,14 @@ toc:
430430
section:
431431
- title: CustomSignals
432432
path: /docs/reference/js/remote-config.customsignals.md
433+
- title: FetchResponse
434+
path: /docs/reference/js/remote-config.fetchresponse.md
435+
- title: FirebaseRemoteConfigObject
436+
path: /docs/reference/js/remote-config.firebaseremoteconfigobject.md
433437
- title: RemoteConfig
434438
path: /docs/reference/js/remote-config.remoteconfig.md
439+
- title: RemoteConfigOptions
440+
path: /docs/reference/js/remote-config.remoteconfigoptions.md
435441
- title: RemoteConfigSettings
436442
path: /docs/reference/js/remote-config.remoteconfigsettings.md
437443
- title: Value
@@ -530,10 +536,28 @@ toc:
530536
path: /docs/reference/js/vertexai.groundingattribution.md
531537
- title: GroundingMetadata
532538
path: /docs/reference/js/vertexai.groundingmetadata.md
539+
- title: ImagenGCSImage
540+
path: /docs/reference/js/vertexai.imagengcsimage.md
541+
- title: ImagenGenerationConfig
542+
path: /docs/reference/js/vertexai.imagengenerationconfig.md
543+
- title: ImagenGenerationResponse
544+
path: /docs/reference/js/vertexai.imagengenerationresponse.md
545+
- title: ImagenImageFormat
546+
path: /docs/reference/js/vertexai.imagenimageformat.md
547+
- title: ImagenInlineImage
548+
path: /docs/reference/js/vertexai.imageninlineimage.md
549+
- title: ImagenModel
550+
path: /docs/reference/js/vertexai.imagenmodel.md
551+
- title: ImagenModelParams
552+
path: /docs/reference/js/vertexai.imagenmodelparams.md
553+
- title: ImagenSafetySettings
554+
path: /docs/reference/js/vertexai.imagensafetysettings.md
533555
- title: InlineDataPart
534556
path: /docs/reference/js/vertexai.inlinedatapart.md
535557
- title: IntegerSchema
536558
path: /docs/reference/js/vertexai.integerschema.md
559+
- title: ModalityTokenCount
560+
path: /docs/reference/js/vertexai.modalitytokencount.md
537561
- title: ModelParams
538562
path: /docs/reference/js/vertexai.modelparams.md
539563
- title: NumberSchema
@@ -578,6 +602,8 @@ toc:
578602
path: /docs/reference/js/vertexai.vertexai.md
579603
- title: VertexAIError
580604
path: /docs/reference/js/vertexai.vertexaierror.md
605+
- title: VertexAIModel
606+
path: /docs/reference/js/vertexai.vertexaimodel.md
581607
- title: VertexAIOptions
582608
path: /docs/reference/js/vertexai.vertexaioptions.md
583609
- title: VideoMetadata

docs-devsite/firestore_.index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export declare interface Index
3030

3131
| Property | Type | Description |
3232
| --- | --- | --- |
33-
| [collectionGroup](./firestore_.index.md#indexcollectiongroup) | string | <b><i>(BETA)</i></b> The ID of the collection to index. |
34-
| [fields](./firestore_.index.md#indexfields) | [IndexField](./firestore_.indexfield.md#indexfield_interface)<!-- -->\[\] | <b><i>(BETA)</i></b> A list of fields to index. |
33+
| [collectionGroup](./firestore_.index.md#indexcollectiongroup) | string | <b><i>(Public Preview)</i></b> The ID of the collection to index. |
34+
| [fields](./firestore_.index.md#indexfields) | [IndexField](./firestore_.indexfield.md#indexfield_interface)<!-- -->\[\] | <b><i>(Public Preview)</i></b> A list of fields to index. |
3535

3636
## Index.collectionGroup
3737

docs-devsite/firestore_.indexconfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export declare interface IndexConfiguration
3232

3333
| Property | Type | Description |
3434
| --- | --- | --- |
35-
| [indexes](./firestore_.indexconfiguration.md#indexconfigurationindexes) | [Index](./firestore_.index.md#index_interface)<!-- -->\[\] | <b><i>(BETA)</i></b> A list of all Firestore indexes. |
35+
| [indexes](./firestore_.indexconfiguration.md#indexconfigurationindexes) | [Index](./firestore_.index.md#index_interface)<!-- -->\[\] | <b><i>(Public Preview)</i></b> A list of all Firestore indexes. |
3636

3737
## IndexConfiguration.indexes
3838

docs-devsite/firestore_.indexfield.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export declare interface IndexField
3030

3131
| Property | Type | Description |
3232
| --- | --- | --- |
33-
| [arrayConfig](./firestore_.indexfield.md#indexfieldarrayconfig) | 'CONTAINS' | <b><i>(BETA)</i></b> What type of array index to create. Set to <code>CONTAINS</code> for <code>array-contains</code> and <code>array-contains-any</code> indexes.<!-- -->Only one of <code>arrayConfig</code> or <code>order</code> should be set; |
34-
| [fieldPath](./firestore_.indexfield.md#indexfieldfieldpath) | string | <b><i>(BETA)</i></b> The field path to index. |
35-
| [order](./firestore_.indexfield.md#indexfieldorder) | 'ASCENDING' \| 'DESCENDING' | <b><i>(BETA)</i></b> What type of array index to create. Set to <code>ASCENDING</code> or 'DESCENDING<code> for </code>==<code>, </code>!=<code>, </code>&lt;<!-- -->=<code>, </code>&lt;<!-- -->=<code>, </code>in<code> and </code>not-in<!-- -->\` filters.<!-- -->Only one of <code>arrayConfig</code> or <code>order</code> should be set. |
33+
| [arrayConfig](./firestore_.indexfield.md#indexfieldarrayconfig) | 'CONTAINS' | <b><i>(Public Preview)</i></b> What type of array index to create. Set to <code>CONTAINS</code> for <code>array-contains</code> and <code>array-contains-any</code> indexes.<!-- -->Only one of <code>arrayConfig</code> or <code>order</code> should be set; |
34+
| [fieldPath](./firestore_.indexfield.md#indexfieldfieldpath) | string | <b><i>(Public Preview)</i></b> The field path to index. |
35+
| [order](./firestore_.indexfield.md#indexfieldorder) | 'ASCENDING' \| 'DESCENDING' | <b><i>(Public Preview)</i></b> What type of array index to create. Set to <code>ASCENDING</code> or 'DESCENDING<code> for </code>==<code>, </code>!=<code>, </code>&lt;<!-- -->=<code>, </code>&lt;<!-- -->=<code>, </code>in<code> and </code>not-in<!-- -->\` filters.<!-- -->Only one of <code>arrayConfig</code> or <code>order</code> should be set. |
3636

3737
## IndexField.arrayConfig
3838

0 commit comments

Comments
 (0)