Purebasic and chat gpt (version 3.5)

Just starting out? Need help? Post your questions and find answers here.
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Purebasic and chat gpt (version 3.5)

Post by jak64 »

Good morning,
I would like, with purebasic, to ask a question to Chat gpt (version 3.5), and to be able to automatically save its answer in a text file.

For example, I would like to automatically launch with purebasic the question: "Who is the world record holder in the high jump?" and save gpt chat response to text file

I can not do it.

Thank you for your help.
User avatar
idle
Always Here
Always Here
Posts: 5839
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Purebasic and chat gpt (version 3.5)

Post by idle »

You can try this for gpt4all
https://dnscope.io/idlefiles/gpt4all_pb.zip

You will need to download the appropriate model from nomic.ai
Example runs a web server. But you can change it.
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Purebasic and chat gpt (version 3.5)

Post by jak64 »

Hello Idle,
I'll take a look at this and let you know.
Thank you and good day
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Purebasic and chat gpt (version 3.5)

Post by jak64 »

Hello Idle,
I don't understand the code.
I ran "gpt4all.pbi" and got the message "error file not found libllmodel.dll.a"!!!
User avatar
idle
Always Here
Always Here
Posts: 5839
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Purebasic and chat gpt (version 3.5)

Post by idle »

OK I will check later it's 1am I should get some sleep .
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Purebasic and chat gpt (version 3.5)

Post by jak64 »

Excuse me, here in France it's 3PM
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Purebasic and chat gpt (version 3.5)

Post by Kurzer »

Jak64,

in this second, I am also in the progress of checking Idles code.
The error come up, because u need to download and install a AI model from the web (https://gpt4all.io/index.html).
Scroll down to "Model Explorer", choose a model and click on the little arrow icon to download the model.
The files are > 3 GB!!!

Then you have to adjust line 277 in the purebasic file.
Enter the name of the model you have downloaded and copied into the directory where the pb code is located.

Code: Select all

path.s = GetPathPart(ProgramFilename()) + "ggml-gpt4all-j-v1.3-groovy.bin" 
I am still downloading the model file, so not sure, if it will run correctly after changing the path to the downloaded modelname.
I have to test all this for myself in the next minutes.

PS: This does not solve the problem for me. But maybe its caused by the x86 Version of PureBasic which I use at the moment. I am not using my standard Laptop, so I have only the x86 Version of PB availabe. :-/
Last edited by Kurzer on Sun Aug 27, 2023 2:16 pm, edited 1 time in total.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Purebasic and chat gpt (version 3.5)

Post by jak64 »

Hello Kurzer,
I don't have ChatGPT 4, only ChatGPT 3.5 (which is free).

I would just send a request to ChatGPT 3.5 and save its response to a text file.
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Purebasic and chat gpt (version 3.5)

Post by Kurzer »

GPT4All means not GPT4, it means "GPT for All"

Are you using PB x86 Version?
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Purebasic and chat gpt (version 3.5)

Post by jak64 »

No, i have Windows 11 Professional 64 bits and Purebasic 64 bits
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Purebasic and chat gpt (version 3.5)

Post by Kurzer »

okay, then the provided 'libllmodel.dll.a' file is the problem.
the dll does not support all needed symbols.

then we have to wait until idle has slept off. ;-)
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Purebasic and chat gpt (version 3.5)

Post by jak64 »

For example, I would like to send the question "What is the capital of the United States?" to ChatGPT with Purebasic and then save its response in a text file.

(See screenshot below)


Image
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Purebasic and chat gpt (version 3.5)

Post by Kurzer »

Unfortunately, I can't help you with that. ChatGPT is not executed correctly in the WebGadget of PB, so that an automatic filling of the input fields is not possible.

But ChatGPT offers an API that you can use (I've even seen code for it in PB here in the forum). but you need an API key for it. It costs money though, which is why I didn't bother with it further. I just wanted to play around with it and therefore didn't want to buy an API key.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
jak64
Enthusiast
Enthusiast
Posts: 619
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Purebasic and chat gpt (version 3.5)

Post by jak64 »

It doesn't matter, thank you anyway.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Purebasic and chat gpt (version 3.5)

Post by Caronte3D »

Maybe this post helps you:
viewtopic.php?t=81312
Post Reply