Skip to main content

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>

Metadata

Release files for retico-chatgpt 0.0.1

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

Source distribution (sdist)

Source distribution for retico-chatgpt 0.0.1
File Size Uploaded
retico-chatgpt-0.0.1.tar.gz 8.9 kB Details

Release files / retico-chatgpt-0.0.1.tar.gz

Download URL retico-chatgpt-0.0.1.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f6699a6d77b6c504efd95c4ace67e70c51afef6a723a45dd2c7c0f5d2205d706
BLAKE2b-256 checksum
How to use checksums
5272abf25a95e42d96035d71c541f2c69074121f4ff8ce02fc321936324ad3f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

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