diff --git a/docs/guides/estimator-options.ipynb b/docs/guides/estimator-options.ipynb
index 959efc4119e..4f7755869e3 100644
--- a/docs/guides/estimator-options.ipynb
+++ b/docs/guides/estimator-options.ipynb
@@ -51,12 +51,128 @@
"source": [
"You can use options to customize the Estimator primitive. While the interface of the primitives' `run()` method is common across all implementations, their options are not. Consult the API references for information about the [`qiskit.primitives.BaseEstimatorV2`](/docs/api/qiskit/qiskit.primitives.BaseEstimatorV2) and [`qiskit_aer.BaseEstimatorV2`](https://qiskit.github.io/qiskit-aer/stubs/qiskit_aer.primitives.EstimatorV2.html) options.\n",
"\n",
+ "Notes :\n",
+ "\n",
+ "- You can see the available options and update option values during or after Estimator initialization.\n",
+ "- Use the `update()` method to apply changes to the `options` attribute.\n",
+ "- If you do not specify a value for an option, it is given a special value of `Unset` and the server defaults are used.\n",
+ "- The `options` attribute is the `dataclass` Python type. You can use the built-in `asdict` method to convert it to a dictionary.\n",
+ "\n",
+ "\n",
"\n",
"## Set Estimator options\n",
"\n",
- "You can set options when initializing Estimator, after initializing Estimator, or you can update the options after Estimator has been initialized. For instructions to use these techniques, see the [Introduction to options](/docs/guides/runtime-options-overview#options-precedence) topic.\n",
+ "You can set options when initializing Estimator, after initializing Estimator, or (for `precision` only), in the `run()` method.\n",
+ "\n",
+ "### Primitive initialization\n",
+ "\n",
+ "You can pass in an instance of the options class or a dictionary when initializing Estimator, which then makes a copy of those options. Thus, changing the original dictionary or options instance doesn't affect the options owned by the primitive.\n",
+ "\n",
+ "#### Options class\n",
+ "\n",
+ "When creating an instance of the `EstimatorV2` class, you can pass in an instance of the options class. Those options will then be applied when you use `run()` to perform the calculation. Specify the options in this format: `options.option.sub-option.sub-sub-option = choice`. For example: `options.dynamical_decoupling.enable = True`\n",
+ "\n",
+ "Example:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "a20ed38a-31b7-4f0a-aed1-bd11046ab10e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from qiskit_ibm_runtime import QiskitRuntimeService\n",
+ "from qiskit_ibm_runtime import EstimatorV2 as Estimator\n",
+ "from qiskit_ibm_runtime.options import EstimatorOptions\n",
+ "\n",
+ "service = QiskitRuntimeService()\n",
+ "backend = service.least_busy(operational=True, simulator=False)\n",
+ "\n",
+ "options = EstimatorOptions(\n",
+ " resilience_level=2,\n",
+ " resilience={\"zne_mitigation\": True, \"zne\": {\"noise_factors\": [1, 3, 5]}},\n",
+ ")\n",
+ "\n",
+ "# or...\n",
+ "options = EstimatorOptions()\n",
+ "options.resilience_level = 2\n",
+ "options.resilience.zne_mitigation = True\n",
+ "options.resilience.zne.noise_factors = [1, 3, 5]\n",
"\n",
- "Additionally, you can set the `precision` value in the `run()` method, as is described in the following section."
+ "estimator = Estimator(mode=backend, options=options)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "dc5ba623-45f2-4abf-9478-ff83490b480c",
+ "metadata": {},
+ "source": [
+ "#### Dictionary\n",
+ "\n",
+ "You can specify options as a dictionary when initializing Estimator."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "869e4bf1-a7f9-4a66-8876-f327dcb87811",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from qiskit_ibm_runtime import QiskitRuntimeService\n",
+ "from qiskit_ibm_runtime import EstimatorV2 as Estimator\n",
+ "\n",
+ "service = QiskitRuntimeService()\n",
+ "backend = service.least_busy(operational=True, simulator=False)\n",
+ "\n",
+ "# Setting options during initialization\n",
+ "estimator = Estimator(\n",
+ " backend,\n",
+ " options={\n",
+ " \"resilience_level\": 2,\n",
+ " \"resilience\": {\n",
+ " \"zne_mitigation\": True,\n",
+ " \"zne\": {\"noise_factors\": [1, 3, 5]},\n",
+ " },\n",
+ " },\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "498899b6-3253-4348-9589-19dbbd6bc22b",
+ "metadata": {},
+ "source": [
+ "### Update options after initialization\n",
+ "\n",
+ "You can specify the options in this format: `estimator.options.option.sub-option.sub-sub-option = choice` to take advantage of auto-complete, or use the `update()` method to make bulk updates.\n",
+ "\n",
+ "The `EstimatorV2` options class ([`EstimatorOptions`](/docs/api/qiskit-ibm-runtime/options-estimator-options)) does not need to be instantiated if you are setting options after initializing the primitive."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "1cd195bb-50a5-4c64-aa0b-effb1ea621ce",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from qiskit_ibm_runtime import QiskitRuntimeService\n",
+ "from qiskit_ibm_runtime import EstimatorV2 as Estimator\n",
+ "\n",
+ "service = QiskitRuntimeService()\n",
+ "backend = service.least_busy(operational=True, simulator=False)\n",
+ "\n",
+ "estimator = Estimator(mode=backend)\n",
+ "\n",
+ "# Setting options after initialization\n",
+ "# This uses auto-complete.\n",
+ "estimator.options.default_precision = 0.01\n",
+ "# This does bulk update.\n",
+ "estimator.options.update(\n",
+ " default_precision=0.02, resilience={\"zne_mitigation\": True}\n",
+ ")"
]
},
{
@@ -72,17 +188,17 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 16,
"id": "c0606f38-2bed-4b56-8202-708669e5ea66",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- ""
+ ""
]
},
- "execution_count": 1,
+ "execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@@ -140,7 +256,7 @@
"\n",
"1. If the PUB specifies precision, use that value.\n",
"2. If the precision keyword argument is specified in `run`, use that value.\n",
- "3. If `twirling` is enabled (True by default), then the product of `num_randomizations` and `shots_per_randomization`, as specified in [`twirling` options](/docs/api/qiskit-ibm-runtime/options-twirling-options), is used.\n",
+ "3. If `twirling` is enabled (True by default), then the product of `num_randomizations` and `shots_per_randomization`, as specified as [`twirling` options](/docs/api/qiskit-ibm-runtime/options-twirling-options), is used.\n",
"4. If `estimator.options.default_shots` is specified, use that value to control the amount of data.\n",
"5. If `estimator.options.default_precision` is specified, use that value.\n",
"\n",
@@ -756,47 +872,40 @@
"\n",
"Certain runtime features cannot be used together in a single job. Click the appropriate tab for a list of features that are incompatible with the selected feature:\n",
"\n",
- "\n",
- "\n",
- " \n",
- " Incompatible with:\n",
+ "\n",
+ " \n",
+ " Incompatible with:\n",
" - Gate twirling\n",
" - PEA\n",
" - PEC\n",
- "\n",
- " \n",
- "\n",
- " \n",
- " Incompatible with:\n",
+ " \n",
+ " \n",
+ " Might not work when using custom gates. Incompatible with:\n",
" - PEA\n",
" - PEC\n",
- "\n",
- " Might not work when using custom gates.\n",
- " \n",
- " \n",
- " Incompatible with fractional gates or with stretches.\n",
+ " \n",
+ " \n",
+ " Incompatible with:\n",
+ " - Fractional gates\n",
+ " - Stretches\n",
"\n",
" Other notes:\n",
" - Measurement twirling can only be applied to terminal measurements.\n",
" - Does not work with non-Clifford entanglers.\n",
- "\n",
- " \n",
- "\n",
- " \n",
+ " \n",
+ " \n",
" Incompatible with:\n",
" - Fractional gates\n",
" - Gate-folding ZNE\n",
" - PEC\n",
- " \n",
- "\n",
- " \n",
+ " \n",
+ " \n",
" Incompatible with:\n",
" - Fractional gates\n",
" - Gate-folding ZNE\n",
" - PEA\n",
- " \n",
- "\n",
- ""
+ " \n",
+ ""
]
},
{
@@ -807,7 +916,6 @@
"## Next steps\n",
"\n",
"\n",
- " - Review the [Introduction to options](/docs/guides/runtime-options-overview) guide.\n",
" - Find more details about the `EstimatorV2` methods in the [Estimator API reference](/docs/api/qiskit-ibm-runtime/estimator-v2).\n",
" - Decide what [execution mode](/docs/guides/execution-modes) to run your job in.\n",
" - Learn about [noise management with Estimator](/docs/guides/estimator-noise-management).\n",
diff --git a/docs/guides/sampler-options.ipynb b/docs/guides/sampler-options.ipynb
index 8551f196a02..2ad61fb038d 100644
--- a/docs/guides/sampler-options.ipynb
+++ b/docs/guides/sampler-options.ipynb
@@ -485,40 +485,35 @@
"\n",
"Certain runtime features cannot be used together in a single job. Click the appropriate tab for a list of features that are incompatible with the selected feature:\n",
"\n",
- "\n",
- " \n",
- " Incompatible with:\n",
+ "\n",
+ " \n",
+ " Incompatible with:\n",
" - Dynamical decoupling\n",
"\n",
" Other notes:\n",
" - Gate twirling can be applied to dynamic circuits, but only to gates not inside conditional blocks. Measurement twirling can only be applied to terminal measurements.\n",
" - Compatible with fractional gates when using `qiskit-ibm-runtime` v0.42.0 or later.\n",
- "\n",
- " \n",
- " \n",
- " Incompatible with dynamic circuits.\n",
- "\n",
- " \n",
- "\n",
- " \n",
- " Incompatible with:\n",
+ " \n",
+ " \n",
+ " Incompatible with:\n",
+ " - Dynamic circuits\n",
+ " \n",
+ " \n",
+ " Incompatible with:\n",
" - Gate twirling\n",
"\n",
" Compatible with dynamic circuits when using `qiskit-ibm-runtime` v0.42.0 or later.\n",
- "\n",
- " \n",
- "\n",
- " \n",
- " Incompatible with fractional gates or with stretches.\n",
+ " \n",
+ " \n",
+ " Incompatible with:\n",
+ " - Fractional gates\n",
+ " - Stretches\n",
"\n",
" Other notes:\n",
" - Gate twirling can be applied to dynamic circuits, but only to gates not inside conditional blocks. Measurement twirling can only be applied to terminal measurements.\n",
" - Does not work with non-Clifford entanglers.\n",
- "\n",
- " \n",
- "\n",
- "\n",
- ""
+ " \n",
+ ""
]
},
{