Skip to content
Open
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
1 change: 1 addition & 0 deletions packages/firebase_ai/firebase_ai/lib/firebase_ai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export 'src/live_api.dart'
SlidingWindow,
Transcription;
export 'src/live_session.dart' show LiveSession;
export 'src/mime_types.dart' show FirebaseAIMimeTypes;
export 'src/schema.dart' show JSONSchema, Schema, SchemaType;
export 'src/server_template/template_chat.dart'
show TemplateChatSession, StartTemplateChatExtension;
Expand Down
69 changes: 69 additions & 0 deletions packages/firebase_ai/firebase_ai/lib/src/mime_types.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// MIME types supported by Gemini multimodal models.
///
/// Model capabilities can vary. Check the
/// [Firebase AI Logic documentation](https://firebase.google.com/docs/ai-logic)
/// before relying on a MIME type for a specific model.
abstract final class FirebaseAIMimeTypes {
/// Supported image MIME types.
static const List<String> image = <String>[
'image/png',
'image/jpeg',
'image/webp',
];

/// Supported video MIME types.
static const List<String> video = <String>[
'video/x-flv',
'video/quicktime',
'video/mpeg',
'video/mpegps',
'video/mpg',
'video/mp4',
'video/webm',
'video/wmv',
'video/3gpp',
];

/// Supported audio MIME types.
static const List<String> audio = <String>[
'audio/aac',
'audio/flac',
'audio/mp3',
'audio/m4a',
'audio/mpeg',
'audio/mpga',
'audio/mp4',
'audio/opus',
'audio/pcm',
'audio/wav',
'audio/webm',
];

/// Supported document MIME types.
static const List<String> document = <String>[
'application/pdf',
'text/plain',
];

/// All supported multimodal MIME types.
static const List<String> all = <String>[
...image,
...video,
...audio,
...document,
];
}
38 changes: 38 additions & 0 deletions packages/firebase_ai/firebase_ai/test/mime_types_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:firebase_ai/firebase_ai.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
test('exposes supported MIME types by media category', () {
expect(
FirebaseAIMimeTypes.image,
const <String>['image/png', 'image/jpeg', 'image/webp'],
);
expect(
FirebaseAIMimeTypes.document,
const <String>['application/pdf', 'text/plain'],
);
expect(
FirebaseAIMimeTypes.all,
containsAll(<String>[
...FirebaseAIMimeTypes.image,
...FirebaseAIMimeTypes.video,
...FirebaseAIMimeTypes.audio,
...FirebaseAIMimeTypes.document,
]),
);
});
}
Loading