|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Core Operations > AIU. - Artificial Intelligence Utility |
MiniRobotLanguage (MRL)
AIU.Responses
Perform a Responses Completion
Intention
Responses Command: Generate Assistant Responses
The Responses command performs a completion to generate responses, likely leveraging an assistant-like functionality via the OpenAI API.
It processes a prompt and returns a response, using settings like AIU.SetStore for context.
It’s part of the AIU - OpenAI API suite.
The Responses command sends a prompt to the OpenAI API, likely using the Assistants API, to generate a text response.
It requires a prompt and a variable to store the result, leveraging configurations like user ID (AIU.SetUser) and store ID (AIU.SetStore) for session context.
The Responses command is valuable for:
•Automation: Generate assistant-like responses for user queries.
•Contextual Interaction: Use stored session data for coherent replies.
•Flexibility: Integrate AI responses into scripts or workflows.
Provide a prompt string and a variable to receive the response.
It uses models like gpt-4o ($5.00/1M input tokens, $15.00/1M output tokens, 128K context) or gpt-3.5-turbo ($0.50/1M input, $1.50/1M output, 16K context), with costs tied to token usage as of March 18, 2025.
Example Usage
AIU.SetStore|store123
AIU.Responses|What’s the capital of France?|$$RES
DBP.Response: $$RES
Sets a store ID and generates a response ("The capital of France is Paris") stored in $$RES.
Illustration
┌──────────────┬────────────────────────────────────────┐
│ Prompt │ Response Example │
├──────────────┼────────────────────────────────────────┤
│ What’s 2+2? │ "2 + 2 equals 4." │
├──────────────┼────────────────────────────────────────┤
│ Tell a joke │ "Why don’t skeletons fight? No guts!" │
└──────────────┴────────────────────────────────────────┘
Illustration of prompt-response pairs.
Syntax
AIU.Responses|P1|P2
Parameter Explanation
P1 - A string containing the prompt or query for the AI to respond to. Required.
P2 - The variable where the generated response is stored. Required.
Example
AIU.SetUser|alice
AIU.Responses|What’s the weather like?|$$WEA
DBP.Weather: $$WEA
ENR.
Remarks
- Likely uses the Assistants API, supporting models like gpt-4o or gpt-3.5-turbo.
- Response length and quality depend on the model and token limits.
Limitations
- Requires exactly two parameters; incorrect counts trigger an error (%IC_ER_PA).
- Token usage impacts cost; exceeding context limits may truncate responses.
See also: