Socket
Socket
Sign inDemoInstall

retico-chatgpt

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    retico-chatgpt

The chatgpt incremental module for the retico framework


Maintainers
1

Readme

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>

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc