AI - Direct Access

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIC. - Artificial Intelligence Command > AI - Direct Access >

AI - Direct Access

AIC.Get Raw Output

Previous Top Next


MiniRobotLanguage (MRL)

 

AIC.Get Raw Output
Get the original JSON Structure that was generated by the AI.

 

B01002

 

Intention

 

The AIC.Get Raw Output command in the Smart-Package Robot (SPR) allows users to get access to the original JSON* Data Structure that is returned from the OpenAI endpoints in answer to a Prompt.
This command is versatile and can be used across all OpenAI endpoints, including:

text generation,

image generation,

and more.

This command is mostly useful for debugging.

The "AIC.gro" Command does not need any Index, as the result it will contain all Answers that are generated.

 

Important: if you use this command after "Image Generation", there may be a lot (up to 5 MB) of "Base64 encoded" image data in the result.

In that case you can not use a "Messagebox" to display this amount  of data.

 

 

Syntax:

 

AIC.Get Raw Output|<Variable for Result>

 

Parameters:

<Variable for Result>: This is a placeholder for the variable where you want to store the content retrieved by the "AIC.Get Content" command.
This variable will hold the data from the specified index in the output array. If omitted, TOS is used.

 

 

Example Usage:

AIC.Get Raw Output|$$RET

 

 

 

Syntax

 

 

AIC.Get Raw Output[|P1]

AIC.gro[|P1]

 

 

Parameter Explanation

 

P1 - opt. Variable for result. If omitted TOS is used.  

 

 

*Here is a Sample of the original returned JSON Data from the Chat-Endpoint.
 

  "id": "chatcmpl-7Zbc78I0ULOEdP1RfHTYPzRxsZSYZ",

  "object": "chat.completion",

  "created": 1688720424,

  "model": "gpt-3.5-turbo-0613",

  "choices": [

    {

      "index": 0,

      "message": {

        "role": "assistant",

        "content": "\"Imagine a world where technology has advanced to the point where humans can live forever. Explore the ethical implications and consequences of immortality on society, relationships"

      },

      "finish_reason": "length"

    }

  ],

  "usage": {

    "prompt_tokens": 20,

    "completion_tokens": 30,

    "total_tokens": 50

  }

}

 

Example

 

'*****************************************************

' EXAMPLE 1: AIC.-Commands

'*****************************************************

' Set OpenAI API-Key from the saved File

AIC.SetKey|File

 

' Set Model

AIC.SetModel_Completion|1

 

' Set Model-Temperature

AIC.Set_Temperature|0

 

' Set Max-Tokens (Possible lenght of answer, depending on the Model up to 2000 Tokens which is about ~6000 characters)

' The more Tokens you use the more you need to pay.

AIC.SetMax_Token|25

 

' Ask Question and receive answer to $$RET

AIC.Ask_Completion|What is a "Windows Button"?|$$RET

' We will look at the RAW Output here

AIC.Get Raw Output|$$RET

DBP.$$RET

MBX.!!

:enx

ENR.

 

 

Remarks

 

Important: if you use this command after "Image Generation", there may be a lot (up to 5 MB) of "Base64 encoded" image data in the result.

In that case you can not use a "Messagebox" to display this amount  of data. You can use the PRT. Command for that.

 

 

Limitations:

-

 

 

See also:

 

  Set_Key

  Ask_Chat

  Ask_Completion