Dawia is a personal assistant that integrates with Mistral's API to generate responses, it can also do various tasks like controlling IoT devices, launching applications, and organizing files. Dawia can be interacted with through text or speech prompts.
- Voice Assistant: Interact with Dawia through text or speech prompts.
- API Model Selection: Choose from different Mistral models to chape the assistant's response.(all free)
- Voice Configuration: Customize Dawia's voice output using different voice options.
- Google Authentication: Login using your Google account to access Dawia.
- Search Engine Integration: Search Google, wikipedia, or YouTube directly via commands.
- Program LauncherControl: Open or launch applications.
- Device Control: Control IoT devices (like lights).
- File Organization: Automatically organize files in directories with a simple command.
- Chat History: Save load, delete chat history for user-specific interactions.
├── assets/ # -> Contains images and icons for Dawia's UI
│ ├── img
│ ├── user_img
├── chat_db/ # -> Contains user chat history management file
│ ├── local_db_manager.py # -> Saves and loads chat history()
├── config_utility/ # -> Contains configuration utility file
│ ├── config_manager.py # -> Loads and saves configurations
├── source/ # -> Main back end source code files
│ ├── device_client # -> Contains device ip adress (you should add this file here even if you are not controlling any device, it can be empty)
│ ├── response_manager.py # -> Handles Mistral AI API interactions, and response streaming
│ ├── voice_manager.py # -> Handles speech prompting, tts(text to speech), and stt(speech to text)
│ ├── tools_manager.py # -> Utility functions (image processing, launching apps, etc.)
│ ├── dir_manager.py # -> Manages file organization feature
│ ├── search_engine_manager.py # -> Search Google or YouTube usng user prompt
│ └── device_manager.py # -> Handles device management like toggling lights
├── app.py # -> Dawia's main app entry point
├── google_credentials.json # -> Google authentication credentials for login feature
├── hvar.py # -> Contains html/css injection code for streamlit
├── README.md # -> Project documentation
├── config.json # -> Configuration file storing default user values (will be generated if not present)
├── requirements.txt # -> Contains all the required libraries for the project
└── style.css # -> Contains css code
- Python 3.12+
- Streamlit for web application development
- Google API credentials for authentication
To install the required dependencies, run:
pip install -r requirements.txt
mistralai
: For interacting with the Mistral API.edge_tts
: For text-to-speech conversion.speech_recognition
: For speech-to-text conversion.playsound
: For playing generated audio files.streamlit
: Main web application framework.streamlit_image_select
: For image selection.streamlit_google_auth
: Google authentication integration.concurrent.futures
: For handling asynchronous tasks.pickle
: For handling user/chat history.json
: For handling JSON data(user config).os
: For interacting with the operating system.Pathlib
: For handling file paths.chutil
: For handling file operations.subprocess
: For launching applications.wxPython
: for directory path selection without interacting with streamlit mainloop.base64
: For image encoding.yeelight
: For controlling Yeelight devices.webbrowser
: For opening URLs.time
: For pauses between each yeld for response stream to the user.
- config.json: The configuration file contains the initial settings for the assistant, such as the API model, Dawia's voice model, toggle voice response ON/OFF, and user avatar.
- google_credentials.json: Required for enabling Google authentication.
-
Clone the repository:
git clone https://github.com/thevorgx/Dawia_virtual_assistant cd Dawia_virtual_assistant
-
Set up virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up the environment:
Ensure you have the
google_credentials.json
file in the root directory. -
Run the Streamlit app:
streamlit run app.py
or
python -m streamlit run app.py
-
Access the app:
Visit
http://localhost:8501
in your browser.
Once you have the app running:
- Login: Use your Google account to authenticate.
- Configure API Key: Paste your Mistral API key in the provided field in the sidebar.
- Interact: You can either type messages or use the microphone button to send speech commands. if you want to trigger Dawia features beyond the chat, your prompt should contain "Please" Dawia reserves her features for the polite user!
- Configure settings: In the sidebar, customize Dawia's settings, such as API model, voice options, and your user avatar.
This project was done as a part of ALX software engineering program(back-end), the development of Dawia will continue to improve and add more features. the idea behind the making of Dawia, is to creat a personal assistant that can be used to automate tasks and control your home devices using text or voice commands.
This project is open source, and it will always be, If you have any ideas or suggestions, feel free to open an issue or submit a pull request.