Question Method (AIOBJECT)
The Question method is used to make an inquiry to an OpenAI or Gemini model using the associated PL/B AIOBJECT object. This method uses the following format:
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. An AIOBJECT object previously declared.
return
Optional. A Numeric Variable that returns a success or fail value.
input
Required. A Character String Variable or literal that specifies the question for AI engine being accessed/used
body
Optional. A Character String Variable or literal that specifies API specific JSON to be added to the AI request.
Flags Affected: EOS, OVER, ZERO
Notes:
The ZERO flag is set to TRUE when the 'return' value is zero used to indicate that the method executed successfully. The ZERO flag is set to FALSE when the 'return' value is not zero indicating that the method execution failed.
The OVER flag is set TRUE if the 'return' variable is too small and cannot contain the 'return' value without being truncated. Otherwise, the OVER flag is set to FALSE.
The EOS flag is always cleared.
The {input} parameter contains the question to be sent to the OpenAI or Gemini model
The optional {body} parameter can contain API specific JSON to be added to the AI request. This allows the program to use any custom features that a specific model might provide.
The error values returned in {return} are defined as follows:
|
Error |
Description |
|
1 |
Memory allocation error. |
|
2 |
No key. Key must be specified. |
|
3 |
A previous question is still being processed. |
|
4 |
No model. Model must be specified. |
|
5 |
Unknown model name is being used. |
.
Example 1:
Example 2:
See Also: Method Syntax,, AIOBJECT.
![]() |