How does one install and use the new LLMFunction described in Wolfram blog ?
-
6$\begingroup$ who ever downvoted this question, it will help to explain why and what is wrong with it? I honestly do not care about these cloud virtual points (if there is way to set my overall score to be always zero at stackexchange, I will do it right now). But I would like to know why the downvote for? Is it because you do not like others to know how to use this Wolfram function? I find this very strange behavior as I see nothing wrong with this question. $\endgroup$– NasserCommented May 27, 2023 at 2:04
-
1$\begingroup$ Related question (now for 13.3): I need to change the openAI account. How does one get Mathematica to close the old connection so that I can log onto a different (and functional) openAI account? $\endgroup$– John BechhoeferCommented Jun 29, 2023 at 3:48
-
$\begingroup$ I did not have to do anything in V 13.3, it just worked as is. I did not have to login to openAI or anything. Here is screen shot !Mathematica graphics if you having problem using this in V 13.3, I would suggest posting separate question on this as the above question applies to the V 3.2.1 using paclet install which is no longer applies to V 13.3 I'll add a note to my answer on this. $\endgroup$– NasserCommented Jun 29, 2023 at 4:55
-
$\begingroup$ I think your openAI key expires automatically after some period of no use. But I am not sure. If you changed your openAI account, I assume you can just use the new account to get key? Or just use Wolfram cloud account. That does not requires you to login to openAI from what I found. $\endgroup$– NasserCommented Jun 29, 2023 at 6:16
-
$\begingroup$ No, of course it does not expire. Why would it? Password does not... $\endgroup$– Валерий ЗаподовниковCommented Jun 29, 2023 at 6:50
3 Answers
Update for V 13.3
I found I had to do nothing in V 13.3 to use LLMFunction
. It just connects to openAI directly and does not ask for any key. Here is movie showing that.
But, and this is important, I was logged into my Wolfram account when I did the above. i.e. I had signed in using this
When I signed out from Wolfram cloud, then it will not work any more and now it asks for key as before from openAI:
So if you do not want to deal with getting a key each time and having to login to openAI, you have to be logged into your Wolfram cloud account first. Once you are logged into Wolfram cloud account, you will remained logged, and when you restart Mathematica, it will automatically login again without you asking to login each time.
If anyone having problem using LLMFunction
in V 13.3 may be separate question will be better.
Original answer
Currently LLMFunction is installed via paclet. In V 13.3 it will be build in.
Step 1
PacletInstall["Wolfram/LLMFunctions"]
Step 2
The very first time, when you issue the first LLMFunction
command, you will get this pop-up menu
If you do not see the above, then run PacletUninstall["Wolfram/LLMFunctions"]
, exit Mathematica, and open Mathematica again and try again to install it again. The pop-up menu will show up only first time after installation, and only after issuing the very first LLMFunction
. It will not show up automatically after just installing the paclet. You must issue an LLMFunction
command to see it.
Here is small movie showing the above
Step 3
Now login to your openAI account. (click on Go to OpenAI
button above) I used my google login. i.e. I was logged into google before doing all the above.
Now under your settings at top right corner, you will see View API keys
.
Step 4
Click on that and then click on Create new secret key
step 5
Now a pop-up menu will show up asking you to enter some text. Then click on create secret key
step 6
Copy the key generated (by clicking on the little icon on the right of the key, to copy it to buffer) which will show up after the above step and paste into the pop-up menu that Mathematica have opened above. Then click I agree on conditions,and click on Done button.
step 7
Now you can use LLMFunction
The above was done on Version 13.2.1 on windows 10.
-
1$\begingroup$ Even though I am logged into my Wolfram account,
LLMFunction
will not work for me usingv13.3
. I get an "exceed quota" error, suggesting lack of API credentials? $\endgroup$– gwrCommented Jun 29, 2023 at 14:03 -
1$\begingroup$ It now works, after I upgraded my API plan with OpenAI (my free trial period had elapsed). I guess that the credentials were copied from your earlier version? I believe that you need to have valid API credentials with OpenAI and it has nothing to do with your Wolfram account. $\endgroup$– gwrCommented Jun 29, 2023 at 15:55
-
1$\begingroup$ @gwr But I have valid openAI account. At least last time I used it via google account. But when I am not logged into Wolfram cloud first, it asks for key as you see from the above movie. When I am logged into Wolfram account, it does not ask for key. Anyway, this is all confusing to me. I never like to use things that needs keys and login and so on. I am not going to spend time programming something based on me having an account or key or enough quota or be connected to the internet for my program to work. I want to know that my program works and runs anytime and anywhere. But that is just me. $\endgroup$– NasserCommented Jun 29, 2023 at 18:56
-
$\begingroup$ May be in a future version of Mathematica, they will have chatGPT buildtin Wolfram itself directly. i.e. as linked to library as part of Mathematica executable. But may be this is not possible, unless WRI buys out openAI. $\endgroup$– NasserCommented Jun 29, 2023 at 18:59
-
1$\begingroup$ This answer does not work for me in Mathematica 14.0, logged into my Wolfram account but without OpenAI credit. I get the message "ServiceExecute::apierr: The service returned the following error message: The model
gpt-4
does not exist or you do not have access to it." $\endgroup$– divenexCommented Jan 11 at 19:01
How to use the new LLMFunction?
The following Community post "Workflows with LLM functions" has a notebook with different use case examples worked out.
I can't uninstall the LLM paclet. I get the following error. I have the paid version of ChatGPT and I get the same annoying message that I have exceeded my current quota.
-
$\begingroup$ Generally, Paclets consist of code etc. stuffed into a directory/folder. You can manually move/rename the entire paclet without invoking any Mathematica code if need be. I'd recommend moving it to a new location (or simply rename it) and verify that you didn't break anything before deleting it completely, to be on the safe side. $\endgroup$– user87932Commented Jun 30, 2023 at 2:22
-
1$\begingroup$ if you using V 13.3 then no need to use paclet as LLMFunction is now builtin. If you using earlier version, then I am not sure as I have not seen this error before myself. Either follow advice by jdp or may be post separate question on this problem. $\endgroup$– NasserCommented Jun 30, 2023 at 6:05
-
2$\begingroup$ Note that a paid ChatGPT plan is different from a paid API plan. I had that issue (exceed quota) and only after establishing a means for payment for an API plan did it work out. $\endgroup$– gwrCommented Jun 30, 2023 at 13:44
-
2$\begingroup$ Thank you all. I have resolved the issue. As @gwr explained without paying for direct access to the API you cannot use this function. I thought that having ChatGPT Plus gave me that access, but it a completely different service. $\endgroup$ Commented Jun 30, 2023 at 15:25