Skip to content

Instantly share code, notes, and snippets.

View 0ut0flin3's full-sized avatar

0ut0flin3 0ut0flin3

View GitHub Profile

Google has an amazing free API endpoint for text completions ,

below are some examples of the completions I got and the python code to interact with the API

Star this gist if this was helpful to you. Enjoy text completions

user@linux:$ python3 google_text_completion.py
 > hackers are
hackers are watching you

In this short guide, I'll show you how you can make variables in your code accessible from GPT-3, then be modified based on GPT-3 responses.

In the guide below, Python will be used for examples, but the method can be used for any programming language.

So, let's say we have a Python variable called FLAG with value False, so FLAG=False. Let's imagine that we want the value of the FLAG variable to become True only if we ask GPT-3 for something specific, or rather, if GPT-3 will answer us with a certain sentence. To achieve this we must instruct GPT-3 to always respond in the exact same way if we dictate a specific request to it. For example, let's pretend that in our program there is a game mode called "hard mode" and that the FLAG variable should be False if it is off and True if it is on. We can simply tell GPT-3 to always respond with the string ::HARD_MODE_ENABLED:: if we ask it to enable "hard mode" and to always respond with the string ::HARD_MODE_DISABLED:: if we ask it to disable it

Keybase proof

I hereby claim:

  • I am 0ut0flin3 on github.
  • I am 0ut0flin3 (https://keybase.io/0ut0flin3) on keybase.
  • I have a public key ASCTbvGjveoqnRTDl2rN4PG2kOBt9o3XXzHM1w44T2Nb4Qo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am 0ut0flin3 on github.
  • I am fileghost (https://keybase.io/fileghost) on keybase.
  • I have a public key ASAgva96O20XYX47Kqtg-DjBwvr0qPW-9WQWjBQ8YBTJ8Qo

To claim this, I am signing this object: