Build an OpenAI ChatGPT-Powered Voice Assistant with Python (New method 2024)

  Рет қаралды 1,003

TechMakerAI

TechMakerAI

Күн бұрын

Пікірлер: 45
@jeffreyhao1343
@jeffreyhao1343 4 ай бұрын
I like your videos on AI models running on edge devices. Very cool.
@TechMakerAI
@TechMakerAI 4 ай бұрын
Glad you like them!
@taoyongqu8656
@taoyongqu8656 8 ай бұрын
In the line of 128 of your code va4.py, why there is google voice used, instead of OpenAI whisper or Python default voice recognizer as you mentioned in the video?
@TechMakerAI
@TechMakerAI 8 ай бұрын
During my test, this version from Google worked very well. It is almost "free" to use. The OpenAI whisper API version will consume your $5 credits from OpenAI. There are multiple recognition models in the "speech_recognition" lib. You can choose whichever works best for you.
@ryeetzy2624
@ryeetzy2624 5 ай бұрын
can you elaborate what will you do after clicking environment variables
@TechMakerAI
@TechMakerAI 5 ай бұрын
Hi, @ryeetzy2624, Please check the updated Github page for detailed instructions after that, github.com/techmakerai/Python-OpenAI-API-Voice-Chatbot/
@ryeetzy2624
@ryeetzy2624 5 ай бұрын
@@TechMakerAI yeah i think it's expired
@TechMakerAI
@TechMakerAI 5 ай бұрын
Hi, @ryeetzy2624: If that is the case, you can try the Google Gemini model at: kzbin.info/www/bejne/mGjPg4Shf5ergKM or the Meta Llamma-3 model at: kzbin.info/www/bejne/jmnVoYKJgKmabKs.
@LowFrameDuck
@LowFrameDuck 6 ай бұрын
Hello @TechMakerAI, I've set up the virtual environment and copied the code, an added my OpenAI API. However, when I play it and say the wake-up word, it doesn't reply.
@TechMakerAI
@TechMakerAI 6 ай бұрын
@LowFrameDuck: Hi, do you see the print-out of your question on the screen like in my video at time 0.37 s. if so, you may need to check to make sure you have credits on your OpenAI account. The credits can not be expired. If all is good, check that the TTS function is working.
@LowFrameDuck
@LowFrameDuck 6 ай бұрын
@@TechMakerAI I think they have expired Thanks!
@TechMakerAI
@TechMakerAI 6 ай бұрын
@@LowFrameDuck Hi, please check my new video at kzbin.info/www/bejne/eILYioeFnteJr5Y in which I built a voice chatbot with Google Gemini which is free to use as of today.
@truongquangphuc
@truongquangphuc 9 ай бұрын
Does it support multi langluage?
@TechMakerAI
@TechMakerAI 9 ай бұрын
Hi there, I think it is possible to make it work with another language. At first, you need to ensure your language is supported by the speech recognizer. Please take a look here: github.com/Uberi/speech_recognition/blob/master/reference/library-reference.rst. The function used in my code is "recognizer_instance.recognize_google" which does support a lot of languages. Secondly, you need to make sure ChatGPT can understand your language. It can also translate one language from another. Finally, you need to make sure that the text-to-speech engine can speak your language. Please check this webpage for more information: stackoverflow.com/questions/66379488/pyttsx3-does-not-read-text-in-other-languages. You can also use other TTS engines. If ChatGPT cannot understand your language, then I have a new video in which I built a voice chatbot with Google's new AI model Gemini Pro which supports 38 languages. You can watch the new video here: kzbin.info/www/bejne/qonMequgrsZ4qs0.
@truongquangphuc
@truongquangphuc 9 ай бұрын
@@TechMakerAI thank you!
@Akash-el4ls
@Akash-el4ls 7 ай бұрын
its listening and printing what its listened but not providing any outputs can you help again it went to listening
@TechMakerAI
@TechMakerAI 7 ай бұрын
This means that the ChatGPT is not responding to your request. Make sure you set the API key correctly. Then, make sure your free API credit is NOT expired. You can check it here platform.openai.com/usage. You will need sufficient credits to run this code.
@TechMakerAI
@TechMakerAI 7 ай бұрын
If your free credit is expired and you do not want to pay, you can follow my tutorial at kzbin.info/www/bejne/qonMequgrsZ4qs0 to build a similar voice chatbot with Google Gemini for "free".
@d4663r
@d4663r 6 ай бұрын
great video! However, I am having the same issue @akash described. I was able to validate my API by running a test on this sample script. If you get an output.mp3, the API works. You can also check to see if your usage for GPT and TTS is being used. Below is the snippet for testing. Make sure to replace my-key with your api key in quotes. After validating this, I am still not getting audio output. Any suggestions? @TechMakerAI from openai import OpenAI client = OpenAI(api_key="my-key") response = client.audio.speech.create( model="tts-1", voice="nova", input="Hello world! This is a streaming test.", ) response.stream_to_file("output.mp3")
@TechMakerAI
@TechMakerAI 6 ай бұрын
@d4663r, Hi, thanks. The code you provided will test the TTS part, but not the text generation part. I have uploaded a new file at github.com/techmakerai/Python-OpenAI-API-Voice-Chatbot/blob/main/test.py to test whether your API is working or not. Please run that and let us know if you have a response.
@ryeetzy2624
@ryeetzy2624 5 ай бұрын
@@TechMakerAI so basically, it's not free?
@rohitshukla4088
@rohitshukla4088 8 ай бұрын
from openai import OpenAI Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'OpenAI' from 'openai' , showing this error , also its not define where to keep APi Key ??
@TechMakerAI
@TechMakerAI 8 ай бұрын
Hi, there, this error message means your system is missing the "openai" package. You can install it like this "pip install openai" as I mentioned on the GitHub page. Please check that page to install all other packages. Regarding the API key, I have added it as a system environment variable, and I talked about it at time = 3.14 s in the video (kzbin.info/www/bejne/oXacZqt3as-JjbMsi=OZdWFxL7_YXutcCo&t=192). If you want to add it to your Python program, you can do so by changing the line "client = OpenAI(api_key="this is your API key from OpenAI").
@cletusmugabo4773
@cletusmugabo4773 7 ай бұрын
hello i finished installing all packages but on running the code it shows in the terminal listening but when i speak there the content is not captured its as though there is no input from me
@TechMakerAI
@TechMakerAI 7 ай бұрын
Please make sure your microphone is working first. You can use a third party app such as Zoom to check that. Then, if you still have issues, you can increase the duration to 1.0 at line "rec.adjust_for_ambient_noise(source, duration= 0.5)"
@ryeetzy2624
@ryeetzy2624 5 ай бұрын
maybe you didnt wake it up
@ryeetzy2624
@ryeetzy2624 5 ай бұрын
@@TechMakerAI I’m experiencing the same problem, it just listens and dont respond even after waking it up
@TechMakerAI
@TechMakerAI 5 ай бұрын
@@ryeetzy2624 It might be the case that your free credits have expired. Please download this file at github.com/techmakerai/Python-OpenAI-API-Voice-Chatbot/blob/main/test.py and run it on your computer to test whether your API is working or not. Please let us know if you have a response.
@ryeetzy2624
@ryeetzy2624 5 ай бұрын
@@TechMakerAI is it possible that it was already expired even though you just used it now?
@haulu159
@haulu159 7 ай бұрын
why pygame is hard to use
@TechMakerAI
@TechMakerAI 7 ай бұрын
Hi, there, it takes some time to install and configure it correctly. But once you set it up, it works better than other packages. Please see our new video in which we used Pygame for a Google Gemini-powered voice chatbot: kzbin.info/www/bejne/eILYioeFnteJr5Y. It also works with Raspberry Pi. That is another reason why we use Pygame.
@qswdefrgthjmnbgr
@qswdefrgthjmnbgr 9 ай бұрын
Traceback (most recent call last): File "C:\Users\Brinil john\OneDrive\Documents\Python-OpenAI-API-Voice-Chatbot\va4.py", line 171, in main() File "C:\Users\Brinil john\OneDrive\Documents\Python-OpenAI-API-Voice-Chatbot\va4.py", line 106, in main mic = sr.Microphone() ^^^^^^^^^^^^^^^ File "C:\Users\Brinil john\OneDrive\Documents\Python-OpenAI-API-Voice-Chatbot\voice\Lib\site-packages\speech_recognition\__init__.py", line 81, in __init__ self.pyaudio_module = self.get_pyaudio() ^^^^^^^^^^^^^^^^^^ File "C:\Users\Brinil john\OneDrive\Documents\Python-OpenAI-API-Voice-Chatbot\voice\Lib\site-packages\speech_recognition\__init__.py", line 112, in get_pyaudio from distutils.version import LooseVersion ModuleNotFoundError: No module named 'distutils' can u help solve this error which I Am encountering
@TechMakerAI
@TechMakerAI 9 ай бұрын
Hi, there, it looks like your system does not have the 'distutils' module. If you are using Python 3.12 or newer, please try to install the "setuptools" package with pip like this: pip install setuptools.
@SmartMorocco
@SmartMorocco 5 ай бұрын
not workinganymore can you do another tutorial how make it work ?
@TechMakerAI
@TechMakerAI 5 ай бұрын
Hi, @user-om7du4il1u, I just did a test today. This code still works on my computer. If it is printing your question but not providing any outputs from AI, please check and make sure you have enough OpenAI API credit available here platform.openai.com/usage Please subscribe to my channel as I have a new video on GPT coming up soon.
@SmartMorocco
@SmartMorocco 5 ай бұрын
@@TechMakerAI thank you sir i will test and let you know
@MULTIVIDEOCHANNE
@MULTIVIDEOCHANNE 9 ай бұрын
bot-main\va4.py" Traceback (most recent call last): File "c:\Users\Basha\Downloads\talktome\Python-OpenAI-API-Voice-Chatbot-main\va4.py", line 4, in from openai import OpenAI ImportError: cannot import name 'OpenAI' from 'openai' can u help solve this error which I Am encountering
@MULTIVIDEOCHANNE
@MULTIVIDEOCHANNE 9 ай бұрын
its done i did it thanks
@TechMakerAI
@TechMakerAI 9 ай бұрын
Great, this error means you need to install the openai package as I mentioned on the GitHub page
@LowFrameDuck
@LowFrameDuck 6 ай бұрын
​@@TechMakerAI I've got the same problem but i already have the openai package (ERROR "ImportError: cannot import name 'OpenAI' from 'openai' (C:Python\Python312\Lib\site-packages\openai\__init__.py) PS C:\Python-OpenAI-API-Voice-Chatbot-main>"
@TechMakerAI
@TechMakerAI 6 ай бұрын
@LowFrameDuck: If that is the case, I recommend that you create a Python virtual environment and then install the OpenAI package. After that, try to run the code in the virtual environment. Are you using Windows, Mac, or Linux?
@LowFrameDuck
@LowFrameDuck 6 ай бұрын
@@TechMakerAI Windows 10
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 2,5 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 15 МЛН
Top Minds in AI Explain What’s Coming After GPT-4o | EP #130
25:30
Peter H. Diamandis
Рет қаралды 104 М.
How to Run a ChatGPT-like AI on Your Raspberry Pi
11:46
Gary Explains
Рет қаралды 39 М.
ChatGPT Getting Worse: What You Can Do About It
9:00
NeuralNine
Рет қаралды 10 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 77 М.
Don't Use ChatGPT Until You Watch This Video
13:40
Leila Gharani
Рет қаралды 1,7 МЛН
DRM explained - How Netflix prevents you from downloading videos?
18:17
Mehul - Codedamn
Рет қаралды 216 М.