Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/good-cooks-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/ai': patch
---

Add 'includeSafetyAttributes' field to Predict request payloads.
2 changes: 2 additions & 0 deletions packages/ai/src/requests/request-helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ describe('request formatting methods', () => {
expect(body.instances[0].prompt).to.equal(prompt);
expect(body.parameters.sampleCount).to.equal(1);
expect(body.parameters.includeRaiReason).to.be.true;
expect(body.parameters.includeSafetyAttributes).to.be.true;

// Parameters without default values should be undefined
expect(body.parameters.storageUri).to.be.undefined;
Expand Down Expand Up @@ -258,6 +259,7 @@ describe('request formatting methods', () => {
personGeneration: safetySettings.personFilterLevel,
aspectRatio,
includeRaiReason: true,
includeSafetyAttributes: true,
storageUri: undefined
});
});
Expand Down
3 changes: 2 additions & 1 deletion packages/ai/src/requests/request-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ export function createPredictRequestBody(
addWatermark,
safetyFilterLevel,
personGeneration: personFilterLevel,
includeRaiReason: true
includeRaiReason: true,
includeSafetyAttributes: true
}
};
return body;
Expand Down
2 changes: 2 additions & 0 deletions packages/ai/src/types/imagen/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export interface ImagenResponseInternal {
* "personGeneration": "allow_all",
* "sampleCount": 2,
* "includeRaiReason": true,
* "includeSafetyAttributes": true,
* "aspectRatio": "9:16"
* }
* }
Expand Down Expand Up @@ -111,6 +112,7 @@ export interface PredictRequestBody {
safetyFilterLevel?: string;
personGeneration?: string; // Maps to personFilterLevel
includeRaiReason: boolean;
includeSafetyAttributes: boolean;
};
}

Expand Down
Loading