Magic Commands
You can access the CLI directly from within Notebooks using IPython magic commands. First, configure the qBraid magic command extension using:
The above command can also be executed from within a Jupyter notebook using the !
operator. Then, from within a
notebook cell, load the qBraid magic IPython extension using:
Now you can continue to use the qBraid-CLI as normal from within your Jupyter notebook using the magic %
operator, e.g.
Quantum Jobs
Check whether quantum jobs are enabled in your current notebook, and enable Amazon Braket quantum jobs:
After enabling quantum jobs within a notebook, you must restart your kernel in order for the changes to take effect.
To use qbraid jobs
commands within a notebook, you must prefix them with the
%
magic operator. Using the !
operator instead will likely result in
errors, as it executes the commands as regular bash commands without
leveraging the notebook context.
qBraid Chat
Leverage qbraid chat
as an in-line coding assistant with magic commands. Ask questions using the --prompt
or -p
flag to receive plain-text responses:
For raw code responses, use the --format
or -f
option with the code
format:
The generated code will be automatically inserted into the notebook cell below.