This desktop AI application leverages advanced LLM models from LM Studio, along with various APIs for weather and news updates. It includes speech recognition capabilities, cosine similarity for prompt comparison, and a range of responses for interactive communication. The application is designed to be activated by voice commands and provides intelligent responses based on the context of the conversation.
lm studio | chat with jarvis |
---|---|
![]() |
![]() |
- Voice Activation: Activate the AI with the command "Hey Jarvis".
- Speech Recognition: Converts spoken language into text.
- Embedding and Similarity: Uses embeddings to calculate cosine similarity between prompts and a list of predefined prompts.
- API Integration: Fetches data from weather and news APIs.
- Dynamic Responses: Provides varied responses based on the context of the conversation.
- Python 3.9+
- Virtual Environment
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
venv\Scripts\activate
-
On macOS/Linux:
source venv/bin/activate
-
-
Clone the repository:
git clone https://github.com/ganeshnikhil/Desktop_AI.git cd Desktop_AI
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the root directory of the project. -
Add your API keys and other configuration variables to the
.env
file. Here’s a sample structure:Weather_api=your_weather_api_key News_api=your_news_api_key Sender_email = your_email Receiver_email = subject_email Password_email = email_password.
-
**Setup the keys and passwords.
- Download llm models from lm studio these model run locally on your system. - nomic-embed-text-v1.5-GGUF (generate embeddings) - Mistral-7B-Instruct-v0.2-GGUF (text model) - llava-phi-3-mini-gguf (intall vision adapter) (image + text) model - Eris_PrimeV4-Vision-32k-7B-GGUF-IQ-Imatrix (install vision adapter) (image + text) model
- get weather api
- get news api
- generate password to send email using smptlib
-
**System requirements
- 8gb+ ram (higher is better) - 250 gb+ storage - i5 processor or m processor - gpu / npu
-
Run the application:
python main.py
-
Voice Commands:
- Say "Hey Jarvis" to activate listening mode.
- Speak your prompt or query.
- Say "exit" or use any of the ending phrases to terminate the session.
Here's a basic overview of the main code file:
from src.BRAIN.embd import similar_prompt
from src.BRAIN.nltk_embd import nltk_sim_prompt
from src.CONVERSATION.speech import recognize_speech
from src.response import ai_response
from src.CONVERSATION.conv_tts import convSpeak
from src.FUNCTION.random_respon import random_choice
from src.DATA.msg import responses, welcome_responses, end_responses, ending_phrases
import time
def main():
print("[*] Say 'hey jarvis' to activate, or 'exit' to quit.")
listening_mode = False
while True:
spoken_text = recognize_speech()
if spoken_text:
print(f"You said: {spoken_text}")
if "hey jarvis" in spoken_text.lower() and not listening_mode:
convSpeak("Hello Mr. Stark.")
convSpeak(random_choice(welcome_responses))
print("Listening mode activated.")
listening_mode = True
elif any(phrase in spoken_text.lower() for phrase in ending_phrases) and listening_mode:
convSpeak(random_choice(end_responses))
listening_mode = False
print("Exiting...")
break
elif listening_mode:
prompt = spoken_text.strip()
try:
content_type = similar_prompt(prompt)
except Exception as e:
print("Install and start LM Studio..")
print(f"ERROR: {e}")
content_type = nltk_sim_prompt(prompt)
convSpeak(random_choice(responses))
time.sleep(0.1)
reaction = ai_response(content_type)
if reaction:
print(reaction)
convSpeak(reaction)
if __name__ == "__main__":
main()
src/
BRAIN/
embd.py
: Contains thesimilar_prompt
function for cosine similarity.nltk_embd.py
: Contains thenltk_sim_prompt
function for prompt similarity using NLTK.
CONVERSATION/
speech.py
: Contains therecognize_speech
function for speech recognition.conv_tts.py
: Contains theconvSpeak
function for text-to-speech conversion.
response.py
: Contains theai_response
function to generate responses.FUNCTION/
random_respon.py
: Contains therandom_choice
function for selecting random responses.
DATA/
msg.py
: Contains predefined response lists, includingresponses
,welcome_responses
,end_responses
, andending_phrases
.
This project is licensed under the GPL License - see the LICENSE file for details.
Feel free to submit issues, improvements, or pull requests. Please follow the standard guidelines for contributions.
If you have any questions or need further assistance, please contact [[email protected]].