Inspiration
In today’s fast-paced information age, misinformation can spread within seconds—especially during live debates, presentations, or when examining claims embedded in images. I wanted to empower speakers, students, journalists, and everyday users to challenge falsehoods in real time. By combining Perplexity’s powerful Sonar API with Flutter’s cross-platform reach and Firebase’s real-time database, Fact Dynamics was born to bring on-the-fly fact-checking directly into your hands.
What It Does
- Live Debate Mode Streams your speech, breaks it into bite-sized chunks, and submits each to Perplexity for instant claim verification.
- Image Report Mode Accepts photos or URLs, extracts textual claims from images, and checks them against credible sources.
Structured Claim Output Displays each identified claim as a chat “bubble” with:
- Rating: TRUE / FALSE / MISLEADING / UNVERIFIABLE
- Explanation: One-sentence justification
- Sources: Two curated URLs
Persistence & Playback All transcripts and fact-check results are stored in Firestore under
users/{uid}/debatesor.../images, so you can revisit or share your sessions.Secure Auth & Sync Firebase Authentication (Google, Apple, Email) keeps your data private and synced across devices.
How We Built It
- Frontend
- Flutter for a unified iOS, Android, and Web experience.
BLoC pattern to separate UI from business logic.
- Speech & Image Processing
speech_to_textpackage captures live audio.Custom prompt engineering in
assets/prompts/fact_checker_prompt.mdinstructs the Sonar API to extract and rate claims.Base64 or URL-based image uploads via our
ChatRequestModel.defaultImageRequest.- Backend & Storage
Firestore schema stores each session under the authenticated user:
users/{uid}/debates/{debateId}/transcriptions /claims users/{uid}/images/{imageId}/claimsBatched writes ensure fast, atomic claim uploads.
- SDKs & Packages
Published perplexity_dart (Dart SDK) and perplexity_flutter (Flutter wrapper) for seamless API calls.
Environment variables managed via
.envanddotenvfor secure API key handling.
Challenges We Ran Into
- Chunking Speech Finding the right word-count threshold (≈7 words) before triggering an API call to balance responsiveness and cost.
- Streaming vs. Non-Streaming Handling partial JSON streams from Perplexity required accumulating chunks until valid JSON could parse.
- Firestore Rules & Permissions Ensuring secure, user-scoped read/write rules while allowing real-time updates.
Accomplishments We’re Proud Of
- Cross-Platform Consistency: One codebase powering mobile and web deployments.
- Open-Source SDKs: Launched two packages on pub.dev—drastically lowering the barrier for other Dart/Flutter developers.
- Real-Time UX: Sub-second fact feedback during live speech, a unique feature in the hackathon space.
What We Learned
- The importance of prompt engineering: precise instructions yield cleaner, more structured JSON outputs.
- Balancing streaming performance with API rate limits and cost.
- Designing Firestore schemas for real-time collaborative scenarios.
What’s Next for Fact Dynamics
- Collaborative Sessions: Multi-user debate rooms with shared transcripts and fact streams.
- Video-Conference Plugins: Browser extensions or SDKs for Zoom/Meet integrations.
- Offline Mode: Cache recent fact-checks for use without connectivity.
- Analytics Dashboard: Visualize misinformation trends over time and across topics.
Thank you for checking out Fact Dynamics, we’re excited to bring truth back into every conversation!