Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate the definition of a symbol using natural language
ResourceFunction["SummarizeDefinition"][symbol] explains the definition of symbol using natural language. | |
ResourceFunction["SummarizeDefinition"][symbol,fmt] formats the summary in a format specified by fmt. |
None | do not apply any formatting to the summary string |
Automatic | automatically format inline code delimited with "`" characters |
"TextCell" | gives a Cell with automatic formatting applied that can be inserted into a notebook |
"OpenAIKey" | SystemCredential["OPENAI_API_KEY"] | the API key used to authenticate requests with OpenAI |
"Model" | "text-davinci-003" | the OpenAI language model used to generate summary text |
"MaxTokens" | 2048 | maximum number of tokens to use |
Explain what a function does using natural language:
In[1]:= | ![]() |
In[2]:= | ![]() |
Out[2]= | ![]() |
Please document my function for me:
In[3]:= | ![]() |
Out[3]= | ![]() |
Summarize the definition of a ResourceFunction:
In[4]:= | ![]() |
Out[4]= | ![]() |
Do not apply any formatting to the result:
In[5]:= | ![]() |
Out[5]= | ![]() |
Format as a text cell:
In[6]:= | ![]() |
PartyParrot is a Wolfram Language function that retrieves data about various Party Parrots from an external source. It can be used with or without arguments. When called without arguments, it will return a list of all the Party Parrot names. When called with a single argument - the id of the Party Parrot - it will return the simple animation associated with that Party Parrot.
Summarize the definition of a PacletSymbol:
In[7]:= | ![]() |
Out[7]= | ![]() |
Specify the OpenAI API key to authenticate requests with:
In[8]:= | ![]() |
In[9]:= | ![]() |
Out[9]= | ![]() |
Save the API key persistently using SystemCredential:
In[10]:= | ![]() |
This key is now used by default:
In[11]:= | ![]() |
Out[11]= | ![]() |
Specify an alternate language model:
In[12]:= | ![]() |
Out[12]= | ![]() |
GPT-4 tends to yield more detailed responses, but is much slower than other models:
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
Some models require a smaller number of tokens:
In[15]:= | ![]() |
Out[15]= | ![]() |
Specify a smaller value:
In[16]:= | ![]() |
Out[16]= | ![]() |
SummarizeDefinition has the attribute HoldFirst, so it can be used on symbols defined with OwnValues:
In[17]:= | ![]() |
In[18]:= | ![]() |
Out[18]= | ![]() |
SummarizeDefinition is not deterministic:
In[19]:= | ![]() |
In[20]:= | ![]() |
Out[20]= | ![]() |
Symbol names have a significant influence on the result. Here are two equivalent definitions that only differ in name (the definition is from the resource function StupidSort):
In[21]:= | ![]() |
SummarizeDefinition is far more likely to mention that StupidSort is inefficient:
In[22]:= | ![]() |
Out[22]= | ![]() |
In[23]:= | ![]() |
Out[23]= | ![]() |
Well-named symbols will often lead to higher-level explanations:
In[24]:= | ![]() |
In[25]:= | ![]() |
Out[25]= | ![]() |
In[26]:= | ![]() |
In[27]:= | ![]() |
Out[27]= | ![]() |
SummarizeDefinition includes dependent symbol definitions:
In[28]:= | ![]() |
In[29]:= | ![]() |
Out[29]= | ![]() |
SummarizeDefinition will not work without an OpenAI API key:
In[30]:= | ![]() |
In[31]:= | ![]() |
Out[31]= | ![]() |
In[32]:= | ![]() |
In[33]:= | ![]() |
Out[33]= | ![]() |
System symbols are not supported:
In[34]:= | ![]() |
Out[34]= | ![]() |
Symbols cannot have the ReadProtected attribute:
In[35]:= | ![]() |
In[36]:= | ![]() |
Out[36]= | ![]() |
Some models can occasionally return an empty response:
In[37]:= | ![]() |
Out[37]= | ![]() |
Some are just not suitable for this particular task:
In[38]:= | ![]() |
Out[38]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License