Skip to content

embed_remote

Embed a spectrum via a remote HTTPS inference endpoint.

Category Embeddings
Backend httpx - calls an external inference endpoint (optional extra embedding-remote)
Version 1.0.1
Reads ctx.spectrum (a Spectrum1D)
Writes embedding, extras.embedding_provenance, metrics.embedding_dim, metrics.embedding_norm

The endpoint contract is documented in the module docstring. Any service that respects it (including a self-hosted spectro-kernel MCP cloud running embed_pretrained server-side) can be plugged in. The user is responsible for the endpoint URL and (optionally) an API key; the kernel doesn't ship any defaults.

Parameters

Parameter Default Required Description
endpoint None yes Full HTTPS URL of the inference endpoint (REQUIRED).
model 'default' - Model identifier passed in the request body.
api_key None - Bearer token for the endpoint. Falls back to the SPECTRO_EMBED_API_KEY environment variable when null (on a shared server only for hosts listed in SPECTRO_EMBED_ENDPOINT_ALLOW).
dim 256 - Requested output dimension (the server may ignore this hint).
timeout_s 30.0 - HTTP request timeout in seconds (default 30).

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("embed_remote", ctx, {
    "endpoint": "<value>",
    "model": "default",
    "api_key": None,
    "dim": 256,
    "timeout_s": 30.0
})
spectro run embed_remote --input spectrum.fits \
  --param endpoint=<value> \
  --param model=default \
  --param api_key=none \
  --param dim=256 \
  --param timeout_s=30.0
{
  "tool": "embed_remote",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "endpoint": "<value>",
      "model": "default",
      "api_key": null,
      "dim": 256,
      "timeout_s": 30.0
    }
  }
}

Every algorithm is an MCP tool of the same name; describe_algorithm returns this page's metadata as JSON.

References

  • MCP-style stateless inference endpoints — see e.g. HuggingFace Inference API, OpenAI embedding endpoints, Replicate.