Skip to content

Commit

Permalink
Merge pull request #28 from qBraid/fire_opal_fix
Browse files Browse the repository at this point in the history
✨ Update IBM backend provider configuration to use environment variables for credentials
  • Loading branch information
rryoung98 authored Apr 5, 2024
2 parents eec28ab + 4b55106 commit e1bf1e8
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions qbraid_lab/fire_opal/get-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,39 @@
"Note that the code below requires your IBM Quantum API token. Visit [IBM Quantum](https://quantum.ibm.com/) to sign up for an account and [obtain your access credentials](https://docs.quantum-computing.ibm.com/run/account-management)."
]
},
{
"cell_type": "markdown",
"id": "99cf3b28",
"metadata": {},
"source": [
"Add your IBM and Q-CTRL credentials as environment variables."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f9782358",
"metadata": {},
"outputs": [],
"source": [
"%set_env IBM_TOKEN=YOUR_IBM_TOKEN\n",
"%set_env QCTRL_API_KEY=YOUR_QCTRL_API_KEY"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "0c83cce7",
"metadata": {},
"outputs": [],
"source": [
"ibm_token = os.getenv(\"IBM_TOKEN\")\n",
"api_key = os.getenv(\"QCTRL_API_KEY\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ef17a083",
"metadata": {},
"outputs": [],
Expand All @@ -327,15 +357,14 @@
"hub = \"ibm-q\"\n",
"group = \"open\"\n",
"project = \"main\"\n",
"token = \"YOUR_IBM_TOKEN\"\n",
"credentials = fireopal.credentials.make_credentials_for_ibmq(\n",
" token=token, hub=hub, group=group, project=project\n",
")\n",
"fireopal.authenticate_qctrl_account(api_key=api_key)\n",
"\n",
"QiskitRuntimeService.save_account(\n",
" token, instance=hub + \"/\" + group + \"/\" + project, overwrite=True\n",
"credentials = fireopal.credentials.make_credentials_for_ibmq(\n",
" token=ibm_token, hub=hub, group=group, project=project\n",
")\n",
"service = QiskitRuntimeService()"
"service = QiskitRuntimeService(\n",
" token=ibm_token, instance=hub + \"/\" + group + \"/\" + project, channel=\"ibm_quantum\"\n",
")"
]
},
{
Expand Down

0 comments on commit e1bf1e8

Please sign in to comment.