Skip to content

Commit 577d432

Browse files
committed
Merge branch 'main' into dl/remove-groundingattribution
2 parents 8039402 + ec5f374 commit 577d432

33 files changed

+783
-336
lines changed

.changeset/five-kids-grow.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 support for Grounding with Google Search.

.changeset/hip-impalas-divide.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 support for Thinking Budget.

.changeset/late-beers-develop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'firebase': major
3+
---
4+
5+
Remove `vertexai` import path

.changeset/thirty-eggs-laugh.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/ai': major
3+
'firebase': major
4+
---
5+
6+
Remove `VertexAI` APIs.

common/api-review/ai.api.md

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class AIError extends FirebaseError {
2727
}
2828

2929
// @public
30-
const enum AIErrorCode {
30+
export const enum AIErrorCode {
3131
API_NOT_ENABLED = "api-not-enabled",
3232
ERROR = "error",
3333
FETCH_ERROR = "fetch-error",
@@ -43,10 +43,6 @@ const enum AIErrorCode {
4343
UNSUPPORTED = "unsupported"
4444
}
4545

46-
export { AIErrorCode }
47-
48-
export { AIErrorCode as VertexAIErrorCode }
49-
5046
// @public
5147
export abstract class AIModel {
5248
// @internal
@@ -381,6 +377,7 @@ export interface GenerationConfig {
381377
stopSequences?: string[];
382378
// (undocumented)
383379
temperature?: number;
380+
thinkingConfig?: ThinkingConfig;
384381
// (undocumented)
385382
topK?: number;
386383
// (undocumented)
@@ -424,9 +421,6 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOpti
424421
// @beta
425422
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
426423

427-
// @public @deprecated (undocumented)
428-
export function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
429-
430424
// @public
431425
export class GoogleAIBackend extends Backend {
432426
constructor();
@@ -486,14 +480,36 @@ export interface GoogleAIGenerateContentResponse {
486480
usageMetadata?: UsageMetadata;
487481
}
488482

483+
// @public
484+
export interface GoogleSearch {
485+
}
486+
487+
// @public
488+
export interface GoogleSearchTool {
489+
googleSearch: GoogleSearch;
490+
}
491+
492+
// @public
493+
export interface GroundingChunk {
494+
web?: WebGroundingChunk;
495+
}
496+
489497
// @public
490498
export interface GroundingMetadata {
491-
// (undocumented)
499+
groundingChunks?: GroundingChunk[];
500+
groundingSupports?: GroundingSupport[];
501+
// @deprecated (undocumented)
492502
retrievalQueries?: string[];
493-
// (undocumented)
503+
searchEntryPoint?: SearchEntrypoint;
494504
webSearchQueries?: string[];
495505
}
496506

507+
// @public
508+
export interface GroundingSupport {
509+
groundingChunkIndices?: number[];
510+
segment?: Segment;
511+
}
512+
497513
// @public
498514
export enum HarmBlockMethod {
499515
PROBABILITY = "PROBABILITY",
@@ -843,14 +859,17 @@ export enum SchemaType {
843859
STRING = "string"
844860
}
845861

846-
// @public (undocumented)
862+
// @public
863+
export interface SearchEntrypoint {
864+
renderedContent?: string;
865+
}
866+
867+
// @public
847868
export interface Segment {
848-
// (undocumented)
849869
endIndex: number;
850-
// (undocumented)
851870
partIndex: number;
852-
// (undocumented)
853871
startIndex: number;
872+
text: string;
854873
}
855874

856875
// @public
@@ -887,7 +906,12 @@ export interface TextPart {
887906
}
888907

889908
// @public
890-
export type Tool = FunctionDeclarationsTool;
909+
export interface ThinkingConfig {
910+
thinkingBudget?: number;
911+
}
912+
913+
// @public
914+
export type Tool = FunctionDeclarationsTool | GoogleSearchTool;
891915

892916
// @public
893917
export interface ToolConfig {
@@ -908,31 +932,17 @@ export interface UsageMetadata {
908932
promptTokenCount: number;
909933
// (undocumented)
910934
promptTokensDetails?: ModalityTokenCount[];
935+
thoughtsTokenCount?: number;
911936
// (undocumented)
912937
totalTokenCount: number;
913938
}
914939

915-
// @public @deprecated (undocumented)
916-
export type VertexAI = AI;
917-
918940
// @public
919941
export class VertexAIBackend extends Backend {
920942
constructor(location?: string);
921943
readonly location: string;
922944
}
923945

924-
// @public @deprecated (undocumented)
925-
export const VertexAIError: typeof AIError;
926-
927-
// @public @deprecated (undocumented)
928-
export const VertexAIModel: typeof AIModel;
929-
930-
// @public
931-
export interface VertexAIOptions {
932-
// (undocumented)
933-
location?: string;
934-
}
935-
936946
// @public
937947
export interface VideoMetadata {
938948
endOffset: string;
@@ -947,5 +957,12 @@ export interface WebAttribution {
947957
uri: string;
948958
}
949959

960+
// @public
961+
export interface WebGroundingChunk {
962+
domain?: string;
963+
title?: string;
964+
uri?: string;
965+
}
966+
950967

951968
```

docs-devsite/_toc.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,16 @@ toc:
7676
path: /docs/reference/js/ai.generativemodel.md
7777
- title: GoogleAIBackend
7878
path: /docs/reference/js/ai.googleaibackend.md
79+
- title: GoogleSearch
80+
path: /docs/reference/js/ai.googlesearch.md
81+
- title: GoogleSearchTool
82+
path: /docs/reference/js/ai.googlesearchtool.md
83+
- title: GroundingChunk
84+
path: /docs/reference/js/ai.groundingchunk.md
7985
- title: GroundingMetadata
8086
path: /docs/reference/js/ai.groundingmetadata.md
87+
- title: GroundingSupport
88+
path: /docs/reference/js/ai.groundingsupport.md
8189
- title: ImagenGCSImage
8290
path: /docs/reference/js/ai.imagengcsimage.md
8391
- title: ImagenGenerationConfig
@@ -128,6 +136,8 @@ toc:
128136
path: /docs/reference/js/ai.schemarequest.md
129137
- title: SchemaShared
130138
path: /docs/reference/js/ai.schemashared.md
139+
- title: SearchEntrypoint
140+
path: /docs/reference/js/ai.searchentrypoint.md
131141
- title: Segment
132142
path: /docs/reference/js/ai.segment.md
133143
- title: StartChatParams
@@ -136,18 +146,20 @@ toc:
136146
path: /docs/reference/js/ai.stringschema.md
137147
- title: TextPart
138148
path: /docs/reference/js/ai.textpart.md
149+
- title: ThinkingConfig
150+
path: /docs/reference/js/ai.thinkingconfig.md
139151
- title: ToolConfig
140152
path: /docs/reference/js/ai.toolconfig.md
141153
- title: UsageMetadata
142154
path: /docs/reference/js/ai.usagemetadata.md
143155
- title: VertexAIBackend
144156
path: /docs/reference/js/ai.vertexaibackend.md
145-
- title: VertexAIOptions
146-
path: /docs/reference/js/ai.vertexaioptions.md
147157
- title: VideoMetadata
148158
path: /docs/reference/js/ai.videometadata.md
149159
- title: WebAttribution
150160
path: /docs/reference/js/ai.webattribution.md
161+
- title: WebGroundingChunk
162+
path: /docs/reference/js/ai.webgroundingchunk.md
151163
- title: analytics
152164
path: /docs/reference/js/analytics.md
153165
section:

docs-devsite/ai.functiondeclaration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Structured representation of a function declaration as defined by the [OpenAPI 3
1515
<b>Signature:</b>
1616

1717
```typescript
18-
export declare interface FunctionDeclaration
18+
export interface FunctionDeclaration
1919
```
2020

2121
## Properties

docs-devsite/ai.functiondeclarationstool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A `FunctionDeclarationsTool` is a piece of code that enables the system to inter
1515
<b>Signature:</b>
1616

1717
```typescript
18-
export declare interface FunctionDeclarationsTool
18+
export interface FunctionDeclarationsTool
1919
```
2020

2121
## Properties

docs-devsite/ai.generationconfig.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface GenerationConfig
3131
| [responseSchema](./ai.generationconfig.md#generationconfigresponseschema) | [TypedSchema](./ai.md#typedschema) \| [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Output response schema of the generated candidate text. This value can be a class generated with a [Schema](./ai.schema.md#schema_class) static method like <code>Schema.string()</code> or <code>Schema.object()</code> or it can be a plain JS object matching the [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) interface. <br/>Note: This only applies when the specified <code>responseMIMEType</code> supports a schema; currently this is limited to <code>application/json</code> and <code>text/x.enum</code>. |
3232
| [stopSequences](./ai.generationconfig.md#generationconfigstopsequences) | string\[\] | |
3333
| [temperature](./ai.generationconfig.md#generationconfigtemperature) | number | |
34+
| [thinkingConfig](./ai.generationconfig.md#generationconfigthinkingconfig) | [ThinkingConfig](./ai.thinkingconfig.md#thinkingconfig_interface) | Configuration for "thinking" behavior of compatible Gemini models. |
3435
| [topK](./ai.generationconfig.md#generationconfigtopk) | number | |
3536
| [topP](./ai.generationconfig.md#generationconfigtopp) | number | |
3637

@@ -117,6 +118,16 @@ stopSequences?: string[];
117118
temperature?: number;
118119
```
119120

121+
## GenerationConfig.thinkingConfig
122+
123+
Configuration for "thinking" behavior of compatible Gemini models.
124+
125+
<b>Signature:</b>
126+
127+
```typescript
128+
thinkingConfig?: ThinkingConfig;
129+
```
130+
120131
## GenerationConfig.topK
121132

122133
<b>Signature:</b>

docs-devsite/ai.vertexaioptions.md renamed to docs-devsite/ai.googlesearch.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,13 @@ overwritten. Changes should be made in the source code at
99
https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

12-
# VertexAIOptions interface
13-
Options when initializing the Firebase AI SDK.
12+
# GoogleSearch interface
13+
Specifies the Google Search configuration.
1414

15-
<b>Signature:</b>
16-
17-
```typescript
18-
export interface VertexAIOptions
19-
```
20-
21-
## Properties
22-
23-
| Property | Type | Description |
24-
| --- | --- | --- |
25-
| [location](./ai.vertexaioptions.md#vertexaioptionslocation) | string | |
26-
27-
## VertexAIOptions.location
15+
Currently, this is an empty object, but it's reserved for future configuration options.
2816

2917
<b>Signature:</b>
3018

3119
```typescript
32-
location?: string;
20+
export interface GoogleSearch
3321
```

0 commit comments

Comments
 (0)