Skip to content

Commit 722562b

Browse files
yinghsienwucopybara-github
authored andcommitted
feat: Support Gemini batch inline request's metadata and add test coverage to safety setting
PiperOrigin-RevId: 817811792
1 parent 81ed6a3 commit 722562b

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

api-report/genai-node.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,7 @@ export class InlinedEmbedContentResponse {
16881688
export interface InlinedRequest {
16891689
config?: GenerateContentConfig;
16901690
contents?: ContentListUnion;
1691+
metadata?: Record<string, string>;
16911692
model?: string;
16921693
}
16931694

api-report/genai-web.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,7 @@ export class InlinedEmbedContentResponse {
16881688
export interface InlinedRequest {
16891689
config?: GenerateContentConfig;
16901690
contents?: ContentListUnion;
1691+
metadata?: Record<string, string>;
16911692
model?: string;
16921693
}
16931694

api-report/genai.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,7 @@ export class InlinedEmbedContentResponse {
16881688
export interface InlinedRequest {
16891689
config?: GenerateContentConfig;
16901690
contents?: ContentListUnion;
1691+
metadata?: Record<string, string>;
16911692
model?: string;
16921693
}
16931694

src/converters/_batches_converters.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,11 @@ export function inlinedRequestToMldev(
12881288
common.setValueByPath(toObject, ['request', 'contents'], transformedList);
12891289
}
12901290

1291+
const fromMetadata = common.getValueByPath(fromObject, ['metadata']);
1292+
if (fromMetadata != null) {
1293+
common.setValueByPath(toObject, ['metadata'], fromMetadata);
1294+
}
1295+
12911296
const fromConfig = common.getValueByPath(fromObject, ['config']);
12921297
if (fromConfig != null) {
12931298
common.setValueByPath(

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4581,6 +4581,8 @@ export declare interface InlinedRequest {
45814581
/** Content of the request.
45824582
*/
45834583
contents?: ContentListUnion;
4584+
/** The metadata to be associated with the request. */
4585+
metadata?: Record<string, string>;
45844586
/** Configuration that contains optional model parameters.
45854587
*/
45864588
config?: GenerateContentConfig;

0 commit comments

Comments
 (0)