Qiskit / qiskit-ibm-runtime

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

Add support for serialized primitive results #1769

Closed Rcuz8 closed 1 week ago

Rcuz8 commented 1 week ago

Summary

Adds support for parsing string results in this serialized form:

"{\"__type__\": \"PrimitiveResult\", \"__value__\": {\"pub_results\": [{\"__type__\": \"PubResult\", \"__value__\": {\"data\": {\"__type__\": \"DataBin\", \"__value__\": {\"field_names\": [\"evs\", \"stds\", \"ensemble_standard_error\"], \"field_types\": [\"numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]\", \"numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]\", \"numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]\"], \"shape\": [1, 100, 1001], \"fields\": {\"evs\": {\"__type__\": \"ndarray\", \"__value__\": 

Details and comments

Fixes an error that throws when pulling job results stored in that serialized primitive result format.

jyu00 commented 1 week ago

@Rcuz8 Is this related to the recent issue where a string instead of a JSON is returned? If so, that seems to be a breaking API change that needs to be fixed on the server side, not the client side. qiskit-ibm-runtime is not the only client that invokes the service.

Rcuz8 commented 1 week ago

👍 @jyu00