The chatgpt incremental module for the retico framework
Project description
retico-chatgpt
A module that uses OpenAI's GPT-3 to generate responses to user input incrementally.
Example
import retico_core
import retico_wav2vecasr
import retico_chatgpt
import dotenv
dotenv.load_dotenv()
INSTRUCTIONS = """You are an AI assistant that is an expert in alcoholic beverages.
You know about cocktails, wines, spirits and beers.
You can provide advice on drink menus, cocktail ingredients, how to make cocktails, and anything else related to alcoholic drinks.
If you are unable to provide an answer to a question, please respond with the phrase "I'm just a simple barman, I can't help with that."
Please aim to be as helpful, creative, and friendly as possible in all of your responses.
Do not use any external URLs in your answers. Do not refer to any blogs in your answers.
You are interacting with spoken words. Be very brief and do not format your responses.
Do not use dashes in lists, and do not use any other formatting.
Write out numbers as words, for example use "one" instead of "1".
"""
mic = retico_core.audio.MicrophoneModule()
asr = retico_wav2vecasr.Wav2VecASRModule(language="en")
chatgpt = retico_chatgpt.ChatGPTDialogueModule(system_prompt=INSTRUCTIONS)
printer = retico_core.debug.TextPrinterModule()
mic.subscribe(asr)
asr.subscribe(chatgpt)
chatgpt.subscribe(printer)
retico_core.network.run(mic)
print("Network is running")
input()
retico_core.network.stop(mic)
For this example, either the environment variable OPENAI_API_KEY
needs to be set or a .env
file needs to be present in the current working directory with the following content:
OPENAI_API_KEY=<your-openai-api-key>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
retico-chatgpt-0.0.1.tar.gz
(8.9 kB
view details)
File details
Details for the file retico-chatgpt-0.0.1.tar.gz
.
File metadata
- Download URL: retico-chatgpt-0.0.1.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6699a6d77b6c504efd95c4ace67e70c51afef6a723a45dd2c7c0f5d2205d706 |
|
MD5 | 8aa5ddb3668b2cc50c1575971bef353c |
|
BLAKE2b-256 | 5272abf25a95e42d96035d71c541f2c69074121f4ff8ce02fc321936324ad3f8 |