This Flutter AI app will be the best Flutter AI assistant that helps the user in many ways it enables the users to chat with the pdf and will save a lot of the time you just upload the pdf and ask questions related to that pdf rather than reading the whole pdf.
Flutter AI App will also allow you to generate an image from that user have to just give a simple prompt so that AI will generate the images for that particular user within seconds.
Flutter AI App will have a chatbot so the user can chat with the AI and make a conversation with the AI for a better experience and ask the any task related questions he wants.
Features
AI Buddy is a cross-platform mobile application that leverages the power of AI to provide users with a personal assistant capable of understanding and responding to various queries.
Architecture
The architecture of the AI Buddy app is designed to process and interact with PDF documents efficiently. Here’s a breakdown of the workflow:
Overview
The “Chat with PDF” feature of the AI Buddy app allows users to interact with the content of a PDF document conversationally. The app extracts information from the PDF, processes it, and provides relevant responses to user queries.
Workflow Diagram
Workflow Steps
- PDF Extraction: The PDF document is processed to extract its pages.
- Chunking: The extracted pages are then split into manageable chunks for processing.
- Batching: Chunks are grouped into batches (e.g., 1 batch = 100 chunks) for parallel processing.
- Embedding Generation: Each batch is sent to an Embeddings API with the task type set to ‘Document’. The API generates a list of vector embeddings for each chunk.
- Local Storage: The generated embeddings for each batch are split into individual chunk embeddings. These embeddings are stored locally using Hive (a key-value database).
- User Interaction: When a user inputs an instruction (e.g., “Give me an intro to the book”), the app sends the query to the Embeddings API with the task type set to ‘Query’ to generate an embedding for the query.
- Semantic Search: The app performs a semantic search by embedding the user’s query and comparing it across the document embeddings stored in Hive.
- Ranking Results: The chunks are ranked based on the Euclidean distance between the query embedding and document embeddings. The top-ranked chunks are used as the context for the language model (LLM).
- Response Generation: The language model generates an answer based on the context of the top-ranked chunks.
Technologies Used
- Flutter: For cross-platform mobile application development.
- Hive: For local storage of chunk embeddings.
- Gemini Embeddings API: For generating vector embeddings of text.
- Gemini (LLM): For generating responses based on context.
- Riverpod: For managing states across the app.
Getting Started
Prerequisites
Need the latest Flutter version & a Gemini API key from here
flutter upgrade
Installation
- Clone the repository from GitHub:
git clone https://github.com/yatendra2001/ai_buddy.git
- Get all dependencies:
flutter pub get
- Run the app:
flutter run
Contributing
Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
Contribution to the project can be made if you have some improvements for the project or if you find some bugs. You can contribute to the project by reporting issues, forking it, modifying the code, and making a pull request to the repository.
Please make sure you specify the commit type when opening pull requests:
feat: The new feature you're proposing
fix: A bug fix in the project
style: Feature and updates related to UI improvements and styling
test: Everything related to testing
docs: Everything related to documentation
refactor: Regular code refactoring and maintenance
To know more extensively about how to contribute to this project, read our Contribution Guide.