Openai (ChatGPT) from PB
Re: Openai (ChatGPT) from PB
Try to create an APIkey with a free account, I think in the past it was possible (don't know actually).
Re: Openai (ChatGPT) from PB
Yoiu are welcome!!jak64 wrote: Mon Aug 28, 2023 12:14 pm Thanks for the info Ricardo.
Have a nice day (even if the Argentinian beat France at football, I'm French)![]()
That was a very nice soccer game!!
ARGENTINA WORLD CHAMPION
Re: Openai (ChatGPT) from PB
Hello Ricardo,
Indeed, good game.
See you soon
Indeed, good game.
See you soon
Re: Openai (ChatGPT) from PB
Hi,
I tried it...
How long does it take to get an answer ?
It very very slow... more than 10 minutes !!
Can we get the answer letter by letter like in chatgpt instead of the whole long one ?
I tried it...
How long does it take to get an answer ?
It very very slow... more than 10 minutes !!
Can we get the answer letter by letter like in chatgpt instead of the whole long one ?
There are 2 methods to program bugless.
But only the third works fine.
Win10, Pb x64 5.71 LTS
But only the third works fine.
Win10, Pb x64 5.71 LTS
Re: Openai (ChatGPT) from PB
}Fig wrote: Tue Nov 14, 2023 9:22 pm Hi,
I tried it...
How long does it take to get an answer ?
It very very slow... more than 10 minutes !!
Can we get the answer letter by letter like in chatgpt instead of the whole long one ?
Now you can connect using
Code: Select all
sModel.s = "gpt-3.5-turbo-1106"
You receive a JSON with the response.
The only problem is that, as happens with ChatGPT, you may receive uncertain information and that often does not follow the prompt instructions to the letter.
You can also use
Code: Select all
sModel = "dall-e-3"
In the dall-e-3 model you will receive also a JSON response with the url of the image created.
ARGENTINA WORLD CHAMPION
Re: Openai (ChatGPT) from PB
Here is the code for generate images.

Code: Select all
Procedure.s SendPrompt(sPrompt.s)
sUrl.s = "https://api.openai.com/v1/images/generations"
NewMap Header$()
Header$("content-type") = "application/json"
Header$("Authorization") = "Bearer YOURAPIKEY "
nMaxTokens.l = 5000
sModel.s = "dall-e-3"
sNumberOfResponses = 1
sTemperature.f = 0.9
sBody.s = "{"
sBody.s = sBody.s + Chr(34) + "model" + Chr(34) + ": " + Chr(34) + sModel + Chr(34) + ", "
sBody + Chr(34) + "prompt" + Chr(34) + ": " + Chr(34) + sPrompt + Chr(34) + ", "
sBody.s + Chr(34) + "n" + Chr(34) + ": " + Str(sNumberOfResponses) + ", "
sBody + Chr(34) + "quality" + Chr(34) + ": " + Chr(34) + "hd" + Chr(34) + ", "
sBody + Chr(34) + "size" + Chr(34) + ": " + Chr(34) + "1024x1024" + Chr(34)
sBody.s + "}"
; Debug sBody
Define httpReq
httpReq = HTTPRequest(#PB_HTTP_Post, sUrl, sBody, 0, Header$())
If httpReq
Response$ = Trim(HTTPInfo(httpReq, #PB_HTTP_Response))
Debug Response$
EndIf
EndProcedure
lKeyword$= "Create and hipperrealistic image of a cat in the floor of a beautiful kitchen drinking milk in the sunsent hour HD"
SendPrompt(lKeyword$)

ARGENTINA WORLD CHAMPION