Is it possible somehow, through webget or something else, to interact with the API from ChatGPT (GPT-3), I need this in order to make a conversation with a virtual friend on the server, and not only for this, I can do this ?, there are just a few examples for python, and there is authorization through the site, but I still could not do anything, I decided to ask here.
Yes; You can use OpenAI's API endpoint using the
command to interact with your server as a virtual friend. What you would need is to have basic understanding of making web requests and understanding the basics of JSON structures.
Per their documentation, this is where you want to reference first:
An API for accessing new AI models developed by OpenAI
You can obtain an API key here, if you haven't already:
You can define your
command simply like this:
- definemap headers:
For more information on SecretTags such as the example used above
, you can reference this part of the meta for setting yours up:
It's very important you never reveal your OpenAI API Token
Tag search for 'secret'
, or to have it written blatantly in your script to be saved in ram. Using a SecretTag allows you to properly secure your token.
is going to be where your prompt goes, here's a simple example:
- definemap data:
prompt: Tell me a joke!
This example uses the
model. You can learn more about the other models available Here
command will look something like this:
~webget <> data:<[data]> headers:<[headers]> save:response
in which, you use your save argument to get the
result, which you can parse using a tag like the yaml parsing tags
You can use
to determine if the response failed, or not.
You can use
to return the response that resulted from the web request.
I've actually created a Denizen script that implements this into Discord using dDiscordBot
if you'd like a working example.
You should also find better help and support on our Discord
- my username is
if you have questions specifically about my script, but we can help you better there.
Hope this helps.
Edit: fixed my formatting, added a tiny bit more info