|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIO. - OpenRouter AI > AIO Commands |
MiniRobotLanguage (MRL)
AIO.SetResponseFormat
Sets the response format for AI model responses, enabling structured output modes such as JSON objects or JSON schemas. This command allows you to enforce specific response structures from AI models, making it easier to parse and process responses programmatically.
AIO.SetResponseFormat|$$FORMAT_JSON
$$FORMAT_JSON (JSON Object)
A JSON object defining the desired response format. This can be either a simple JSON object type declaration or a complete JSON schema definition for structured output.
json_object - Enables JSON mode where the AI model returns a valid JSON object. Use this when you need structured JSON output without a specific schema.
Example: {"type":"json_object"}
json_schema - Enables strict schema validation mode where the AI model adheres to a specific JSON schema structure. Use this when you require the response to match a predefined schema with specific properties and types.
Example: {"type":"json_schema","json_schema":{"name":"schema_name","schema":{...}}}
Enable JSON Object Mode
Sets the response format to return a generic JSON object. The AI will format its response as valid JSON.
AIO.SetResponseFormat|{"type":"json_object"}
Define JSON Schema for Person Object
Sets a strict JSON schema that requires the AI to return a person object with a name property of type string.
AIO.SetResponseFormat|{"type":"json_schema","json_schema":{"name":"person","schema":{"type":"object","properties":{"name":{"type":"string"}}}}}
Not all AI models support JSON schema mode. Check your model's documentation for compatibility.
When using json_schema mode, ensure your schema is valid JSON Schema Draft 2020-12 or compatible with your AI provider's requirements.
The format setting persists until changed or the session ends.