Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
147 stars 155 forks source link

Inputs to Session and Batch should order of Sampler and Estimator #1681

Open nonhermitian opened 3 months ago

nonhermitian commented 3 months ago

What is the expected feature or enhancement?

The inputs to Session and Batch list the session as the first arg followed by backend:

class Session(service=None, backend=None, max_time=None)

class Batch(service=None, backend=None, max_time=None)

which is the opposite of Sampler and Estimator:

class SamplerV2(backend=None, session=None, options=None)

class EstimatorV2(backend=None, session=None, options=None)

It would be nice to have a unified calling order. In particular, the sampler and estimator were written to have backend first because it makes the code cleaner because users are not required to pass backend=backend into the init. The Session and Batch should follow suit.

Acceptance criteria The kwargs orders are unified to match the sampler and Estimator ordering.

jyu00 commented 2 months ago

I think we should just deprecate passing a string for backend. Today you can do Session(backend="ibm_osaka"), which would actually call QiskitRuntimeService() (i.e. use your default account setting) under the cover. This can be a surprise to people if the default channel or h/g/p is not what they want to use.

If we force people to pass in a backend object instead of a string, then service won't be necessary, and this issue would also go away.