Skip to content

feat(vertexai): Add HarmBlockThreshold.OFF #17325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 8 additions & 2 deletions packages/firebase_vertexai/firebase_vertexai/lib/src/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,12 @@ enum HarmBlockThreshold {
high('BLOCK_ONLY_HIGH'),

/// Always show regardless of probability of unsafe content.
none('BLOCK_NONE');
none('BLOCK_NONE'),

/// All content is allowed regardless of harm.
///
/// metadata will not be included in the response.
off('OFF');

const HarmBlockThreshold(this._jsonString);

Expand All @@ -602,6 +607,7 @@ enum HarmBlockThreshold {
'BLOCK_MEDIUM_AND_ABOVE' => HarmBlockThreshold.medium,
'BLOCK_ONLY_HIGH' => HarmBlockThreshold.high,
'BLOCK_NONE' => HarmBlockThreshold.none,
'OFF' => HarmBlockThreshold.off,
_ => throw FormatException(
'Unhandled HarmBlockThreshold format', jsonObject),
};
Expand Down Expand Up @@ -797,7 +803,7 @@ final class GenerationConfig extends BaseGenerationConfig {
if (responseMimeType case final responseMimeType?)
'responseMimeType': responseMimeType,
if (responseSchema case final responseSchema?)
'responseSchema': responseSchema,
'responseSchema': responseSchema.toJson(),
};
}

Expand Down
Loading
Loading