# Copyright 2019-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from typing import Dict
from pydantic import BaseModel
from braket.device_schema.device_action_properties import DeviceActionProperties, DeviceActionType
from braket.device_schema.device_service_properties_v1 import DeviceServiceProperties
[docs]class DeviceCapabilities(BaseModel):
"""
DeviceCapabilities are the properties specific to device, this schema defines what is common
across all the devices
Attributes:
service: properties which are common to the braket service
action: Map of the action to its properties
deviceParameters: It is the json schema of the deviceParameters for each device. for
example the deviceParameter for IonqDeviceCapabilities will be
IonqDeviceParameters.json_schema()
Examples:
>>> import json
>>> input_json = {
... "service": {
... "braketSchemaHeader": {
... "name": "braket.device_schema.device_service_properties",
... "version": "1",
... },
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "1966280412345.6789",
... "windowEndHour": "1966280414345.6789",
... }
... ],
... "shotsRange": [1, 10],
... "deviceCost": {
... "price": 0.25,
... "unit": "minute"
... },
... "deviceDocumentation": {
... "imageUrl": "image_url",
... "summary": "Summary on the device",
... "externalDocumentationUrl": "exter doc link",
... },
... "deviceLocation": "us-east-1"
... },
... "action": {
... "braket.ir.jaqcd.program": {
... "actionType": "braket.ir.jaqcd.program",
... "version": ["1.0", "1.1"],
... }
... },
... "deviceParameters": {#Schema of specific device parameter instance},
... }
>>> DeviceCapabilities.parse_raw(json.dumps(input_json))
"""
service: DeviceServiceProperties
action: Dict[DeviceActionType, DeviceActionProperties]
deviceParameters: dict