Skip to content

Commit c891b47

Browse files
committed
Start working on adding v0.4 API support.
Signed-off-by: Radu Marginean <[email protected]>
1 parent 71a822d commit c891b47

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

runtime/cudaq/platform/default/rest/helpers/ionq/IonQServerHelper.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace cudaq {
2222
/// computation jobs.
2323
class IonQServerHelper : public ServerHelper {
2424
static constexpr const char *DEFAULT_URL = "https://api.ionq.co";
25-
static constexpr const char *DEFAULT_VERSION = "v0.3";
25+
static constexpr const char *DEFAULT_VERSION = "v0.4";
2626

2727
public:
2828
/// @brief Returns the name of the server helper.
@@ -120,8 +120,8 @@ void IonQServerHelper::initialize(BackendConfig config) {
120120
parseConfigForCommonParams(config);
121121

122122
// Enable debiasing
123-
if (config.find("debias") != config.end())
124-
backendConfig["debias"] = config["debias"];
123+
if (config.find("debiasing") != config.end())
124+
backendConfig["debiasing"] = config["debiasing"];
125125
if (config.find("sharpen") != config.end())
126126
backendConfig["sharpen"] = config["sharpen"];
127127
if (config.find("format") != config.end())
@@ -204,14 +204,14 @@ IonQServerHelper::createJob(std::vector<KernelExecution> &circuitCodes) {
204204
job["input"]["format"] = "qir";
205205
job["input"]["data"] = circuitCode.code;
206206
// Include error mitigation configuration if set in backendConfig
207-
if (keyExists("debias")) {
207+
if (keyExists("debiasing")) {
208208
try {
209-
bool debiasValue =
210-
nlohmann::json::parse(backendConfig["debias"]).get<bool>();
211-
job["error_mitigation"]["debias"] = debiasValue;
209+
bool debiasingValue =
210+
nlohmann::json::parse(backendConfig["debiasing"]).get<bool>();
211+
job["error_mitigation"]["debiasing"] = debiasingValue;
212212
} catch (const nlohmann::json::exception &e) {
213213
throw std::runtime_error(
214-
"Invalid value for 'debias'. It should be a boolean (true/false).");
214+
"Invalid value for 'debiasing'. It should be a boolean (true/false).");
215215
}
216216
}
217217

utils/mock_qpu/ionq/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async def login(token: Union[str, None] = Header(alias="Authorization",
8787
# Here we expose a way to post jobs,
8888
# Must have a Access Token, Job Program must be Adaptive Profile
8989
# with entry_point tag
90-
@app.post("/v0.3/jobs")
90+
@app.post("/v0.4/jobs")
9191
async def postJob(job: Job,
9292
token: Union[str, None] = Header(alias="Authorization",
9393
default=None)):
@@ -138,7 +138,7 @@ async def postJob(job: Job,
138138

139139
# Retrieve the job, simulate having to wait by counting to 3
140140
# until we return the job results
141-
@app.get("/v0.3/jobs")
141+
@app.get("/v0.4/jobs")
142142
async def getJob(id: str):
143143
global countJobGetRequests, createdJobs, numQubitsRequired
144144

@@ -152,13 +152,13 @@ async def getJob(id: str):
152152
"jobs": [{
153153
"status": "completed",
154154
"qubits": numQubitsRequired,
155-
"results_url": "/v0.3/jobs/{}/results".format(id)
155+
"results_url": "/v0.4/jobs/{}/results".format(id)
156156
}]
157157
}
158158
return res
159159

160160

161-
@app.get("/v0.3/jobs/{jobId}/results")
161+
@app.get("/v0.4/jobs/{jobId}/results")
162162
async def getResults(jobId: str):
163163
global countJobGetRequests, createdJobs
164164

0 commit comments

Comments
 (0)