qilisdk.speqtrum.speqtrum_models
Attributes
Type alias for a callable that extracts a typed result from an |
Classes
Base Pydantic model for all SpeQtrum API data structures. |
|
Placeholder model for the login request payload. |
|
Represents the structure of the login response: |
|
Enumeration of possible device statuses reported by the SpeQtrum API. |
|
Enumeration of hardware device types available in SpeQtrum. |
|
Description of a quantum device registered in SpeQtrum. |
|
Discriminator for the type of functional or experiment being executed. |
|
Payload model wrapping a |
|
Payload model wrapping an |
|
Payload model wrapping a |
|
Payload model wrapping a |
|
Generic payload wrapping any |
|
Top-level execution payload sent to the SpeQtrum |
|
Deserialized execution result returned by the SpeQtrum API. |
|
Strongly typed reference to a submitted SpeQtrum job. |
|
Enumeration of possible job lifecycle states. |
|
Enumeration of job categories used by the SpeQtrum scheduler. |
|
Handle/reference you normally get back immediately after POST /execute. |
|
Light-weight representation suitable for 'list jobs' and polling |
|
Full representation returned by GET /jobs/{id} when payload/result/logs |
|
JobDetail subclass that exposes a strongly typed get_results method. |
Module Contents
- class SpeQtrumModel(/, **data: Any)[source]
Bases:
pydantic.BaseModelBase Pydantic model for all SpeQtrum API data structures.
Configures alias resolution and arbitrary-type support used throughout the SpeQtrum payload and response models.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config[source]
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class LoginPayload(/, **data: Any)[source]
Bases:
pydantic.BaseModelPlaceholder model for the login request payload.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class Token(/, **data: Any)[source]
Bases:
SpeQtrumModelRepresents the structure of the login response: { “accessToken”: “…”, “expiresIn”: 123456789, “issuedAt”: “123456789”, “refreshToken”: “…”, “tokenType”: “bearer” }
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- access_token: str = None[source]
- expires_in: int = None[source]
- issued_at: int = None[source]
- refresh_token: str = None[source]
- token_type: str = None[source]
- class DeviceStatus[source]
Bases:
str,enum.EnumEnumeration of possible device statuses reported by the SpeQtrum API.
Initialize self. See help(type(self)) for accurate signature.
- ONLINE = 'online'[source]
- MAINTENANCE = 'maintenance'[source]
- OFFLINE = 'offline'[source]
- class DeviceType[source]
Bases:
str,enum.EnumEnumeration of hardware device types available in SpeQtrum.
Initialize self. See help(type(self)) for accurate signature.
- QPU_ANALOG = 'qpu.analog'[source]
- QPU_DIGITAL = 'qpu.digital'[source]
- SIMULATOR = 'simulator'[source]
- class Device(/, **data: Any)[source]
Bases:
SpeQtrumModelDescription of a quantum device registered in SpeQtrum.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- code: str = None[source]
- nqubits: int = None[source]
- name: str = None[source]
- description: str = None[source]
- type: DeviceType = None[source]
- status: DeviceStatus = None[source]
- class ExecuteType[source]
Bases:
str,enum.EnumDiscriminator for the type of functional or experiment being executed.
Initialize self. See help(type(self)) for accurate signature.
- DIGITAL_PROPAGATION = 'digital_propagation'[source]
- ANALOG_EVOLUTION = 'analog_evolution'[source]
- QUANTUM_RESERVOIR = 'quantum_reservoir'[source]
- VARIATIONAL_PROGRAM = 'variational_program'[source]
- EXPERIMENT = 'experiment'[source]
- class DigitalPropagationPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
DigitalPropagationand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- digital_propagation: qilisdk.functionals.DigitalPropagation = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class AnalogEvolutionPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping an
AnalogEvolutionand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- analog_evolution: qilisdk.functionals.AnalogEvolution = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class QuantumReservoirPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
QuantumReservoirand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- quantum_reservoir: qilisdk.functionals.QuantumReservoir = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class VariationalProgramPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
VariationalProgramand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- variational_program: qilisdk.functionals.VariationalProgram = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class ExperimentPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelGeneric payload wrapping any
ExperimentFunctionalfor API submission. Concrete experiment types are identified by their YAML tag inside the serialized experiment, so this single model handles every experiment and speqtrum never needs to import a concrete experiment class.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- experiment: qilisdk.experiments.ExperimentFunctional = None[source]
- class ExecutePayload(/, **data: Any)[source]
Bases:
SpeQtrumModelTop-level execution payload sent to the SpeQtrum
/executeendpoint.Exactly one of the optional payload fields should be populated, matching the discriminator stored in
type.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- type: ExecuteType = None[source]
- digital_propagation_payload: DigitalPropagationPayload | None = None[source]
- analog_evolution_payload: AnalogEvolutionPayload | None = None[source]
- quantum_reservoir_payload: QuantumReservoirPayload | None = None[source]
- variational_program_payload: VariationalProgramPayload | None = None[source]
- experiment_payload: ExperimentPayload | None = None[source]
- class ExecuteResult(/, **data: Any)[source]
Bases:
SpeQtrumModelDeserialized execution result returned by the SpeQtrum API.
The
typediscriminator indicates which result field is populated. Use the corresponding accessor (e.g.functional_result,variational_program_result) to retrieve the typed payload.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- type: ExecuteType = None[source]
- functional_result: qilisdk.functionals.FunctionalResult | None = None[source]
- variational_program_result: qilisdk.functionals.VariationalProgramResult | None = None[source]
- experiment_result: qilisdk.experiments.ExperimentResult | None = None[source]
- TFunctionalResult_co[source]
- TVariationalInnerResult[source]
- TExperimentResult[source]
- ResultExtractor[source]
Type alias for a callable that extracts a typed result from an
ExecuteResult.
- class JobHandle(/, **data: Any)[source]
Bases:
SpeQtrumModel,Generic[TFunctionalResult_co]Strongly typed reference to a submitted SpeQtrum job.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- id: int[source]
- execute_type: ExecuteType[source]
- extractor: ResultExtractor[TFunctionalResult_co] = None[source]
- classmethod functional(job_id: int) JobHandle[qilisdk.functionals.FunctionalResult][source]
Create a handle for a
DigitalPropagationorAnalogEvolutionjob.- Parameters:
job_id (
int) – Numeric identifier returned by the SpeQtrum service.- Returns:
A handle whose result type is
FunctionalResult.- Return type:
- classmethod variational_program(job_id: int) JobHandle[qilisdk.functionals.VariationalProgramResult][source]
- classmethod variational_program(job_id: int, *, result_type: type[TVariationalInnerResult]) JobHandle[VariationalProgramResult[TVariationalInnerResult]]
Create a variational-program handle for an existing job identifier.
- Parameters:
job_id – Numeric identifier returned by the SpeQtrum service.
result_type – Optional functional result type expected within the variational program payload. When provided the returned handle enforces that the optimiser output matches this type.
- Returns:
A handle whose
get_resultsinvocation yields aVariationalProgramResultpreserving the requested inner result type when supplied.- Return type:
- classmethod experiment(job_id: int) JobHandle[qilisdk.experiments.ExperimentResult][source]
- classmethod experiment(job_id: int, *, result_type: type[TExperimentResult]) JobHandle[TExperimentResult]
Create a handle for any experiment job (generic path).
- Parameters:
job_id (
int) – Numeric identifier returned by the SpeQtrum service.result_type – Optional concrete result type to validate against, taken from the submitted functional’s
result_type. When provided, the returned handle enforces that the result matches this type.
- Returns:
A handle whose
get_resultsyields anExperimentResult(the concrete type whenresult_typeis supplied).- Return type:
- bind(detail: JobDetail) TypedJobDetail[TFunctionalResult_co][source]
Attach this handle’s typing information to a concrete job detail.
- Parameters:
detail – Un-typed job detail payload returned by the SpeQtrum API.
- Returns:
Wrapper exposing
get_resultswith the typing captured when the handle was created.- Return type:
- class JobStatus[source]
Bases:
str,enum.EnumEnumeration of possible job lifecycle states.
Initialize self. See help(type(self)) for accurate signature.
- PENDING = 'pending'[source]
Job has been queued but not yet validated
- VALIDATING = 'validating'[source]
Job has been validated and is queued for execution
- QUEUED = 'queued'[source]
Job is being executed on the device
- RUNNING = 'running'[source]
Job finished successfully
- COMPLETED = 'completed'[source]
Job failed due to an error
- ERROR = 'error'[source]
Job was cancelled by the user or system
- CANCELLED = 'cancelled'[source]
Job failed due to timeout
- TIMEOUT = 'timeout'[source]
- class JobType[source]
Bases:
str,enum.EnumEnumeration of job categories used by the SpeQtrum scheduler.
Initialize self. See help(type(self)) for accurate signature.
- DIGITAL = 'digital'[source]
- PULSE = 'pulse'[source]
- ANALOG = 'analog'[source]
- QUANTUM_RESERVOIR = 'quantum_reservoir'[source]
- VARIATIONAL = 'variational'[source]
- class JobId(/, **data: Any)[source]
Bases:
SpeQtrumModelHandle/reference you normally get back immediately after POST /execute.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- id: int = None[source]
- message: str | None = None[source]
- class JobInfo(/, **data: Any)[source]
Bases:
JobIdLight-weight representation suitable for ‘list jobs’ and polling when you do not need logs or results.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- name: str = None[source]
- description: str = None[source]
- device_id: int = None[source]
- created_at: pydantic.AwareDatetime = None[source]
- updated_at: pydantic.AwareDatetime | None = None[source]
- completed_at: pydantic.AwareDatetime | None = None[source]
- class JobDetail(/, **data: Any)[source]
Bases:
JobInfoFull representation returned by GET /jobs/{id} when payload/result/logs are requested.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- payload: ExecutePayload | None = None[source]
- result: ExecuteResult | None = None[source]
- logs: str | None = None[source]
- error: str | None = None[source]
- error_logs: str | None = None[source]
- class TypedJobDetail(/, **data: Any)[source]
Bases:
JobDetail,Generic[TFunctionalResult_co]JobDetail subclass that exposes a strongly typed get_results method.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- expected_type: ExecuteType = None[source]
- extractor: ResultExtractor[TFunctionalResult_co] = None[source]
- get_results() TFunctionalResult_co[source]
Return the strongly typed execution result.
- Returns:
Result payload associated with the completed job, respecting the type information carried by the originating
JobHandle.- Return type:
ResultT_co
- Raises:
RuntimeError – If SpeQtrum has not populated the result payload or the execute type disagrees with the handle.