qiskit_serverless.core.QiskitFunction

class QiskitFunction(title, provider=None, entrypoint=None, working_dir='./', env_vars=None, dependencies=None, description=None, version=None, tags=None, raw_data=None, image=None, runner='ray', arguments_schema=None, type='GENERIC', sizes_map=None, default_size=None)[source]

Serverless QiskitPattern.

Parameters:
  • title (str) – program name

  • provider (Optional[str]) – Qiskit Function provider reference

  • entrypoint (Optional[str]) – is a script that will be executed as a job ex: job.py

  • env_vars (Optional[Dict[str, str]]) – env vars

  • dependencies (Optional[List[str]]) – list of python dependencies to execute a program

  • working_dir (Optional[str]) – directory where entrypoint file is located (max size 50MB)

  • description (Optional[str]) – description of a program

  • version (Optional[str]) – version of a program

  • sizes_map (Optional[Dict[str, str]]) – the function’s {size_label: compute_profile} t-shirt size catalog, e.g. {"s": "24x120", "m": "16x128"}. Set it to declare the catalog on upload; it is also how the catalog is carried back in a fetched function, read through RunnableQiskitFunction.sizes(). A size is picked per run with function.run(function_size="s"); labels are matched case-insensitively and each compute profile must name one the deployment has registered, or the upload is rejected. Only meaningful for the "fleets" runner. On upload, None leaves any stored catalog untouched and a sent mapping replaces it wholesale; a fetched function carries None when the representation has no size information and an empty dict when it declares no sizes.

  • default_size (Optional[str]) – the size label used when a run omits an explicit size. Set it on upload to declare the default (it must be one of the labels in sizes_map and requires sizes_map to be declared); also read back through RunnableQiskitFunction.get_default_size(). None when the function declares no default (a run then falls back to the platform default). Only meaningful for the "fleets" runner.

  • arguments_schema (Union[Dict[str, Any], bool, None]) –

    JSON Schema describing valid arguments for this function. Normally an object; True and False are also valid schemas, accepting and rejecting every argument respectively. None means the function does not declare one, and setting it to {} on an upload removes the schema an earlier upload stored.

    The gateway applies the schema to the arguments as this SDK encodes them, not as they look in Python, so a QuantumCircuit argument is matched against {"__type__": "QuantumCircuit", "__value__": "<base64 QPY>"} and a numpy array against an object rather than an array. Describing either with {"type": "array"} therefore rejects every legitimate call. Constrain the plain arguments (counts, names, options, flags) and check only the __type__ tag of the Qiskit ones. See specs/ARGUMENTS_VALIDATION.md.

__init__(title, provider=None, entrypoint=None, working_dir='./', env_vars=None, dependencies=None, description=None, version=None, tags=None, raw_data=None, image=None, runner='ray', arguments_schema=None, type='GENERIC', sizes_map=None, default_size=None)

Methods

__init__(title[, provider, entrypoint, ...])

from_json(data)

Reconstructs QiskitPattern from dictionary.

Attributes

APPLICATION

CIRCUIT

GENERIC

arguments_schema

default_size

dependencies

description

entrypoint

env_vars

image

provider

raw_data

runner

sizes_map

tags

type

version

working_dir

title