> ## Documentation Index
> Fetch the complete documentation index at: https://docs.haiqu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 ``DistributionLoading`` or ``VectorLoading``.

Constraints:
    - ``dl_type`` must be exactly one of ``DistributionLoading``,
      ``VectorLoading``, ``BlockVectorLoading``, ``MpsLoading``,
      ``EntangledManifoldEmbedding``, or ``FunctionLoading``.
    - MCP-layer validation checks required parameter keys for the selected
      mode and enforces the ``BlockVectorLoading`` exclusivity rule.
    - The MCP layer does not reject every unknown extra key or fully
      validate parameter value domains before delegating to the backend.

Notes:
    - ``DistributionLoading`` prepares a probability distribution state.
    - ``VectorLoading`` prepares an arbitrary real or complex vector state.
    - ``MpsLoading`` prepares an arbitrary state from a matrix product state.
    - ``BlockVectorLoading`` prepares a block-wise vector or matrix state.
    - ``EntangledManifoldEmbedding`` encodes real data into a quantum state
      with controllable entanglement.
    - ``FunctionLoading`` prepares the values of a single-variable function
      ``f(x)`` as amplitudes; ``func`` is a math expression string in ``x``.
    - After submission, callers should use ``get_job_results_and_status``
      to 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``, ``VectorLoading``, ``BlockVectorLoading``,
        ``MpsLoading``, ``EntangledManifoldEmbedding``, or ``FunctionLoading``.
    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.



## OpenAPI

````yaml https://api.haiqu.ai/openapi.json post /ai/load_classical_data_with_data_loading
openapi: 3.1.0
info:
  title: Haiqu API
  summary: Haiqu RESTful API service.
  description: Cloud service providing the access to Haiqu cloud runtime
  contact:
    name: Haiqu Inc.
    url: https://haiqu.ai/
    email: info@haiqu.ai
  version: 1.4.0
servers: []
security: []
paths:
  /ai/load_classical_data_with_data_loading:
    post:
      summary: Load Classical Data With Data Loading
      description: >-
        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 ``DistributionLoading`` or ``VectorLoading``.

        Constraints:
            - ``dl_type`` must be exactly one of ``DistributionLoading``,
              ``VectorLoading``, ``BlockVectorLoading``, ``MpsLoading``,
              ``EntangledManifoldEmbedding``, or ``FunctionLoading``.
            - MCP-layer validation checks required parameter keys for the selected
              mode and enforces the ``BlockVectorLoading`` exclusivity rule.
            - The MCP layer does not reject every unknown extra key or fully
              validate parameter value domains before delegating to the backend.

        Notes:
            - ``DistributionLoading`` prepares a probability distribution state.
            - ``VectorLoading`` prepares an arbitrary real or complex vector state.
            - ``MpsLoading`` prepares an arbitrary state from a matrix product state.
            - ``BlockVectorLoading`` prepares a block-wise vector or matrix state.
            - ``EntangledManifoldEmbedding`` encodes real data into a quantum state
              with controllable entanglement.
            - ``FunctionLoading`` prepares the values of a single-variable function
              ``f(x)`` as amplitudes; ``func`` is a math expression string in ``x``.
            - After submission, callers should use ``get_job_results_and_status``
              to 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``, ``VectorLoading``, ``BlockVectorLoading``,
                ``MpsLoading``, ``EntangledManifoldEmbedding``, or ``FunctionLoading``.
            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.
      operationId: load_classical_data_with_data_loading
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContextDataLoadingSubmitModel'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextDataLoadingJobModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyQuery: []
        - APIKeyHeader: []
components:
  schemas:
    ContextDataLoadingSubmitModel:
      properties:
        experiment_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Experiment Id
          default: ''
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          default: ''
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          default: ''
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
          description: >-
            Mode-specific parameters. For `DistributionLoading`:
            `distribution_name`, `num_qubits`, `interval_start`, `interval_end`,
            `loc`, `scale`, `num_layers`, `truncation_cutoff` (+ optional scipy
            distribution shape args). 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`.
        num_qubits:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Qubits
          description: >-
            Optional qubit count. Required for `DistributionLoading` and
            `FunctionLoading`; optional for `VectorLoading` and
            `EntangledManifoldEmbedding`; ignored for `BlockVectorLoading`.
        distribution_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Distribution Name
          description: Required for `DistributionLoading` (e.g. `norm`, `uniform`, `beta`).
        dl_type:
          type: string
          enum:
            - DistributionLoading
            - VectorLoading
            - BlockVectorLoading
            - EntangledManifoldEmbedding
            - MpsLoading
            - FunctionLoading
          title: Dl Type
          description: >-
            Data loading mode. Use one of: `DistributionLoading`,
            `VectorLoading`, `BlockVectorLoading`, `EntangledManifoldEmbedding`,
            `MpsLoading`, `FunctionLoading`.
      type: object
      required:
        - parameters
        - dl_type
      title: ContextDataLoadingSubmitModel
      description: >-
        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``.
            distribution_name: Distribution identifier required for
                ``DistributionLoading``.
      examples:
        - 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
        - distribution_name: meixner_cf
          dl_type: DistributionLoading
          experiment_id: exp-123
          name: Meixner distribution
          num_qubits: 12
          parameters:
            alpha: 1.5
            beta: 0.5
            delta: 0.5
            interval_end: 3
            interval_start: -3
            loc: 0
            mu: 0
            num_layers: 1
            scale: 1
            truncation_cutoff: 0.000001
        - dl_type: VectorLoading
          experiment_id: exp-123
          name: Bell vector loading
          parameters:
            data:
              - 1
              - 0
              - 0
              - 1
            fine_tuning_iterations: 20
            num_layers: 2
            truncation_cutoff: 0.000001
        - dl_type: BlockVectorLoading
          experiment_id: exp-123
          name: Block vector loading
          parameters:
            data:
              - 0.5
              - 0.2
              - 1
              - 14
              - 0.3
              - 5
              - 0.2
              - 0.6
            fine_tuning_iterations: 20
            num_blocks: 2
            num_layers: 2
            truncation_cutoff: 0.000001
        - dl_type: EntangledManifoldEmbedding
          experiment_id: exp-123
          name: Entangled manifold embedding
          parameters:
            data:
              - 1
              - 2
              - 3
              - 4
              - 5
            density: 2
            fine_tuning_iterations: 20
            num_layers: 2
            periodicity: false
            real: true
            truncation_cutoff: 0.000001
        - dl_type: MpsLoading
          experiment_id: exp-123
          name: Bell MPS loading
          parameters:
            fine_tuning_iterations: 20
            mps:
              - - - - 1
                    - 0
                - - - 0
                    - 1
              - - - - 0.7071067811865475
                  - - 0
                - - - 0
                  - - 0.7071067811865475
            num_layers: 2
            shape: plr
            truncation_cutoff: 0.000001
        - dl_type: FunctionLoading
          experiment_id: exp-123
          name: Gaussian function loading
          num_qubits: 6
          parameters:
            fine_tuning_iterations: 20
            func: exp(-x**2)
            interval_end: 3
            interval_start: -3
            num_layers: 2
            truncation_cutoff: 0.000001
    ContextDataLoadingJobModel:
      properties:
        context:
          type: string
          title: Context
      type: object
      required:
        - context
      title: ContextDataLoadingJobModel
      description: |-
        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.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyQuery:
      type: apiKey
      in: query
      name: HAIQU_API_KEY
    APIKeyHeader:
      type: apiKey
      in: header
      name: authorization

````