Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a new service connection
ResourceFunction["CreateServiceConnectionPaclet"][params] creates a paclet to add a new service connection using params. |
"ServiceName" | the name of the new connection |
"RawRequests" | the low-level requests to the API |
"ProcessedRequests" | higher level requests |
"ParameterMap" | parameter renaming |
"ParameterVerification" | rules to validate parameters in processed requests |
"ParameterProcessing" | how to post-process the parameters in processed requests |
"AsynchronousParameter" | which raw parameter is used to trigger server-event streaming |
"TermsURL" | URL to the API ToS page |
"KeyURL" | URL to create/fetch an API key |
"URL" | the endpoint address |
"HTTPSMethod" | method to use for the HTTPS request |
"Parameters" | full list of endpoint parameters |
"RequiredParameters" | required parameters |
"PathParameters" | parameters used to define "URL" |
"Headers" | request headers |
"ResultsFunction" | function to parse the results |
"RawRequest" | function to perform the request |
"Parameters" | parameters given as an option list |
"PreprocessingFunction" | how to pre-process the parameters |
"PostprocessingFunction" | how to post-process the response |
Authentication | None | API authentication scheme |
OverwriteTarget | False | whether to overwrite previously defined paclets |
Define a new service connection:
In[1]:= |
In[2]:= |
Out[2]= |
The service is ready to be used:
In[3]:= |
Out[3]= |
Create a new connection:
In[4]:= |
Out[4]= |
Perform a request:
In[5]:= |
Out[5]= |
Create a connection specifying the request parameters:
In[6]:= |
In[7]:= |
Out[7]= |
Connect:
In[8]:= |
Out[8]= |
Make the request passing the parameter values:
In[9]:= |
Out[9]= |
Visualize the result:
In[10]:= |
Out[10]= |
Define a custom connection to the OpenAI API:
In[11]:= |
Specify how to pass the API key:
In[12]:= |
Define a POST request:
In[13]:= |
Define a processed request to parse the result automatically:
In[14]:= |
Create the paclet:
In[15]:= |
Out[15]= |
Connect:
In[16]:= |
Out[16]= |
User the API to compute a string embedding:
In[17]:= |
Out[17]= |
Compare with the processed request:
In[18]:= |
Out[18]= |
Wolfram Language 14.0 (January 2024) or above
This work is licensed under a Creative Commons Attribution 4.0 International License