|
<< Click to Display Table of Contents >> Navigation: »No topics above this level« AIN. - AnythingLLM API Integration |
MiniRobotLanguage (MRL)
AIN.GetResponseFormat
Retrieve the Current Response Format Setting
Intention
GetResponseFormat Command: Fetching the Response Format
The GetResponseFormat command retrieves the current response format setting from the AnythingLLM API.
This setting determines how API responses are structured (e.g., JSON, text), aiding in configuration verification or debugging.
It’s part of the AIN - AnythingLLM API suite.
This command queries the AnythingLLM API to return the current response format setting.
You can optionally specify a variable to store the result, which might be a string like "json" or "text".
Fetching the response format is useful for:
•Verifying the API’s output format before processing responses.
•Debugging issues related to unexpected response structures.
•Ensuring compatibility with your application’s parsing logic.
Call the command with an optional variable to store the current response format.
No additional parameters are required, as this retrieves a global or session-specific setting.
Example Usage
AIN.GetResponseFormat|$$FMT
DBP.Current Format: $$FMT
This retrieves the current response format and stores it in $$FMT (e.g., "json").
Illustration
┌───────────────┐
│ Format │
├───────────────┤
│ "json" │
└───────────────┘
Returns the current response format as a string.
Syntax
AIN.GetResponseFormat[|P1]
AIN.GetResponseFormat[|P1]
Parameter Explanation
P1 - (Optional) Variable to store the current response format (e.g., "json", "text").
Example
AIN.GetResponseFormat|$$OUT
DBP.Response Format: $$OUT
ENR.
Remarks
- Requires a valid API key set via AIN.SetKey.
- The format returned depends on prior configuration (e.g., via a hypothetical AIN.SetResponseFormat).
Limitations
- Returns an error or empty result if the API key is invalid or the setting is undefined.
- Limited to 0 or 1 parameter; additional parameters may cause an error.
See also: