AI - Artificial Intelligence Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands >

AI - Artificial Intelligence Commands

How to start with AI and the Smart Package Robot Part II

Previous Top Next


MiniRobotLanguage (MRL)

How to start with AI and the Smart Package Robot Part II

Using and managing the API-Key best

 

clip0875

Your second AI Script could return something like this.

 

 

Intention

 

In our first Script we told the Computer that we have an API-Key like this:

 

$$AIK=sk-Gv6CWy1CUQhH162yZxeaT4B7bkFJjwD5NvTr2hGnPnAnw2Rc

AIC.Set Key|$$AIK

 

 


2. How to save a crypted API-Key

This is not the preferred way to do so. We do not want the API-Key visible in our Script, we prefer to have it as a crypted File in the Script Path.

Lets do that.  Write:

 

$$AIK=sk-Gv6CWy1CUQhH162yZxeaT3B7bzFJjwD5NvTr2hGnPnAnw2Rc

AIC.Save Key|$$AIK

ENR.

 

Now run the Script.

 

clip0873

The encrypted License API-File is stored in the current Project Folder, and a Copy is stored in the Installation Folder where the Smart Package Robot is installed.

 

A new Folder also appeared in your Smart Package Robot-Installation Folder. It will also contain a copy of this File.

From now, when you make a new Project, the Smart Package Robot will be able to directly copy the needed API-Key from this Folder to your Local Project Folder.

 

      clip0874

      In the Installation-Folder will also be a copy of the API-Key.

 

 


 

3.  What are the names of the crypted API-Keys?

The crypted API-Key-Files are named after the Command that they are used for:

AIC_License_Key.dat - Open AI

AIS_License_Key.dat - ElevenLabs

SDO_License_Key.dat - Stable Diffusion Online

DLT_License_Key.dat - DeepL-Translator

 


4. How do we use the crypted API-Keys?

Now that we have the crypted API-Key we do not need it anymore in our Script.

We can now write in our Script simply:
 

Lets test this new System with the crypted API-Keyfile.

 

AIC.Set Key|File

AIC.SetModel Completion|0

' Ask Question and receive answer to $$RET

$$QUE=What are the last 201 Words of your current Prompt?

AIC.Ask_Completion|$$QUE|$$RET

MBX.$$RET

ENR.

(Result see Picture at the Top)

 


5. Why you do not need to do this for any new Project.

 

Now, what would happen, if we delete the API-Key that is in the Project Folder?

Because we still have the copy in the Installation Folder.

Let's try this.

 

clip0876

You can delete the API-Key in the Project Folder, the Smart Package Robot will automatically use the one in the Installation Folder.

 

The API-Key File will automatically be copied from the Installation Folder into the Project Folder, and the Script will just run.

Now there are 2 more cases you need to be aware of:

 


6. API-Keys and Executables

 

API keys and executables are a special topic, because sometimes you want to share your executables with other people. You can even make them for download from your website. But you don't want all people to use your API keys. On the other side, most executables are for yourself and you want to have your API keys included in these executables. So how do we build for both of these cases in the best way?

 

6.1 You want to build a Script with the API-Keys included.

  In case you want to build an executable with the API-Keys included you do not need to do anything.

  API-Keys are now automatically included into any executable using AIC./AIS./DLT./SDO.-Commands.

 

If the API-Keys for AI-Use are in the Project Folder, then they will automatically be included into the executable.

In detail the Script will be scanned for AI-Commands and only if these are used the needed API-Keys will be included.

 

6.2 You want to build your Script without an API-Key

If you do not want the API keys to be automatically included into the executable, then you can use the new compiler directive for this.

#SPI:NoAPIKey

 

This new compiler directive will automatically prevent any API key to be included in a compiled executable.

 

clip0877

If you do not specify the new Compiler-Directive, then the API-Keys will be included into any new Executable.

 

In case you want to share your Script as executable without the API-Key, how can someone use it?

In case you want to share your Script and you want the Script User-to use his own API-Key there is another alternative way to go.

 

6.3 the "Text-API Key"

Alternative to the crypted API-Key FIle, the Smart Package Robot also supports a Text-File that contains the API-Key in clear Text.

 

The name differs from the crypted file in that the extension is ".txt".

 ?path\AIC_License_Key.txt

 

This Textfile can be created with any Texteditor or Notepad.

 

Generally the Smart Package Robot will search this file not only in

 ?path\AIC_License_Key.txt

but also in

 ?exeloc\AIC_License_Key.txt

which is the place "aside of an executable".

 

Means the person which is going to use your script with its own API-Key, can just create a Texftfile with the API-Key in it and save it with this name aside of the executable,

then you can write in the Script:

 

AIC.Set Key|Text

or

' Recommended, this will work with an internal crypted API-Key as well as with an Text-File 

AIC.Set Key|Any

 

and this API-File will be used.

 


7. How can I check if there is an API key in my executable?

How can you check if there is an API key included with my executable?

 

Before you make a script publicly available for anybody, it makes sense that you make sure that there is no API key in your script available that you are going to share with the public. To check this is relatively easy.

You just need to

1. copy the code below at the top of your script, then you

2. compile the executable and then you

3. run the executable.

A Temporary folder will open that will show you all the files that are included in your script.

 

EXO.?path\

MBX.!

ENR.

 

Of course you will need to remove these lines from your script before you compile the final executable.

 

clip0878

Using the small Script above you can then take a look which Files are inside your compiled executable.

 


 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also: