Api response parsing and validation
Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder
npx -y skills add HolobiomicsLab/asb-skill-collections --skill api-response-parsing-and-validationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when after submitting a POST request to the /api/smart3/search endpoint with peak data as a JSON payload, you receive an HTTP response and need to extract classification predictions and confidence scores.
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.0 KB, 793 tokens by cl100k_base, as published. Nobody here has run it
api-response-parsing-and-validation
Summary
Parse and validate JSON responses from the DeepSAT SMART 3 classification API to extract predictions and confidence scores. This skill ensures that API responses conform to the expected schema and that prediction results are reliably captured for downstream analysis or logging.
When to use
After submitting a POST request to the /api/smart3/search endpoint with peak data as a JSON payload, you receive an HTTP response and need to extract classification predictions and confidence scores. Use this skill when the response structure must be validated against the model's output schema before interpretation.
When NOT to use
- The API request has not yet been submitted or no response has been received
- The response format is not JSON (e.g., plain text error or HTML error page)
- Model metadata from /model/metadata endpoint has not been retrieved to establish baseline schema expectations
Inputs
- HTTP response object from POST request to /api/smart3/search
- Expected response schema from model metadata endpoint
- HTTP status code
Outputs
- Parsed JSON structure containing classification predictions
- Confidence scores for each prediction
- Structured log file with request parameters, response timestamp, and results
How to apply
Upon receipt of an HTTP response from /api/smart3/search, first validate the HTTP status code to confirm successful submission. Parse the returned JSON structure to identify the prediction results and associated confidence scores. Verify that the response contains the expected keys and data types as specified in the model metadata retrieved from /model/metadata. Extract classification predictions and confidence scores into structured fields. Log the request parameters, response timestamp, and parsed prediction results to a structured output file for auditability and debugging.
Related tools
- TensorFlow Serving (Provides model metadata endpoint (/model/metadata) to verify current input/output schema and model version prior to response validation)
Examples
import json; import requests; response = requests.post('http://api/api/smart3/search', json=peaks_payload); assert response.status_code == 200; predictions = response.json(); print(f'Predictions: {predictions["classifications"]}')
Evaluation signals
- HTTP response status code is 200 or other expected success code (not 4xx or 5xx)
- Parsed JSON response contains all expected keys matching the schema from /model/metadata endpoint
- Classification predictions and confidence scores are present and of correct data type (string/float or as specified)
- Confidence scores fall within expected range (typically 0–1 for probability-based models)
- Structured log file is created and contains all request parameters, response timestamp, and prediction results with no missing fields
Limitations
- Model input names and output schema may change between model versions; code updates may be required if the schema changes without backward compatibility
- No changelog is available to track schema changes across model versions, increasing risk of silent failure if response structure evolves
- HTTP status code validation alone does not guarantee the response JSON is valid or contains expected prediction fields; schema validation must be performed independently
- Confidence scores and prediction format depend on the specific model version; different versions may return different structures
Evidence
- [intro] If the model input names change, then we need to change it in the code: "If the model input names change, then we need to change it in the code"
- [intro] Validate HTTP response status and parse returned JSON to extract predictions and confidence: "Validate the HTTP response status code and parse the returned JSON structure to extract classification predictions and confidence scores."
- [intro] Log request parameters and prediction results: "Log the request parameters, response timestamp, and prediction results to a structured output file."
- [intro] Check model metadata via TensorFlow Serving: "Retrieve model metadata from the /model/metadata endpoint via TensorFlow Serving to verify current input schema and model version."
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.