RESTful API endpoint invocation
Summary
Submit structured peak data (chemical shifts) to a remote classification API endpoint and parse the returned predictions and confidence scores. This skill enables programmatic access to machine-learning-based spectral classification without local model deployment.
When to use
You have NMR peak data (1H and 13C chemical shift values) and need to obtain SMART 3 classification predictions from the DeepSAT service. Use this skill when you want to avoid local TensorFlow model management and instead leverage a deployed API endpoint that handles versioning and model updates transparently.
When NOT to use
- Input peaks are not in 1H and 13C format or lack required chemical shift headers
- The DeepSAT API endpoint is unavailable or unresponsive
- You require real-time, ultra-low-latency predictions (API calls incur network overhead)
Inputs
- JSON list of dictionaries with 1H and 13C peak keys and chemical shift values
- Model metadata retrieved from /model/metadata endpoint
Outputs
- JSON response containing classification predictions
- Confidence scores for each prediction
- Structured log file with request parameters, timestamp, and results
How to apply
First, query the /model/metadata endpoint via TensorFlow Serving to confirm the current input schema and model version, since model input names may change and require code updates. Construct a JSON payload as a list of dictionaries, where each dictionary contains 1H and 13C as keys with corresponding chemical shift values. Execute a POST request to the /api/smart3/search endpoint with this JSON payload as the request body. Validate the HTTP response status code and parse the returned JSON structure to extract classification predictions and their associated confidence scores. Log the request parameters, response timestamp, and prediction results to a structured output file for audit and reproducibility.
Related tools
- TensorFlow Serving (Hosts the /model/metadata endpoint to retrieve current input schema and model version; serves the underlying SMART 3 classification model)
- DeepSAT (Provides the /api/smart3/search REST endpoint for programmatic spectral classification via peak submission) — https://github.com/mwang87/DeepSAT
Examples
import requests; peaks = [{'1H': 7.25, '13C': 128.5}, {'1H': 3.45, '13C': 65.3}]; response = requests.post('http://api.deepsat.example.com/api/smart3/search', json=peaks); print(response.json())
Evaluation signals
- HTTP response status code is 200 (or other expected success code) and response body is valid JSON
- Returned JSON contains expected classification prediction keys and confidence score values within valid numeric ranges (e.g., 0–1 for probabilities)
- Request payload matches the schema confirmed by /model/metadata (1H and 13C keys present)
- Structured log file is created and contains non-empty request parameters, ISO-formatted timestamp, and prediction results
- Model version in /model/metadata response matches the expected version documented for this analysis
Limitations
- Model input names may change; code must be updated if /model/metadata schema changes
- No changelog is maintained, making it difficult to track model version updates and breaking changes
- API endpoint availability and latency depend on remote service uptime
- Requires network connectivity; offline classification is not possible with this approach
Evidence
- [intro] We pass through tensorflow serving at this url: /model/metadata: "We pass through tensorflow serving at this url: /model/metadata"
- [intro] You can put in your peaks as a json list of dicts, with 1H,13C as headers: "You can put in your peaks as a json list of dicts, with 1H,13C as headers"
- [intro] Classify programmatically. You can put in your peaks as a json list of dicts: "Classify programmatically. You can put in your peaks as a json list of dicts, with 1H,13C as headers"
- [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"
- [discussion] Source: github:mwang87__DeepSAT: "github:mwang87__DeepSAT"
1---2name: restful-api-endpoint-invocation3description: Use when you have NMR peak data (1H and 13C chemical shift values) and need to obtain SMART 3 classification predictions from the DeepSAT service.4license: CC-BY-4.05---67# RESTful API endpoint invocation89## Summary1011Submit structured peak data (chemical shifts) to a remote classification API endpoint and parse the returned predictions and confidence scores. This skill enables programmatic access to machine-learning-based spectral classification without local model deployment.1213## When to use1415You have NMR peak data (1H and 13C chemical shift values) and need to obtain SMART 3 classification predictions from the DeepSAT service. Use this skill when you want to avoid local TensorFlow model management and instead leverage a deployed API endpoint that handles versioning and model updates transparently.1617## When NOT to use1819- Input peaks are not in 1H and 13C format or lack required chemical shift headers20- The DeepSAT API endpoint is unavailable or unresponsive21- You require real-time, ultra-low-latency predictions (API calls incur network overhead)2223## Inputs2425- JSON list of dictionaries with 1H and 13C peak keys and chemical shift values26- Model metadata retrieved from /model/metadata endpoint2728## Outputs2930- JSON response containing classification predictions31- Confidence scores for each prediction32- Structured log file with request parameters, timestamp, and results3334## How to apply3536First, query the /model/metadata endpoint via TensorFlow Serving to confirm the current input schema and model version, since model input names may change and require code updates. Construct a JSON payload as a list of dictionaries, where each dictionary contains 1H and 13C as keys with corresponding chemical shift values. Execute a POST request to the /api/smart3/search endpoint with this JSON payload as the request body. Validate the HTTP response status code and parse the returned JSON structure to extract classification predictions and their associated confidence scores. Log the request parameters, response timestamp, and prediction results to a structured output file for audit and reproducibility.3738## Related tools3940- **TensorFlow Serving** (Hosts the /model/metadata endpoint to retrieve current input schema and model version; serves the underlying SMART 3 classification model)41- **DeepSAT** (Provides the /api/smart3/search REST endpoint for programmatic spectral classification via peak submission) — https://github.com/mwang87/DeepSAT4243## Examples4445```46import requests; peaks = [{'1H': 7.25, '13C': 128.5}, {'1H': 3.45, '13C': 65.3}]; response = requests.post('http://api.deepsat.example.com/api/smart3/search', json=peaks); print(response.json())47```4849## Evaluation signals5051- HTTP response status code is 200 (or other expected success code) and response body is valid JSON52- Returned JSON contains expected classification prediction keys and confidence score values within valid numeric ranges (e.g., 0–1 for probabilities)53- Request payload matches the schema confirmed by /model/metadata (1H and 13C keys present)54- Structured log file is created and contains non-empty request parameters, ISO-formatted timestamp, and prediction results55- Model version in /model/metadata response matches the expected version documented for this analysis5657## Limitations5859- Model input names may change; code must be updated if /model/metadata schema changes60- No changelog is maintained, making it difficult to track model version updates and breaking changes61- API endpoint availability and latency depend on remote service uptime62- Requires network connectivity; offline classification is not possible with this approach6364## Evidence6566- [intro] We pass through tensorflow serving at this url: /model/metadata: "We pass through tensorflow serving at this url: /model/metadata"67- [intro] You can put in your peaks as a json list of dicts, with 1H,13C as headers: "You can put in your peaks as a json list of dicts, with 1H,13C as headers"68- [intro] Classify programmatically. You can put in your peaks as a json list of dicts: "Classify programmatically. You can put in your peaks as a json list of dicts, with 1H,13C as headers"69- [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"70- [discussion] Source: github:mwang87__DeepSAT: "github:mwang87__DeepSAT"