AntonAntonov/OpenAIMode

(1.0.5) current version: 1.1.3 »

Notebook style with cells for execution of OpenAI commands

Contributed by: Anton Antonov

Notebook style with cells for execution of OpenAI commands based on the paclet OpenAILink.

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall["AntonAntonov/OpenAIMode"]


To load the code after installation, evaluate this code:
Needs["AntonAntonov`OpenAIMode`"]

Details

It assumed that the user of this paclet has successfully completed the setup instructions of the paclet OpenAILink.
The notebook style of this paclet is based on the paclet OpenAILink.
Two types of cells are provided: one for text completion, the other for image generation.
The function OpenAIMode can be used to enable and disable the notebook style.
The shortcut "Shift-|" can be used to create an OpeanAI text completion cell.
Using "Tab" the beginning of the text completion cell will convert the cell into an OpenAI image generation cell.
The text completion cell has faint green background; the image generation cell has faint purple background.

Examples

Basic Examples (1) 

Enable the current notebook to have OpenAI interaction cells:

In[1]:=
OpenAIMode[]

Another OpenAIMode[] invocation converts the notebook into the default notebook style. More explicitly the styling can be specified with OpenAIMode[True] or OpenAIMode[False].

OpenAIMode can also take notebook objects as arguments.

Scope (5) 

The text completion cell uses the evaluation function OpenAIInputExecuteToText. which takes all options of ChristopherWolfram`OpenAILink`OpenAITextComplete. Desired option values can be set using SetOptions:

The text completion cell uses the evaluation function OpenAIInputExecuteToImage. which takes all options of ChristopherWolfram`OpenAILink`OpenAICreateImage. Desired option values can be set using SetOptions:


The function OpenAIMode takes the options "TokenLimit" and ImageSize the values of which are used to do default options settings for OpenAIInputExecuteToText and OpenAIInputExecuteToImage respectively. For example, the command:

is equivalent to the sequence of commands:


The functions OpenAIInputExecuteToText and OpenAIInputExecuteToImage are just simple wrappers of the function OpenAIInputExecute.


The paclet provides the functions CellPrintWL and CellPrintAndRunWL that allow generated code to be printed and executed. Again, SetOptions used to change the epilog of the function OpenAIInputExecute:


Here is a screenshot of a notebook with the notebook style OpenAIMode applied:

Publisher

Anton Antonov

Compatibility

Wolfram Language Version 13.2

Version History

  • 1.1.3 – 30 June 2023
  • 1.1.2 – 27 May 2023
  • 1.1.1 – 13 April 2023
  • 1.1.0 – 13 April 2023
  • 1.0.9 – 10 April 2023
  • 1.0.8 – 09 April 2023
  • 1.0.6 – 08 April 2023
  • 1.0.5 – 08 April 2023
  • 1.0.4 – 04 April 2023
  • 1.0.3 – 03 April 2023
  • 1.0.2 – 02 April 2023
  • 1.0.1 – 02 April 2023
  • 1.0.0 – 02 April 2023

License Information

MIT License

Paclet Source

Source Metadata

See Also