-
-
Notifications
You must be signed in to change notification settings - Fork 18
feat: Add Firebase AI provider with comprehensive features #63
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
Open
bagintz
wants to merge
9
commits into
csells:main
Choose a base branch
from
bagintz:firebase-ai-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🚀 Added full Firebase AI provider implementation with advanced features: ## Core Provider - firebase_ai_provider.dart: Enhanced error handling & validation - firebase_ai_chat_model.dart: Complete chat model with streaming - firebase_ai_chat_options.dart: Comprehensive configuration options - firebase_message_mappers.dart: Firebase AI message conversion ## Advanced Features - firebase_ai_streaming_accumulator.dart: Advanced streaming with metadata - firebase_ai_thinking_utils.dart: Thinking/reasoning mode utilities - firebase_ai_multimodal_utils.dart: Multi-modal validation & optimization ## Documentation & Examples - ADVANCED_USAGE.md: 400+ lines comprehensive documentation - firebase_ai_demo.dart: Simple demo following repo patterns - Complete test suite with mocked Firebase dependencies ## Key Capabilities ✅ Enhanced error handling with Firebase-specific validation ✅ Advanced streaming with accumulation and metadata handling ✅ Thinking/reasoning mode implementation ✅ Multi-modal support (images, audio, video, documents) ✅ Comprehensive documentation and examples ✅ Production-ready with proper logging and validation All 6 enhancement areas completed for maintainer review. Ready for dart fix auto-cleanup and integration.
- Fixed 146 style and formatting issues automatically - Reduced total linting issues from 242 to 97 - Improved code consistency with proper const usage - Fixed string escaping and interpolation issues - Applied proper variable scoping (final locals) Remaining issues are mostly acceptable (example print statements, minor line length, missing docs for utility enums).
- Provider Implementation Pattern: Restructured constructor with proper logger placement, baseUrl parameter handling - Test Headers & Philosophy: Added mandatory testing philosophy headers to all test files - Thinking Metadata: Integrated thinking extraction and streaming via ChatResult.metadata['thinking'] - Error Handling: Verified 'Don't Swallow Errors' compliance across all components - Model Configuration: Added comprehensive validation tests for gemini patterns and defaults - Logging Architecture: Implemented hierarchical logging (dartantic.chat.providers.firebase_ai, etc.) - Additional test coverage: Added unit tests for all utility components - Documentation: Updated providers.mdx with Firebase AI capabilities - Build: Added coverage/ and ai_notes/ to .gitignore for cleaner repo All 200+ tests passing with full compliance verification complete.
- Documents requirement for flutter test vs dart test - Explains Flutter dependency requirements - Provides CI/CD guidance for proper test execution - All 204 tests confirmed passing with flutter test
- Restore packages/dartantic_ai/example/.env to main .gitignore - Remove duplicate example/.env from firebase_ai package .gitignore - Maintain proper separation of package-specific ignores
csells
reviewed
Oct 10, 2025
csells
reviewed
Oct 10, 2025
csells
reviewed
Oct 10, 2025
packages/dartantic_firebase_ai/example/bin/firebase_ai_demo.dart
Outdated
Show resolved
Hide resolved
Owner
|
Love this, @bagintz ! Some comments for you. |
…back - Change provider aliases from 'firebase'/'firebase_dev' to 'firebase-vertex'/'firebase-google' - Clarify Firebase project requirements in README: - Google AI backend: No Firebase project needed, just API key - Vertex AI backend: Requires full Firebase project setup - Add Flutter dependency clarification - package requires Flutter, not just Dart - Update all examples and tests to use new naming convention - Add comparison table showing dependencies and requirements Addresses feedback from PR review: csells#63
- Both Google AI and Vertex AI backends require Firebase.initializeApp() - Both require Firebase project configuration (even if minimal) - Both require Flutter SDK, not just Dart - Key difference: Google AI routes to Gemini Developer API, Vertex AI routes through Firebase infrastructure - Verified through official Firebase documentation and test attempts This corrects the previous misconception that Google AI backend doesn't need Firebase setup.
Research confirmed on-device inference is only available for web apps via Firebase AI Logic, not for Flutter mobile apps. Changes: - Removed 'Hybrid On-Device Inference' section with non-existent InferenceMode - Removed inferenceMode from configuration options list - Updated comparison table: 'Yes (preview)' -> 'No (web only)' - Added note with official Firebase documentation link Sources: - https://firebase.blog/posts/2025/06/hybrid-inference-firebase-ai-logic/ - https://firebase.blog/posts/2025/10/understand-ai-logic-hybrid-inference Resolves csells' review comment asking for sample/documentation.
csells
requested changes
Oct 19, 2025
packages/dartantic_firebase_ai/example/bin/firebase_ai_demo.dart
Outdated
Show resolved
Hide resolved
Owner
|
Thanks for this, @bagintz! Let me get the underlying PR landed (waiting on Google -- hopefully this week) and then we'll get this one landed, too. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a comprehensive Firebase AI provider implementation for the dartantic_ai ecosystem, providing seamless integration with Google's Gemini models through Firebase.
Key Features
🔥 Dual Backend Support
⚡ Complete dartantic Compliance
🛠 Rich Functionality
Implementation Highlights
Provider Architecture
Testing Infrastructure
flutter test(notdart test) due to Flutter framework dependenciesDocumentation & Setup
Files Added/Modified
Core Implementation
packages/dartantic_firebase_ai/- Complete provider packagepackages/dartantic_firebase_ai/lib/src/firebase_ai_provider.dart- Main provider implementationpackages/dartantic_firebase_ai/test/- Comprehensive test suite (204 tests)Documentation
packages/dartantic_firebase_ai/README.md- Provider documentationpackages/dartantic_firebase_ai/TEST_EXECUTION.md- Test execution guideTesting
All tests pass successfully:
Note: Tests must be run with
flutter testrather thandart testdue to Flutter framework dependencies in the firebase_ai package.Compliance Verification
This implementation has been verified against all dartantic standards:
✅ Provider Patterns: Full unified provider architecture compliance
✅ Test Headers: All test files include proper standardized headers
✅ Thinking Metadata: Error handling includes contextual thinking information
✅ Error Handling: Comprehensive exception handling with proper types
✅ Model Configuration: Support for both object and string-based model specs
✅ Logging Architecture: Proper logging integration with context preservation
Backend Configuration
Google AI (Development)
Vertex AI (Production)
Ready for Review
This implementation is production-ready with: