I’ve tried this out in WolframCloud on my iPad and some of the featured described here do not work:
- Although
Shift-| bgives a text completion cell there is no cell icon to the left (I assume an issue with Stylesheets for cloud notebooks) - Setting
OpenAIInputExecuteToImagedoes not generate images ResourceFunction["MermaidJS"]is not on the WFR.
Thanks for trying this paclet out!
I will respond to your observations list in the same order:
-
I have seen this “behavior” for some of my other “mode” notebook styles (on iPadOS.)
-
I can generate images with that cell on macOS.
I will have to experiment with it on iPadOS. (Later today, this week…) -
ResourceFunction["MermaidJS"]uses Command Line Interface of Mermaid-JS (that has to be installed on the hosting OS.) Because of this I consider making a paclet for MermaidJS.-
The Mermaid diagram spec (in the notebook) can be pasted in https://mermaid.live – that will produce the corresponding image(s).
-
There is resource function submission “MermaidInk” that uses the online interface. (Much more lightweight than “MermaidJS”.)
- For some reason(s) has not been published yet – I will follow up on the status. (Again, later today, this week.)
- Here is resource object that can be used in the meantime: “MermaidInk”.
-
ResourceFunction[
CloudObject[
"https://www.wolframcloud.com/obj/antononcube/DeployedResources/Function/MermaidInk"]]["
graph TD
WL --> |ZMQ|Python --> |ZMQ|WL
"]
Do I need to give it my OpenAI API? If so, how?
Thank you for interest in this paclet!
Do I need to give it my OpenAI API?
I assume you mean your OpenAI API authorization token. Then the answer is yes.
Generally, it is assumed that the installation and setup steps of “OpenAILink” have been completed. (Before using “OpenAIMode”.)
If so, how?
Here is one way (to do the complete setup):
PacletInstall["ChristopherWolfram/OpenAILink"]
Needs["ChristopherWolfram`OpenAILink`"]
PacletSymbol[
"ChristopherWolfram/OpenAILink",
"ChristopherWolfram`OpenAILink`$OpenAIKey"] = "<YOUR API KEY>";
SystemCredential["OpenAIAPI"] = "<YOUR API KEY>";
PacletInstall["AntonAntonov/OpenAIMode"]
Needs["AntonAntonov`OpenAIMode`"]
– you have earned Featured Contributor Badge ![]()
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!
Thank you for the recognition, Moderation Team!
Thank you very much Anton. This is great!
I’m having a problem installing the paclet. After step 3:
PacletSymbol["ChristopherWolfram/OpenAILink",
"ChristopherWolfram`OpenAILink`$OpenAIKey"] = "KEY";
I get the following error:
"“Tag PacletSymbol in !(PacletSymbol["ChristopherWolfram/OpenAILink
", "ChristopherWolframOpenAILink$OpenAIKey"]) is Protected.”
You seem to have a problem with setting up “OpenAILink”.
Maybe you have to restart the kernel and re-evaluate?
Nice job.
I would like to try to set the model to “gpt-3.5-turbo”
But I get this error: Request to the OpenAI API failed with message: This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?
It seems to be a problem with OpenAILink, however that code appears to check if that is the proper API. Any suggestion?
Thank you for your interest in this paclet!
OpenAI completions are of two kinds: text completions and chat completions.
From my (recent) experiments, I know that text completions cannot be done with chat-models, and vice versa.
The problem you have – with “OpenAILink” – is that OpenAIMode`OpenAIInputExecuteToText uses ChristopherWolfram`OpenAILink`OpenAITextComplete.
In order to “fix” this in “OpenAILink” I can make OpenAIInputExecuteToText take an evaluator function. (Which, by the way, the underlying function OpenAIInputExecute does.) To a large extend I introduced that level of indirection to resolve these kind of problems.
I have to think about a proper design, though. OpenAIChatComplete takes chat message objects, so, they have to be specified too.
Please see the attached notebook.
OpenAIMode-LB-model-specs-question.nb (74.5 KB)
Here is a related discussion on streamlining code generation and execution:
“OpenAIMode code generation demo” .
Anton, thank you.
That works! Of course it takes a long time to get the answer, because it needs to complete.
Has anyone looked into implementing “Stream” , which maybe we can manage with a Dynamic, until we get the [Done]…
Well, I experimented with the “stream” parameter utilization, but using the Raku package “WWW::OpenAI”,
not the WL paclet
“OpenAILink”.
With “stream” I get a string that is not a “correct” JSON – it is a string of concatenated JSON key-value pairs. It can be worked with, of course, but the implementation in “OpenAILink” might take a non-trivial effort.
Here is a screenshot showing one of my Raku experiments:
Hi
this mode is awesome. I’m wondering if we could improve it so that it keeps the chat session i.e. does not lose context. Maybe a session could be grouped together into a cell group.
this mode is awesome.
Thank you, good to hear!
Please start using the CellPrint* functions (if have not already.)
I’m wondering if we could improve it so that it keeps the chat session i.e. does not lose context. Maybe a session could be grouped together into a cell group.
That is a good idea.
I think we can do the following:
- Facilitate persistence storage of session queries.
- For example using suitable function(s) given to the option
Epilog.
- For example using suitable function(s) given to the option
- Restore those messages in a new session and make a Chat completion sequence of messages.
Remark: I introduced a third, Chat completion cell in “OpenAIMode” in version 0.1.9. (Yesterday.)
Yesterday – in version 0.1.9 – I added another type of cell, a chat completion cell, that has pale yellow background.
That cell has the evaluator function OpenAIInputExecuteToChat which uses the “OpenAILink” function OpenAIChatComplete.
OpenAIInputExecuteToChat takes all options of OpenAIChatComplete, and the option Epilog.
Thanks.
My interest is in creating a new kind of online learning experience. See here
Actually, the notebook interface would be a better fit.
Maybe we could merge our efforts?
Interestingly, the post at reddit/r/OpenAI I made about “OpenAIMode” was removed:
Any insights why was that done, would be appreciated! ![]()
maybe they think you’re promoting yourself ?


