qbiocode.utils.ibm_account module#

Summary#

Functions:

get_creds

This function determines the user's IBM Quantum channel, instance, and token, using values provided within the config.yaml file or as defined within the user's qiskit configuration from provided qiskit_json_path specified in the config.yaml file, and then parses its contents.

instantiate_runtime_service

This function provides a quick way to instantiate QiskitRuntimeService in one place.

Reference#

get_creds(args)[source]#

This function determines the user’s IBM Quantum channel, instance, and token, using values provided within the config.yaml file or as defined within the user’s qiskit configuration from provided qiskit_json_path specified in the config.yaml file, and then parses its contents. It returns the main items in this json file, such as the instance and api token, which can then be passed into the QML functions when using a real hardware backend. The function will return a dictionary with the keys ‘channel’, ‘instance’, ‘token’, and ‘url’, which can be used to instantiate the QiskitRuntimeService. If the qiskit_json_path is provided, it will attempt to read the credentials from that file. :type args: dict :param args: This passes the arguments from the config.yaml file. In this particular case, it is importing the path to the qiskit-ibm.json file (qiskit_json_path) and the credentials :type args: dict :param defined in this json file: :type defined in this json file: ibm_channel, ibm_instance, ibm_token, ibm_url

Returns:

A dictionary containing the IBM Quantum credentials, including ‘channel’, ‘instance’, ‘token’, and ‘url’.

Return type:

rval (dict)

instantiate_runtime_service(args)[source]#

This function provides a quick way to instantiate QiskitRuntimeService in one place. A basic call to this function can then be done in anywhere else. It uses the get_creds function to retrieve the necessary credentials from the qiskit-ibm.json file, with the file path specified in the config.yaml file. It returns an instance of the QiskitRuntimeService class, which can be used to interact with IBM Quantum services.

Parameters:
  • args (dict) – This passes the arguments from the config.yaml file. In this particular case, it is importing the path to the qiskit-ibm.json file (qiskit_json_path) and the credentials

  • file (defined in this json)

Returns:

An instance of the QiskitRuntimeService class, initialized with the credentials from the qiskit-ibm.json file or the provided arguments.

Return type:

QiskitRuntimeService