Last active
August 17, 2023 15:52
-
-
Save jessicard/ff5f684ff7a94649bfb78c000711c0d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jessicard Hi.
Great work.
Can you please share on how you implemented the Wakup/Hot word?
Thanks (: