|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AID. - DeepSeek > !Response Analysis > AID. - Artificial Intelligence DeepSeek Utility |
MiniRobotLanguage (MRL)
AID.Get Raw
Retrieve the Last Raw API Response from DeepSeek
Intention
GetRaw Command: Accessing Unprocessed API Data
The AID.Get Raw command retrieves the unprocessed, raw response from the most recent DeepSeek API call made via AID.Ask or AID.AskT.
This command provides access to the full API response (JSON for AID.Ask, text for AID.AskT) stored in AID_Raw_Return, enabling advanced debugging or custom parsing.
It’s part of the AID - DeepSeek API suite, enhancing flexibility in MiniRobotLanguage scripts.
The AID.Get Raw command fetches the contents of the global variable AID_Raw_Return, which holds the unprocessed response from the last AID.Ask (JSON) or AID.AskT (text) API call.
Unlike AID.Ask or AID.AskT, which process responses into a usable format, AID.Get Raw provides the raw data as received from HTP_CallDeepSeekAPI, stored as a wide string.
You can store this raw response in a variable or retrieve it directly for inspection or custom handling.
The AID.Get Raw command is valuable for:
•Debugging: Inspect the full, unprocessed API response to diagnose issues or verify data.
•Custom Parsing: Access raw JSON or text for bespoke processing beyond the default HTP_AnalyzeDeepSeekResponse output.
•Flexibility: Retrieve the last response without making a new API call, saving costs (e.g., $0.27/1M input tokens for 'deepseek-chat').
Call AID.Get Raw with an optional variable (P1) to store the raw response from the last AID.Ask or AID.AskT call.
If no variable is specified, the raw response is returned directly. It’s stored as a wide string in AID_Raw_Return after each API call via HTP_CallDeepSeekAPI.
This command is cost-free as it reuses the last response, avoiding additional API charges (e.g., $1.10/1M output tokens for 'deepseek-chat').
Cost Model and Usage
Unlike AID.Ask or AID.AskT, AID.Get Raw incurs no additional API costs since it retrieves cached data from AID_Raw_Return.
For reference, DeepSeek API pricing (February 2025) is $0.27/1M input and $1.10/1M output tokens for 'deepseek-chat', and $0.55/1M input and $2.19/1M output for 'deepseek-reasoner'. AID.Get Raw avoids these costs by reusing the last response.
Example Usage
AID.Set Model|deepseek-chat
AID.Ask|What is the weather today?|$$RES
AID.Get Raw|$$RAW
DBP.Raw JSON Response: $$RAW
Queries the weather, then retrieves the raw JSON (e.g., {"choices":[{"message":{"content":"Sunny"}}]}) stored in $$RAW.
AID.Set Temperature|1.0
AID.AskT|Write a short poem|$$POE
AID.Get Raw|$$RAW
DBP.Raw Text Response: $$RAW
Generates a poem, then retrieves the raw text (e.g., "Roses bloom in spring...") stored in $$RAW.
Illustration
┌────────────────────┐
│ AID.Ask: "Weather?"│
├──────┬─────────────┤
│ Raw │ {"choices": │
│ Resp │ ["Sunny"]} │
├──────┼─────────────┤
│ Cost │ $0 (cached) │
└──────┴─────────────┘
Retrieving the raw JSON response from a prior AID.Ask call.
┌──────────────────────┐
│ AID.AskT: "Poem?" │
├──────┬───────────────┤
│ Raw │ "Roses bloom │
│ Resp │ in spring..." │
├──────┼───────────────┤
│ Cost │ $0 (cached) │
└──────┴───────────────┘
Retrieving the raw text response from a prior AID.AskT call.
Syntax
AID.GetRaw[|P1]
AID.Get Raw[|P1]
Parameter Explanation
P1 - (Optional) Variable to store the raw response from the last API call. If omitted, the response is returned directly.
Example
AID.Set Model|deepseek-reasoner
AID.Ask|Solve 2x + 3 = 7|$$SOL
AID.Get Raw|$$RAW
DBP.Processed Solution: $$SOL
DBP.Raw JSON: $$RAW
ENR.
Solves an equation with 'deepseek-reasoner', storing the processed response (e.g., "x = 2") in $$SOL and the raw JSON (e.g., {"choices":[{"message":{"content":"x = 2"}}]}) in $$RAW.
Remarks
- Returns an empty string if no prior API call has been made.
- The raw response type (JSON or text) depends on the last command used (AID.Ask or AID.AskT).
Limitations
- Only retrieves the most recent response; earlier responses are overwritten.
- Does not reprocess or validate the raw data; it’s provided as-is.
See also:
• AID.Ask
• AID.AskT