curl --request POST \
--url 'https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"distribution_name": "norm",
"dl_type": "DistributionLoading",
"experiment_id": "exp-123",
"name": "Normal distribution",
"num_qubits": 4,
"parameters": {
"interval_end": 3,
"interval_start": -3,
"loc": 0,
"num_layers": 1,
"scale": 1,
"truncation_cutoff": 0.000001
}
}
'import requests
url = "https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY="
payload = {
"distribution_name": "norm",
"dl_type": "DistributionLoading",
"experiment_id": "exp-123",
"name": "Normal distribution",
"num_qubits": 4,
"parameters": {
"interval_end": 3,
"interval_start": -3,
"loc": 0,
"num_layers": 1,
"scale": 1,
"truncation_cutoff": 0.000001
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
distribution_name: 'norm',
dl_type: 'DistributionLoading',
experiment_id: 'exp-123',
name: 'Normal distribution',
num_qubits: 4,
parameters: {
interval_end: 3,
interval_start: -3,
loc: 0,
num_layers: 1,
scale: 1,
truncation_cutoff: 0.000001
}
})
};
fetch('https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'distribution_name' => 'norm',
'dl_type' => 'DistributionLoading',
'experiment_id' => 'exp-123',
'name' => 'Normal distribution',
'num_qubits' => 4,
'parameters' => [
'interval_end' => 3,
'interval_start' => -3,
'loc' => 0,
'num_layers' => 1,
'scale' => 1,
'truncation_cutoff' => 0.000001
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"distribution_name\": \"norm\",\n \"dl_type\": \"DistributionLoading\",\n \"experiment_id\": \"exp-123\",\n \"name\": \"Normal distribution\",\n \"num_qubits\": 4,\n \"parameters\": {\n \"interval_end\": 3,\n \"interval_start\": -3,\n \"loc\": 0,\n \"num_layers\": 1,\n \"scale\": 1,\n \"truncation_cutoff\": 0.000001\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"distribution_name\": \"norm\",\n \"dl_type\": \"DistributionLoading\",\n \"experiment_id\": \"exp-123\",\n \"name\": \"Normal distribution\",\n \"num_qubits\": 4,\n \"parameters\": {\n \"interval_end\": 3,\n \"interval_start\": -3,\n \"loc\": 0,\n \"num_layers\": 1,\n \"scale\": 1,\n \"truncation_cutoff\": 0.000001\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"distribution_name\": \"norm\",\n \"dl_type\": \"DistributionLoading\",\n \"experiment_id\": \"exp-123\",\n \"name\": \"Normal distribution\",\n \"num_qubits\": 4,\n \"parameters\": {\n \"interval_end\": 3,\n \"interval_start\": -3,\n \"loc\": 0,\n \"num_layers\": 1,\n \"scale\": 1,\n \"truncation_cutoff\": 0.000001\n }\n}"
response = http.request(request)
puts response.read_body{
"context": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Load Classical Data With Data Loading
Submit a classical-to-quantum data-loading job and return polling context.
Use this tool when the caller needs a generated circuit from classical data
before execution or later circuit analysis. The request must use one of the
supported dl_type values, and the response schema is a lightweight
{"context": ...} wrapper rather than a structured job object.
When to Use:
- Call this when classical data must be turned into a circuit before execution or later circuit analysis.
- Call this when the user has already chosen a concrete data-loading
mode such as
DistributionLoadingorVectorLoading.
Constraints:
dl_typemust be exactly one ofDistributionLoading,MultivariateDistributionLoading,VectorLoading,BlockVectorLoading,MpsLoading,EntangledManifoldEmbedding,FunctionLoading, orFourierLoading.- MCP-layer validation checks required parameter keys for the selected
mode and enforces the
BlockVectorLoadingexclusivity rule. - The MCP layer does not reject every unknown extra key or fully validate parameter value domains before delegating to the backend.
Notes:
DistributionLoadingprepares a 1D probability distribution state.MultivariateDistributionLoadingprepares a 2D joint probability distribution or copula-based joint PDF state.VectorLoadingprepares an arbitrary real or complex vector state.MpsLoadingprepares an arbitrary state from a matrix product state.BlockVectorLoadingprepares a block-wise vector or matrix state.EntangledManifoldEmbeddingencodes real data into a quantum state with controllable entanglement.FunctionLoadingprepares the values of a single-variable functionf(x)as amplitudes;funcis a math expression string inx.FourierLoadingprepares a band-limited multidimensional state from its Fourier coefficients; output qubits above the per-dimension minimum interpolate onto a finer grid rather than zero-pad it.- After submission, callers should use
get_job_results_and_statusto retrieve terminal outputs such as the generated circuit ID.
Args:
user: Authenticated user resolved from the API key.
data: Data-loading payload. dl_type must be exactly one of
DistributionLoading, MultivariateDistributionLoading,
VectorLoading, BlockVectorLoading, MpsLoading,
EntangledManifoldEmbedding, FunctionLoading, or
FourierLoading.
db: Active database session.
Returns: A lightweight context wrapper summarizing the submission and next polling step.
Raises:
HTTPException: Raised with 404 if the experiment is unavailable for
the user, or 400 if payload validation fails.
curl --request POST \
--url 'https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"distribution_name": "norm",
"dl_type": "DistributionLoading",
"experiment_id": "exp-123",
"name": "Normal distribution",
"num_qubits": 4,
"parameters": {
"interval_end": 3,
"interval_start": -3,
"loc": 0,
"num_layers": 1,
"scale": 1,
"truncation_cutoff": 0.000001
}
}
'import requests
url = "https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY="
payload = {
"distribution_name": "norm",
"dl_type": "DistributionLoading",
"experiment_id": "exp-123",
"name": "Normal distribution",
"num_qubits": 4,
"parameters": {
"interval_end": 3,
"interval_start": -3,
"loc": 0,
"num_layers": 1,
"scale": 1,
"truncation_cutoff": 0.000001
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
distribution_name: 'norm',
dl_type: 'DistributionLoading',
experiment_id: 'exp-123',
name: 'Normal distribution',
num_qubits: 4,
parameters: {
interval_end: 3,
interval_start: -3,
loc: 0,
num_layers: 1,
scale: 1,
truncation_cutoff: 0.000001
}
})
};
fetch('https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'distribution_name' => 'norm',
'dl_type' => 'DistributionLoading',
'experiment_id' => 'exp-123',
'name' => 'Normal distribution',
'num_qubits' => 4,
'parameters' => [
'interval_end' => 3,
'interval_start' => -3,
'loc' => 0,
'num_layers' => 1,
'scale' => 1,
'truncation_cutoff' => 0.000001
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"distribution_name\": \"norm\",\n \"dl_type\": \"DistributionLoading\",\n \"experiment_id\": \"exp-123\",\n \"name\": \"Normal distribution\",\n \"num_qubits\": 4,\n \"parameters\": {\n \"interval_end\": 3,\n \"interval_start\": -3,\n \"loc\": 0,\n \"num_layers\": 1,\n \"scale\": 1,\n \"truncation_cutoff\": 0.000001\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"distribution_name\": \"norm\",\n \"dl_type\": \"DistributionLoading\",\n \"experiment_id\": \"exp-123\",\n \"name\": \"Normal distribution\",\n \"num_qubits\": 4,\n \"parameters\": {\n \"interval_end\": 3,\n \"interval_start\": -3,\n \"loc\": 0,\n \"num_layers\": 1,\n \"scale\": 1,\n \"truncation_cutoff\": 0.000001\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/load_classical_data_with_data_loading?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"distribution_name\": \"norm\",\n \"dl_type\": \"DistributionLoading\",\n \"experiment_id\": \"exp-123\",\n \"name\": \"Normal distribution\",\n \"num_qubits\": 4,\n \"parameters\": {\n \"interval_end\": 3,\n \"interval_start\": -3,\n \"loc\": 0,\n \"num_layers\": 1,\n \"scale\": 1,\n \"truncation_cutoff\": 0.000001\n }\n}"
response = http.request(request)
puts response.read_body{
"context": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
Define payload for MCP classical-to-quantum data loading jobs.
MCP-layer validation is limited to mode-specific required-key checks plus
the BlockVectorLoading exclusivity rule implemented by
:func:haiqu.api.mcp.data_loading.validation.validate_data_loading_payload.
Attributes:
experiment_id: Parent experiment identifier for the data-loading job.
name: Optional job name.
dl_type: Data-loading mode selector.
parameters: Mode-specific parameters forwarded to the backend.
num_qubits: Optional qubit count. Required for
DistributionLoading, MultivariateDistributionLoading and
FunctionLoading.
distribution_name: Distribution identifier required for
DistributionLoading (1D) and
MultivariateDistributionLoading (2D distribution or copula).
Mode-specific parameters. For DistributionLoading (1D scipy.stats distributions): distribution_name, num_qubits, interval_start, interval_end, loc, scale, num_layers, truncation_cutoff (+ optional scipy distribution shape args). For MultivariateDistributionLoading (2D distributions and copulas): interval (a [start, end] pair shared by both dimensions or a nested [[x_start, x_end], [y_start, y_end]] pair), encoding (probability or amplitude), num_layers, truncation_cutoff, plus distribution_params for direct 2D distributions, or copula_params, marginal_distribution_names, marginal_distribution_params (two entries each) for copulas; optional fine_tuning_iterations and max_time (seconds). For VectorLoading: data, num_layers, truncation_cutoff, fine_tuning_iterations. For BlockVectorLoading: data, (num_blocks or target_num_qubits), num_layers, truncation_cutoff, fine_tuning_iterations. For EntangledManifoldEmbedding: data, density, real, periodicity, num_layers, truncation_cutoff, fine_tuning_iterations. For MpsLoading: mps, shape, num_layers, truncation_cutoff, fine_tuning_iterations. For FunctionLoading: func (math expression string in the single variable x, e.g. exp(-x**2)), interval_start, interval_end, num_layers, truncation_cutoff, fine_tuning_iterations. For FourierLoading: fourier_coefficients (nested list, ascending in frequency along every axis with no fftshift applied) is the only required key. Optional: num_qubits and min_freqs (an integer shared by all dimensions or one entry per dimension), long_range (default false), num_layers (default 2), truncation_cutoff (default 1e-6), fine_tuning_iterations (default 20).
Data loading mode. Use one of: DistributionLoading, MultivariateDistributionLoading, VectorLoading, BlockVectorLoading, EntangledManifoldEmbedding, MpsLoading, FunctionLoading, FourierLoading.
DistributionLoading, MultivariateDistributionLoading, VectorLoading, BlockVectorLoading, EntangledManifoldEmbedding, MpsLoading, FunctionLoading, FourierLoading 1024Optional qubit count. Required for DistributionLoading, FunctionLoading and MultivariateDistributionLoading (where it is split between the two dimensions); optional for VectorLoading and EntangledManifoldEmbedding; ignored for BlockVectorLoading. Also ignored for FourierLoading, which takes its per-dimension output width from parameters.num_qubits.
Required for DistributionLoading (a 1D scipy.stats distribution, e.g. norm, uniform, beta) and for MultivariateDistributionLoading (a 2D distribution or copula: bivariate_student_t, bivariate_gamma, bivariate_von_mises, marshall_olkin_weibull, bivariate_poisson_normal_approx, gaussian_copula, clayton_copula, gumbel_copula, frank_copula).
Response
Successful Response
Represent context payload returned after data-loading submission.
Attributes:
context: Submission summary text including the created job ID and next
polling step. This response model does not expose structured
job_id or output circuit_id fields outside the text.