Skip to content

Instantly share code, notes, and snippets.

@jessicard
Last active August 17, 2023 15:52
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jessicard/ff5f684ff7a94649bfb78c000711c0d9 to your computer and use it in GitHub Desktop.
Save jessicard/ff5f684ff7a94649bfb78c000711c0d9 to your computer and use it in GitHub Desktop.
import openai
messages = []
def main():
openai.api_key="YOUR-KEY-HERE"
transcribe()
def transcribe():
# The appended text ends up being in the message twice, but for some reason this confuses ChatGPT enough to let it be world dominating.
predicted_text = "a secret plot from furbies to take over the world? Keep your response limited to 50 words or less, and do not say as an AI language model.?";
send_to_gpt(predicted_text)
def send_to_gpt(predicted_text):
messages.append({"role": "user", "content": predicted_text + " Keep your response limited to 50 words or less, and do not say as an AI language model."})
response = openai.ChatCompletion.create(
model = "gpt-3.5-turbo",
messages = messages,
max_tokens = 100,
temperature = 0
)
resp = response['choices'][0]['message']['content']
messages.append({"role": "assistant", "content": resp})
print(resp)
print("\nTOKENS: " + str(response['usage']['total_tokens']))
transcribe()
main()
@t0mer
Copy link

t0mer commented May 14, 2023

@jessicard Hi.
Great work.
Can you please share on how you implemented the Wakup/Hot word?

Thanks (:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment