Skip to content

Commit 13a7d77

Browse files
dstrain115rht
authored andcommitted
Minor updates for the IonQ Service page (quantumlib#5607)
- Cleaning up some punctuation and defining the `remote_host` option which was mentioned but not explained.
1 parent 906c279 commit 13a7d77

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docs/hardware/ionq/service.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# IonQ API Service
22

33
IonQ's API provides a way to execute quantum circuits on IonQ's trapped ion quantum computers
4-
or on cloud based simulators. As of April 2021 this access is restricted to partners.
4+
or on cloud based simulators. As of April 2021, this access is restricted to partners.
55
See [Access and Authentication](access.md) for details of access.
66

77
## Service class
@@ -10,14 +10,16 @@ The main entrance for accessing IonQ's API are instances of the `cirq_ionq.Servi
1010
These objects need to be initialized with an api key, see
1111
[Access and Authentication](access.md) for details.
1212

13-
The basic flow of running a quantum circuit in a blocking manner is
13+
The basic steps for running a quantum circuit in a blocking manner are:
14+
1415
1. Create a circuit to run.
15-
1. Create a `cirq_ionq.Service` with proper authentication and endpoints.
16+
2. Create a `cirq_ionq.Service` with proper authentication and endpoints.
1617
3. Submit this circuit to run on the service and await the results of this call.
1718
(Or alternatively use asynchronous jobs and processing)
1819
4. Transform the results in a form that is most useful for your analysis.
1920

20-
Here is a simple example of this flow
21+
Here is a simple example of this flow:
22+
2123
```python
2224
import cirq
2325
import cirq_ionq as ionq
@@ -31,20 +33,20 @@ circuit = cirq.Circuit(
3133

3234
# Create a ionq.Service object.
3335
# Replace API_KEY with your api key.
34-
# Or alternatively if you have the IONQ_API_KEY environment
35-
# variables set, you can omit specifying thee api_key parameters.
36+
# Alternatively, if you have the IONQ_API_KEY environment
37+
# variable set, you can omit specifying this api_key parameters.
3638
service = ionq.Service(api_key=API_KEY)
3739

38-
# Run a program against the service. This method will block execution
39-
# until the result is returned and periodically polls the IonQ API.
40+
# Run a program against the service. This method will block execution until
41+
# the result is returned (determined by periodically polling the IonQ API).
4042
result = service.run(circuit=circuit, repetitions=100, target='qpu')
4143

4244
# The return object of run is a cirq.Result object.
43-
# From this object you can get a histogram of results.
45+
# From this object, you can get a histogram of results.
4446
histogram = result.histogram(key='x')
4547
print(f'Histogram: {histogram}')
4648

47-
# Or the data as a pandas frame.
49+
# You can also get the data as a pandas frame.
4850
print(f'Data:\n{result.data}')
4951
```
5052
This produces output (will vary due to quantum randomness!)
@@ -70,18 +72,16 @@ Data:
7072

7173
## Service options
7274

73-
In addition to the `remote_host` and `api_key` there are some other options which are
74-
useful for configuring the service. The most useful of these are
75-
76-
* `default_target`: this is a string of either `simulator` or `qpu`. By setting this you
77-
do not have to specify a target every time you run a job using `run`, `create_job`
78-
or via the `sampler` interface. A helpful pattern is to create two services with
79-
defaults for the simulator and for the QPU separately.
75+
In addition to the `api_key`, there are some other options which are
76+
useful for configuring the service. These are passed as arguments
77+
when creating a `cirq_ionq.Service` object.
8078

81-
* `max_retry_seconds`: The API will pull with exponential backoff for completed jobs.
82-
By specifying this you can change the number of seconds before this retry gives up.
83-
It is common to set this to a very small number when, for example, wanting to fail
84-
fast, or to be set very long for long running jobs.
79+
* `remote_host`: The location of the api in the form of an url. If this is None,
80+
then this instance will use the environment variable `IONQ_REMOTE_HOST`. If that
81+
variable is not set, then this uses `https://api.ionq.co/{api_version}`.
82+
* `default_target`: this is a string of either `simulator` or `qpu`. By setting this you do not have to specify a target every time you run a job using `run`, `create_job` or via the `sampler` interface. A helpful pattern is to create two services with defaults for the simulator and for the QPU separately.
83+
* `api_version`: Version of the api. Defaults to 'v0.1'.
84+
* `max_retry_seconds`: The API will pull with exponential backoff for completed jobs. By specifying this you can change the number of seconds before this retry gives up. It is common to set this to a very small number when, for example, wanting to fail fast, or to be set very long for long running jobs.
8585

8686
## Next steps
8787

0 commit comments

Comments
 (0)