Skip to main content

SpeechGPT

PyPi License: MIT

A voice interface for OpenAI's ChatGPT 🎙

Credit to @terry3041 for pyChatGPT ❤️

Features

This package detects microphone input and coverts it to text using Google's Speech Recognition API. It then opens ChatGPT and inputs the recognized text using selenium.

It can be used with a wake word, and it can also use text to speech to repeat ChatGPT's answer to the query. These arguements are specified in the creation of the class (see Getting Started)

Getting Started

Installation

pip3 install speechgpt

or

git clone https://github.com/Jdka1/SpeechGPT

Then navigate to SpeechGPT/speechgpt/ and place the files in the same directory as your main.py file.

It is not uncommon that there are errors when installing pyaudio. If you are on macOS you may have to use homebrew to install portaudio.

Usage

Obtaining session_token

Follow these steps in @terry3041's README.md

Importing as a module

from speechgpt import SpeechGPT

session_token = "<__Secure-next-auth.session-token cookie from https://chat.openai.com/chat>"

bot = SpeechGPT(session_token=session_token) # Initializing the bot

bot.listen() # The bot will start listening and respond to whatever it is prompted with using ChatGPT

If the bot is initialized with a wake_word value then it will wait until it hears that phrase when bot.listen() is called, and then it will start listening.

If the bot is initialized with voice_on = True as an arguement, then it will use text to speech to play back ChatGPT's response.

# How to initialize SpeechGPT with wake_word and voice_on
bot = SpeechGPT(session_token=session_token,
                wake_word="wake up",
                voice_on=True)

.listen() only runs one cycle, so it needs to be put in a loop for it to answer more than one prompt

while True:
  bot.listen()

If the bot hears "quit" at any stage after .listen() is called then it will quit.

Disclaimer

This package is not affiliated with OpenAI in any way. Use at your own risk. I am not responsible for any damage or harm caused by this project. Please read OpenAI's Terms of Service before using this module.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for speechgpt 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speechgpt 0.1.3
File Size Uploaded
speechgpt-0.1.3.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for speechgpt 0.1.3
File Interpreter ABI Platform
speechgpt-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / speechgpt-0.1.3.tar.gz

Download URL speechgpt-0.1.3.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b8853b571a53b843a23fae237323b870469a0e46eaaf34fed938556d6a40e6e6
BLAKE2b-256 checksum
How to use checksums
04e0636563ff074e96c7b77ee63dae10762df4d3caaac3cc90c0bf20691ff1e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / speechgpt-0.1.3-py3-none-any.whl

Download URL speechgpt-0.1.3-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e1a71533fd110e77e7d80db8fc325fcf376cac8ed74a80d96a7db5f73cf13a0
BLAKE2b-256 checksum
How to use checksums
4b13e463f9846b694fce969ccf29d7b9b63d7a260abcd19b3854928312ab9aec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page