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

Previous Top Next


MiniRobotLanguage (MRL)

How to start with ChatGPT (Open AI)

Use AI's in your Script

 

clip0883

This is the result of using ChatGPT in our Script.

 


 

1. Using the fast and Simple "Completion Endpoint" with GPT-3.5

We can just start and write:

 

Using AI with the Smart Package Robot is now very simple. I assume that you have already saved your API-Keys.

Lets use ChatGPT to get an variable List of Phrases for a Vocabulary Program (see the complete program in the next chapter).

 

AIC.Set Key|File

 

VIN.$$NUM=10

$$LAN=Spanish

$$TAL=english

' Difficulty

$$DIF=1 to 3

 

$$PRO=I want to learn a new language that is $$LAN 

$$PRO+ I want you to teach me the $$NUM most used Phrases in $$LAN 

$$PRO+ First make a list with the $$NUM most used phrases, each phrase of at least $$DIF words.

$$PRO+ The format of the list should be like this:  "¿De dónde eres?,Where are you from?"

$$PRO+ The first part before the comma is in $$LAN the second part after the comma is in $$TAL$crlf$

$$PRO+ Do not write variables: "Soy de [país]. (I'm from [country].)"

$$PRO+ instead write real words like "Soy de Germania.,I'm from Germany."

 

AIC.SetModel Completion|0

' Ask Question and receive answer to $$RET

AIC.Ask_Completion|$$PRO|$$RET

MBX.$$RET

 

ENR.

 

Now run the Script and see if you also get such a result.

You can then change the Prompt to get an idea of what is possible.

 

In the Script above we have used the so called "Completion Endpoint" that will only support GPT 3.5 at this time.

 


 

2. Using the Chat-Completion Endpoint and GPT-4

We can also use GPT-4.

 

The Smart Package Robot also supports the Chat-Endpoint that supports GPT-4.

Lets change the Script to use the Chat-Endpoint.

 

' we need to use another Model and another command to define the model

AIC.SetModel_Chat|1

 

' Ask Question and receive answer to $$RET

AIC.Ask Chat|$$PRO|$$RET

MBX.$$RET

 

ENR.

 

clip0884

This time the generation of the answer took longer and we used GPT-4. Which is overkill for such simple tasks.

 

 


 

3. Advanced Tasks using the ChatGPT-4

We can also use GPT-4 for advanced tasks.

 

The Smart Package Robot also supports the Chat-Endpoint that supports GPT-4.

However the power of this Command set is in the option to specify a "previous dialog".

This also gives you the chance to specify the format of the output in some way.

Lets do that.

 

'#SPI:NoAPIKey

 

' Set OpenAI API-Key from the saved File

AIC.SetKey|File

' Set Model

AIC.SetModel_Chat|3

' Set Model-Temperature

AIC.Set_Temperature|0.6

AIC.SetMax_Token|300

 

' Using the ARR.-Command we buld a Chat history

'Each Array element must constist of 2 Parts:

'<Role>:<Content>

 

' You can use as many Array Elements as you like, the Array is "Auto-Dim"

'

'     <Array-No.>|<Array-Element No.>|<Text to assign to the Array Element>

ARR.Set|1|0|system:You are a technical advisor. Your name is Paul.

ARR.Set|1|1|user:What is 1+1?

ARR.Set|1|2|assistant:Hallo, I am Paul and 1+1 is 2.

ARR.Set|1|3|user:What is 2+2?

ARR.Set|1|4|assistant:Hallo, I am Paul and 242 is 4.

ARR.Set|1|5|user:What is the sum of 3+5?

 

' Now we send the Array to the Model.

AIC.Ask With History|1|$$RET

MBX.$$RET

ENR.
 
clip0885

This is the Result of the above Script. Chat GPT apologizes for a mistake we told him he may have done using the Chat-History.

 

 

 

 

 

 

 

 

 

See also: