Skip to content

Commit 9e50f10

Browse files
committed
Merge branch 'main' into dl/live
2 parents 923c6bb + cbef6c6 commit 9e50f10

File tree

117 files changed

+3523
-311
lines changed

Some content is hidden

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

117 files changed

+3523
-311
lines changed

.changeset/brave-llamas-impress.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/ai': minor
3+
'firebase': minor
4+
---
5+
6+
Add `thoughtSummary()` convenience method to `EnhancedGenerateContentResponse`.

.changeset/calm-guests-pump.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+
Fixed an issue where `AIError` messages were too long after including an entire response body.

.changeset/good-cooks-deliver.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 'includeSafetyAttributes' field to Predict request payloads.

.changeset/nasty-rings-drop.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/ai': minor
3+
'firebase': minor
4+
---
5+
6+
Add App Check limited use token option to `getAI()`.

.changeset/spotty-bananas-fry.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+
Fixed a bug where a rejected promise with an empty message in a transaction would cause a timeout.

.changeset/strong-avocados-prove.md

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

.changeset/three-balloons-collect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/functions": patch
3+
---
4+
5+
Fixed issue where Firebase Functions SDK caused CORS errors when connected to emulators in Firebase Studio

.changeset/unlucky-goats-teach.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+
Exclude ChromeAdapterImpl code from Node entry point.

common/api-review/ai.api.md

Lines changed: 134 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@
44
55
```ts
66

7+
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
78
import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
9+
import { ComponentContainer } from '@firebase/component';
810
import { FirebaseApp } from '@firebase/app';
11+
import { FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
12+
import { FirebaseAuthInternal } from '@firebase/auth-interop-types';
13+
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
914
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
1015
import { FirebaseError } from '@firebase/util';
16+
import { _FirebaseService } from '@firebase/app';
17+
import { InstanceFactoryOptions } from '@firebase/component';
18+
import { Provider } from '@firebase/component';
1119

1220
// @public
1321
export interface AI {
1422
app: FirebaseApp;
1523
backend: Backend;
1624
// @deprecated (undocumented)
1725
location: string;
26+
options?: AIOptions;
1827
}
1928

2029
// @public
@@ -54,15 +63,16 @@ export abstract class AIModel {
5463
// Warning: (ae-forgotten-export) The symbol "ApiSettings" needs to be exported by the entry point index.d.ts
5564
//
5665
// @internal (undocumented)
57-
protected _apiSettings: ApiSettings;
66+
_apiSettings: ApiSettings;
5867
readonly model: string;
5968
// @internal
6069
static normalizeModelName(modelName: string, backendType: BackendType): string;
6170
}
6271

6372
// @public
6473
export interface AIOptions {
65-
backend: Backend;
74+
backend?: Backend;
75+
useLimitedUseAppCheckTokens?: boolean;
6676
}
6777

6878
// @public
@@ -131,7 +141,7 @@ export class BooleanSchema extends Schema {
131141

132142
// @public
133143
export class ChatSession {
134-
constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
144+
constructor(apiSettings: ApiSettings, model: string, chromeAdapter?: ChromeAdapter | undefined, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
135145
getHistory(): Promise<Content[]>;
136146
// (undocumented)
137147
model: string;
@@ -143,6 +153,15 @@ export class ChatSession {
143153
sendMessageStream(request: string | Array<string | Part>): Promise<GenerateContentStreamResult>;
144154
}
145155

156+
// @public
157+
export interface ChromeAdapter {
158+
// @internal (undocumented)
159+
countTokens(request: CountTokensRequest): Promise<Response>;
160+
generateContent(request: GenerateContentRequest): Promise<Response>;
161+
generateContentStream(request: GenerateContentRequest): Promise<Response>;
162+
isAvailable(request: GenerateContentRequest): Promise<boolean>;
163+
}
164+
146165
// @public
147166
export interface Citation {
148167
// (undocumented)
@@ -210,10 +229,10 @@ export { Date_2 as Date }
210229

211230
// @public
212231
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
213-
// (undocumented)
214232
functionCalls: () => FunctionCall[] | undefined;
215233
inlineDataParts: () => InlineDataPart[] | undefined;
216234
text: () => string;
235+
thoughtSummary: () => string | undefined;
217236
}
218237

219238
// @public
@@ -226,6 +245,11 @@ export interface ErrorDetails {
226245
reason?: string;
227246
}
228247

248+
// Warning: (ae-forgotten-export) The symbol "AIService" needs to be exported by the entry point index.d.ts
249+
//
250+
// @public (undocumented)
251+
export function factory(container: ComponentContainer, { instanceIdentifier }: InstanceFactoryOptions): AIService;
252+
229253
// @public
230254
export interface FileData {
231255
// (undocumented)
@@ -246,6 +270,10 @@ export interface FileDataPart {
246270
inlineData?: never;
247271
// (undocumented)
248272
text?: never;
273+
// (undocumented)
274+
thought?: boolean;
275+
// @internal (undocumented)
276+
thoughtSignature?: never;
249277
}
250278

251279
// @public
@@ -301,6 +329,10 @@ export interface FunctionCallPart {
301329
inlineData?: never;
302330
// (undocumented)
303331
text?: never;
332+
// (undocumented)
333+
thought?: boolean;
334+
// @internal (undocumented)
335+
thoughtSignature?: never;
304336
}
305337

306338
// @public
@@ -334,6 +366,10 @@ export interface FunctionResponsePart {
334366
inlineData?: never;
335367
// (undocumented)
336368
text?: never;
369+
// (undocumented)
370+
thought?: boolean;
371+
// @internal (undocumented)
372+
thoughtSignature?: never;
337373
}
338374

339375
// @public
@@ -424,7 +460,7 @@ export interface GenerativeContentBlob {
424460

425461
// @public
426462
export class GenerativeModel extends AIModel {
427-
constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions);
463+
constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions, chromeAdapter?: ChromeAdapter | undefined);
428464
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
429465
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
430466
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
@@ -447,7 +483,7 @@ export class GenerativeModel extends AIModel {
447483
export function getAI(app?: FirebaseApp, options?: AIOptions): AI;
448484

449485
// @public
450-
export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
486+
export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridParams, requestOptions?: RequestOptions): GenerativeModel;
451487

452488
// @beta
453489
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
@@ -599,6 +635,13 @@ export const HarmSeverity: {
599635
// @public
600636
export type HarmSeverity = (typeof HarmSeverity)[keyof typeof HarmSeverity];
601637

638+
// @public
639+
export interface HybridParams {
640+
inCloudParams?: ModelParams;
641+
mode: InferenceMode;
642+
onDeviceParams?: OnDeviceParams;
643+
}
644+
602645
// @beta
603646
export const ImagenAspectRatio: {
604647
readonly SQUARE: "1:1";
@@ -611,7 +654,7 @@ export const ImagenAspectRatio: {
611654
// @beta
612655
export type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
613656

614-
// @public
657+
// @beta
615658
export interface ImagenGCSImage {
616659
gcsURI: string;
617660
mimeType: string;
@@ -692,6 +735,16 @@ export interface ImagenSafetySettings {
692735
safetyFilterLevel?: ImagenSafetyFilterLevel;
693736
}
694737

738+
// @public
739+
export const InferenceMode: {
740+
readonly PREFER_ON_DEVICE: "prefer_on_device";
741+
readonly ONLY_ON_DEVICE: "only_on_device";
742+
readonly ONLY_IN_CLOUD: "only_in_cloud";
743+
};
744+
745+
// @public
746+
export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];
747+
695748
// @public
696749
export interface InlineDataPart {
697750
// (undocumented)
@@ -702,6 +755,10 @@ export interface InlineDataPart {
702755
inlineData: GenerativeContentBlob;
703756
// (undocumented)
704757
text?: never;
758+
// (undocumented)
759+
thought?: boolean;
760+
// @internal (undocumented)
761+
thoughtSignature?: never;
705762
videoMetadata?: VideoMetadata;
706763
}
707764

@@ -710,6 +767,63 @@ export class IntegerSchema extends Schema {
710767
constructor(schemaParams?: SchemaParams);
711768
}
712769

770+
// @public
771+
export interface LanguageModelCreateCoreOptions {
772+
// (undocumented)
773+
expectedInputs?: LanguageModelExpected[];
774+
// (undocumented)
775+
temperature?: number;
776+
// (undocumented)
777+
topK?: number;
778+
}
779+
780+
// @public
781+
export interface LanguageModelCreateOptions extends LanguageModelCreateCoreOptions {
782+
// (undocumented)
783+
initialPrompts?: LanguageModelMessage[];
784+
// (undocumented)
785+
signal?: AbortSignal;
786+
}
787+
788+
// @public
789+
export interface LanguageModelExpected {
790+
// (undocumented)
791+
languages?: string[];
792+
// (undocumented)
793+
type: LanguageModelMessageType;
794+
}
795+
796+
// @public
797+
export interface LanguageModelMessage {
798+
// (undocumented)
799+
content: LanguageModelMessageContent[];
800+
// (undocumented)
801+
role: LanguageModelMessageRole;
802+
}
803+
804+
// @public
805+
export interface LanguageModelMessageContent {
806+
// (undocumented)
807+
type: LanguageModelMessageType;
808+
// (undocumented)
809+
value: LanguageModelMessageContentValue;
810+
}
811+
812+
// @public
813+
export type LanguageModelMessageContentValue = ImageBitmapSource | AudioBuffer | BufferSource | string;
814+
815+
// @public
816+
export type LanguageModelMessageRole = 'system' | 'user' | 'assistant';
817+
818+
// @public
819+
export type LanguageModelMessageType = 'text' | 'image' | 'audio';
820+
821+
// @public
822+
export interface LanguageModelPromptOptions {
823+
// (undocumented)
824+
responseConstraint?: object;
825+
}
826+
713827
// @beta
714828
export interface LiveGenerationConfig {
715829
frequencyPenalty?: number;
@@ -858,6 +972,14 @@ export interface ObjectSchemaRequest extends SchemaRequest {
858972
type: 'object';
859973
}
860974

975+
// @public
976+
export interface OnDeviceParams {
977+
// (undocumented)
978+
createOptions?: LanguageModelCreateOptions;
979+
// (undocumented)
980+
promptOptions?: LanguageModelPromptOptions;
981+
}
982+
861983
// @public
862984
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
863985

@@ -1077,10 +1199,15 @@ export interface TextPart {
10771199
inlineData?: never;
10781200
// (undocumented)
10791201
text: string;
1202+
// (undocumented)
1203+
thought?: boolean;
1204+
// @internal (undocumented)
1205+
thoughtSignature?: string;
10801206
}
10811207

10821208
// @public
10831209
export interface ThinkingConfig {
1210+
includeThoughts?: boolean;
10841211
thinkingBudget?: number;
10851212
}
10861213

docs-devsite/_toc.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ toc:
2626
path: /docs/reference/js/ai.booleanschema.md
2727
- title: ChatSession
2828
path: /docs/reference/js/ai.chatsession.md
29+
- title: ChromeAdapter
30+
path: /docs/reference/js/ai.chromeadapter.md
2931
- title: Citation
3032
path: /docs/reference/js/ai.citation.md
3133
- title: CitationMetadata
@@ -90,6 +92,8 @@ toc:
9092
path: /docs/reference/js/ai.groundingmetadata.md
9193
- title: GroundingSupport
9294
path: /docs/reference/js/ai.groundingsupport.md
95+
- title: HybridParams
96+
path: /docs/reference/js/ai.hybridparams.md
9397
- title: ImagenGCSImage
9498
path: /docs/reference/js/ai.imagengcsimage.md
9599
- title: ImagenGenerationConfig
@@ -110,6 +114,18 @@ toc:
110114
path: /docs/reference/js/ai.inlinedatapart.md
111115
- title: IntegerSchema
112116
path: /docs/reference/js/ai.integerschema.md
117+
- title: LanguageModelCreateCoreOptions
118+
path: /docs/reference/js/ai.languagemodelcreatecoreoptions.md
119+
- title: LanguageModelCreateOptions
120+
path: /docs/reference/js/ai.languagemodelcreateoptions.md
121+
- title: LanguageModelExpected
122+
path: /docs/reference/js/ai.languagemodelexpected.md
123+
- title: LanguageModelMessage
124+
path: /docs/reference/js/ai.languagemodelmessage.md
125+
- title: LanguageModelMessageContent
126+
path: /docs/reference/js/ai.languagemodelmessagecontent.md
127+
- title: LanguageModelPromptOptions
128+
path: /docs/reference/js/ai.languagemodelpromptoptions.md
113129
- title: LiveGenerationConfig
114130
path: /docs/reference/js/ai.livegenerationconfig.md
115131
- title: LiveGenerativeModel
@@ -134,6 +150,8 @@ toc:
134150
path: /docs/reference/js/ai.objectschema.md
135151
- title: ObjectSchemaRequest
136152
path: /docs/reference/js/ai.objectschemarequest.md
153+
- title: OnDeviceParams
154+
path: /docs/reference/js/ai.ondeviceparams.md
137155
- title: PrebuiltVoiceConfig
138156
path: /docs/reference/js/ai.prebuiltvoiceconfig.md
139157
- title: PromptFeedback

0 commit comments

Comments
 (0)