Response Method (AIOBJECT)
The Response method is used to obtain the returned JSON data from last successful OpenAI or Gemini AI operation. This method uses the following format:
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. An AIOBJECT object previously declared.
return
Optional. A Character Variable that returns the output JSON string. If an error occurs while generating the JSON output string, the Character Variable is returned as a NULL variable.
Flags Affected: EOS, OVER, ZERO
Notes:
The EOS flag is set if the output JSON string is truncated because the {return} variable is too small.
The ZERO and OVER flags are always cleared.
The JSON data for a OpenAI AI operation contains much information, and is described in the on-line OpenAI API documentation. Most PL/B programs will only need to use the field output[1].content[0].text to retrieve the generated text.
The JSON data for a Gemini AI operation contains much information, and is described in the on-line Gemini API documentation. Most PL/B programs will only need to use the field candidates[0].content.parts[0].text to retrieve the generated text.
The JSONDATA object can be used to process the returned data.
Example 1:
Example 2:
See Also: Method Syntax,, AIOBJECT.
![]() |