What problem does this solve?
After deploying a model, users have to manually write client code to call it. The request shape (model, version, data) and the correct sample_input type are already known from the deploy flow — there is no reason the user should have to reconstruct them.
Proposed solution
New command: inference-engine snippets sentiment:v1 [--output dir] [--host url]
Reads sample_input, name, and version from deployment.json. Fails with a clear message if deployment.json is absent. --host defaults to http://localhost:8000.
Prints (or writes to --output) ready-to-use client code in three languages:
curl
curl -X POST http://localhost:8000/predict \
-H "X-API-Key: <your-key>" \
-H "Content-Type: application/json" \
-d '{"model": "sentiment", "version": "v1", "data": "great movie"}'
Python (httpx)
import httpx
response = httpx.post(
"http://localhost:8000/predict",
headers={"X-API-Key": "<your-key>"},
json={"model": "sentiment", "version": "v1", "data": "great movie"},
)
print(response.json())
JavaScript (fetch)
const response = await fetch("http://localhost:8000/predict", {
method: "POST",
headers: {"X-API-Key": "<your-key>", "Content-Type": "application/json"},
body: JSON.stringify({model: "sentiment", version: "v1", data: "great movie"}),
});
console.log(await response.json());
Static templates with variable substitution. No LLM needed. Implementation is ~60 lines.
Alternatives considered
Relying on the Swagger UI at /docs. Swagger shows the schema but doesn't pre-fill sample_input or generate copy-pasteable multi-language snippets.
Area
CLI (deploy / fix)
What problem does this solve?
After deploying a model, users have to manually write client code to call it. The request shape (
model,version,data) and the correctsample_inputtype are already known from the deploy flow — there is no reason the user should have to reconstruct them.Proposed solution
New command:
inference-engine snippets sentiment:v1 [--output dir] [--host url]Reads
sample_input,name, andversionfromdeployment.json. Fails with a clear message ifdeployment.jsonis absent.--hostdefaults tohttp://localhost:8000.Prints (or writes to
--output) ready-to-use client code in three languages:curl
Python (httpx)
JavaScript (fetch)
Static templates with variable substitution. No LLM needed. Implementation is ~60 lines.
Alternatives considered
Relying on the Swagger UI at
/docs. Swagger shows the schema but doesn't pre-fillsample_inputor generate copy-pasteable multi-language snippets.Area
CLI (deploy / fix)