AIN. - AnythingLLM AI

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM AI

AIN.GetRaw

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.GetRaw
Get the Raw Response from the Last API Call

 

Intention

 

GetRaw Command: Retrieve Unprocessed API Response
 
The GetRaw command retrieves the unprocessed, raw response from the most recent API call made within the AnythingLLM system.

This is valuable for debugging or accessing the full API output, including headers or metadata.

It’s part of the AIN - AnythingLLM AI suite.

 

What is the GetRaw Command?

 

This command returns the complete, unparsed response from the last API interaction (e.g., from AIN.ExecuteOpenAIChat or AIN.ListWorkspaces), typically in JSON or raw text format.

The result can be stored in a variable or on the stack.

 

Why Do You Need It?

 

Accessing the raw response is essential for:

Debugging: Inspect the full API output, including errors or metadata.

Customization: Process the raw data for specific needs beyond parsed results.

Logging: Record complete API interactions for analysis.

 

How to Use the GetRaw Command?

 

Call the command after an API-interacting command to retrieve the last raw response.

It does not initiate a new API call but accesses cached data from the previous request.

 

Example Usage

 

AIN.ExecuteOpenAIChat|my-workspace|Hi there!

AIN.GetRaw|$$RAW

DBP.Raw Response: $$RAW

 

This retrieves the raw response from the chat request and stores it in $$RAW.

 

Illustration

 

┌───────────────┐

│ API Call      │

├───────────────┤

│ Chat Request  │

└──────┬────────┘

       │

┌──────▼────────┐

│ Raw Response  │

├───────────────┤

│ {"text": "Hi"}│

└───────────────┘

Fetching the raw API response after a chat.

 

Syntax

 

AIN.GetRaw[|P1]

AIN.RAW[|P1]

 

Parameter Explanation

 

P1 - (Optional) Variable to store the raw response; if omitted, the result is stored on the stack.

 

Example

 

AIN.ListWorkspaces

AIN.RAW|$$RAW

DBP.Raw API Output: $$RAW

ENR.

 

Remarks

 

- Only retrieves the response from the most recent API call.

- Returns an empty string if no API call has been made in the session.

 

Limitations

 

- Limited to 1 parameter; excess parameters trigger an error.

- Overwritten by each new API call; not persistent across sessions.

 

See also:

 

AIN.ExecuteOpenAIChat

AIN.ListWorkspaces

AIN.GetWorkspaceBySlug