@qbraid-core/ibm-cloud 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { AllDevicesResponse, DeviceProperties, DeviceConfiguration, DeviceStatus, JobList, Job, GetJobParams, CancelJobResponse, DeleteJobResponse } from './types';
1
+ import { AllDevicesResponse, DeviceProperties, DeviceConfiguration, DeviceErrors, DeviceStatus, JobList, Job, JobMetrics, GetJobParams, APIErrorResponse, JobTranspiledCircuitResponse } from './types';
2
2
  export declare class IBMCloudClient {
3
3
  private apiKey?;
4
4
  private token?;
@@ -8,14 +8,27 @@ export declare class IBMCloudClient {
8
8
  constructor({ apiKey, token, crn }: {
9
9
  apiKey?: string;
10
10
  token?: string;
11
- crn: string;
11
+ crn?: string;
12
12
  });
13
+ loadCredsFromFile(): {
14
+ apiKey?: string;
15
+ crn?: string;
16
+ };
17
+ loadCredsFromEnv(): {
18
+ apiKey?: string;
19
+ crn?: string;
20
+ };
21
+ private handleJobRequest;
13
22
  getBackends(): Promise<AllDevicesResponse>;
14
23
  getBackendProperties(backendName: string, updatedBefore?: string): Promise<DeviceProperties>;
15
24
  getBackendConfiguration(backendName: string): Promise<DeviceConfiguration>;
16
25
  getBackendStatus(backendName: string): Promise<DeviceStatus>;
17
- getJobs(params?: GetJobParams): Promise<JobList>;
18
- getJob(jobId: string, excludeParams?: boolean): Promise<Job>;
19
- deleteJob(jobId: string): Promise<DeleteJobResponse>;
20
- cancelJob(jobId: string, parentJobId?: string): Promise<CancelJobResponse>;
26
+ getBackendErrors(backendName: string): Promise<DeviceErrors>;
27
+ getJobs(params?: GetJobParams): Promise<JobList | APIErrorResponse>;
28
+ getJob(jobId: string, excludeParams?: boolean): Promise<Job | APIErrorResponse>;
29
+ deleteJob(jobId: string): Promise<null | APIErrorResponse>;
30
+ cancelJob(jobId: string, parentJobId?: string): Promise<null | APIErrorResponse>;
31
+ getJobLogs(jobId: string): Promise<string | APIErrorResponse>;
32
+ getJobTranspiledCircuits(jobId: string): Promise<JobTranspiledCircuitResponse | APIErrorResponse>;
33
+ getJobMetrics(jobId: string): Promise<JobMetrics | APIErrorResponse>;
21
34
  }
@@ -6,8 +6,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.IBMCloudClient = void 0;
9
+ const fs_1 = __importDefault(require("fs"));
9
10
  const https_1 = require("https");
11
+ const os_1 = __importDefault(require("os"));
12
+ const path_1 = __importDefault(require("path"));
10
13
  const axios_1 = __importDefault(require("axios"));
14
+ const homedir = os_1.default.homedir();
11
15
  class IBMCloudClient {
12
16
  apiKey;
13
17
  token;
@@ -15,13 +19,27 @@ class IBMCloudClient {
15
19
  baseUrl;
16
20
  client;
17
21
  constructor({ apiKey, token, crn }) {
22
+ if (!apiKey && !token && !crn) {
23
+ // attempt to load the creds from ~/.qiskit/qiskit-ibm.json file
24
+ // or from the env vars QISKIT_IBM_TOKEN and QISKIT_IBM_INSTANCE
25
+ let creds = this.loadCredsFromFile();
26
+ if (Object.keys(creds).length === 0) {
27
+ creds = this.loadCredsFromEnv();
28
+ }
29
+ apiKey = creds.apiKey;
30
+ token = undefined;
31
+ crn = creds.crn;
32
+ }
18
33
  if (!apiKey && !token) {
19
34
  throw new Error('Either apiKey or token must be provided');
20
35
  }
36
+ if (!crn) {
37
+ throw new Error('Service CRN must be provided');
38
+ }
21
39
  this.apiKey = apiKey;
22
40
  this.token = token;
23
41
  this.crn = crn;
24
- this.baseUrl = 'https://us-east.quantum-computing.cloud.ibm.com/';
42
+ this.baseUrl = 'https://quantum.cloud.ibm.com/api/v1';
25
43
  const headers = {
26
44
  'Service-CRN': this.crn,
27
45
  Authorization: this.apiKey ? `apikey ${this.apiKey}` : `Bearer ${this.token}`,
@@ -33,6 +51,63 @@ class IBMCloudClient {
33
51
  });
34
52
  this.client = axiosInstance;
35
53
  }
54
+ loadCredsFromFile() {
55
+ const filePath = path_1.default.join(homedir, '.qiskit', 'qiskit-ibm.json');
56
+ try {
57
+ if (fs_1.default.existsSync(filePath)) {
58
+ const rawData = fs_1.default.readFileSync(filePath, 'utf-8');
59
+ const parsedData = JSON.parse(rawData);
60
+ // Get the default-ibm-cloud credentials
61
+ if (parsedData['default-ibm-cloud']) {
62
+ const cloudCreds = parsedData['default-ibm-cloud'];
63
+ console.log('Loaded credentials from file');
64
+ return {
65
+ // In the IBM Cloud format, the token is equivalent to apiKey
66
+ apiKey: cloudCreds.token,
67
+ crn: cloudCreds.instance, // The instance field contains the CRN
68
+ };
69
+ }
70
+ else {
71
+ console.log('IBM Cloud credentials not found in the file');
72
+ }
73
+ }
74
+ else {
75
+ console.log('Credentials file not found');
76
+ }
77
+ }
78
+ catch (error) {
79
+ console.error('Error loading credentials from file: ', error);
80
+ }
81
+ return {};
82
+ }
83
+ loadCredsFromEnv() {
84
+ // Loading account from environment variables
85
+ // Ref : https://github.com/Qiskit/qiskit-ibm-runtime/tree/main?tab=readme-ov-file#loading-account-from-environment-variables
86
+ const apiKey = process.env.QISKIT_IBM_TOKEN;
87
+ const crn = process.env.QISKIT_IBM_INSTANCE;
88
+ if (!apiKey || !crn) {
89
+ console.log('Environment variables not found');
90
+ return {};
91
+ }
92
+ // in this case, token is null
93
+ console.log('Loaded credentials from env');
94
+ return {
95
+ apiKey: apiKey,
96
+ crn: crn,
97
+ };
98
+ }
99
+ async handleJobRequest(request) {
100
+ try {
101
+ const response = await request;
102
+ return response.data;
103
+ }
104
+ catch (error) {
105
+ if (axios_1.default.isAxiosError(error) && error.response) {
106
+ return error.response.data;
107
+ }
108
+ throw error;
109
+ }
110
+ }
36
111
  // 1. GET /backends - get all backends from IBM
37
112
  async getBackends() {
38
113
  const response = await this.client.get('/backends');
@@ -55,33 +130,72 @@ class IBMCloudClient {
55
130
  const response = await this.client.get(`/backends/${backendName}/status`);
56
131
  return response.data;
57
132
  }
58
- // 5. GET /jobs - get all jobs from IBM
133
+ // 5. GET /backends/:backend_name/errors - get the gate errors of a specific backend
134
+ async getBackendErrors(backendName) {
135
+ const backendProps = await this.getBackendProperties(backendName);
136
+ const gates = backendProps.gates;
137
+ const gateErrors = {};
138
+ for (let gate of gates) {
139
+ const gateName = gate.gate;
140
+ // check if gate is not present
141
+ if (gateErrors[gateName] === undefined) {
142
+ gateErrors[gateName] = {
143
+ name: gate.name,
144
+ num_qubits: gate.qubits.length,
145
+ lowest: 1e6,
146
+ highest: 0,
147
+ };
148
+ }
149
+ const gateParams = gate.parameters;
150
+ for (let param of gateParams) {
151
+ if (param.name === 'gate_error') {
152
+ // update the gate errors
153
+ const error = param.value;
154
+ gateErrors[gateName].lowest = Math.min(gateErrors[gateName].lowest, error);
155
+ gateErrors[gateName].highest = Math.max(gateErrors[gateName].highest, error);
156
+ }
157
+ }
158
+ }
159
+ const errors = {
160
+ gate_errors: Object.values(gateErrors),
161
+ };
162
+ return errors;
163
+ }
164
+ // 6. GET /jobs - get all jobs from IBM
59
165
  async getJobs(params) {
60
- const response = await this.client.get('/jobs', { params });
61
- return response.data;
166
+ return this.handleJobRequest(this.client.get('/jobs', { params }));
62
167
  }
63
- // 6. GET /jobs/:job_id - get a specific job from IBM
168
+ // 7. GET /jobs/:job_id - get a specific job from IBM
64
169
  async getJob(jobId, excludeParams) {
65
- const response = await this.client.get(`/jobs/${jobId}`, {
66
- params: { exclude_params: excludeParams }, // true will omit the params field in response
67
- });
68
- return response.data;
170
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}`, {
171
+ params: { exclude_params: excludeParams },
172
+ }));
69
173
  }
70
- // 7. DELETE /jobs/:job_id - delete a specific job from IBM
174
+ // 8. DELETE /jobs/:job_id - delete a specific job from IBM
71
175
  async deleteJob(jobId) {
72
- const response = await this.client.delete(`/jobs/${jobId}`);
73
- return response.data;
176
+ return this.handleJobRequest(this.client.delete(`/jobs/${jobId}`));
74
177
  }
75
- // 8. POST /jobs/:job_id/cancel - cancel a specific job from IBM
178
+ // 9. POST /jobs/:job_id/cancel - cancel a specific job from IBM
76
179
  async cancelJob(jobId, parentJobId) {
77
180
  const customHeader = parentJobId ? { 'parent-job-id': parentJobId } : {};
78
- const response = await this.client.post(`/jobs/${jobId}/cancel`, null, {
181
+ return this.handleJobRequest(this.client.post(`/jobs/${jobId}/cancel`, null, {
79
182
  headers: {
80
183
  ...this.client.defaults.headers.common,
81
184
  ...customHeader,
82
185
  },
83
- });
84
- return response.data;
186
+ }));
187
+ }
188
+ // 10. GET /jobs/:job_id/logs - get logs of a specific job from IBM
189
+ async getJobLogs(jobId) {
190
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}/logs`));
191
+ }
192
+ // 11. GET /jobs/:job_id/transpiled_circuits - get transpiled circuits of a specific job from IBM
193
+ async getJobTranspiledCircuits(jobId) {
194
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}/transpiled_circuits`));
195
+ }
196
+ // 12. GET /jobs/:job_id/metrics - get metrics of a specific job from IBM
197
+ async getJobMetrics(jobId) {
198
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}/metrics`));
85
199
  }
86
200
  }
87
201
  exports.IBMCloudClient = IBMCloudClient;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;;;;AAEvB,iCAA8B;AAE9B,kDAA0B;AAe1B,MAAa,cAAc;IACjB,MAAM,CAAU;IAChB,KAAK,CAAU;IACf,GAAG,CAAS;IACZ,OAAO,CAAS;IAChB,MAAM,CAAgB;IAE9B,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAoD;QAClF,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KA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AC,CAAC,CAAC;IACtF,CAAC;CACF;AAlOD,wCAkOC"}
@@ -2,4 +2,4 @@
2
2
  * @module ibm-cloud
3
3
  */
4
4
  export { IBMCloudClient } from './client';
5
- export type { DeleteJobResponse, CancelJobResponse, RunJobResponse, Job, JobList, DeviceProperties, DeviceStatus, DeviceConfiguration, } from './types';
5
+ export type { APIErrorResponse, Job, JobMetrics, JobList, DeviceProperties, DeviceErrors, DeviceStatus, DeviceConfiguration, } from './types';
@@ -138,6 +138,15 @@ export interface DeviceStatus {
138
138
  length_queue: number;
139
139
  backend_version: string;
140
140
  }
141
+ export interface GateError {
142
+ name: string;
143
+ num_qubits: number;
144
+ lowest: number;
145
+ highest: number;
146
+ }
147
+ export interface DeviceErrors {
148
+ gate_errors: GateError[];
149
+ }
141
150
  export interface JobState {
142
151
  status: string;
143
152
  reason?: string;
@@ -177,6 +186,28 @@ export interface Job {
177
186
  seconds: number;
178
187
  };
179
188
  }
189
+ export interface Timestamps {
190
+ created: string;
191
+ running: string;
192
+ finished: string;
193
+ }
194
+ export interface UsageMetrics {
195
+ quantum_seconds: number;
196
+ seconds: number;
197
+ }
198
+ export interface JobMetrics {
199
+ timestamps: Timestamps;
200
+ bss: {
201
+ seconds: number;
202
+ };
203
+ usage: UsageMetrics;
204
+ executions: number;
205
+ num_circuits: number;
206
+ num_qubits?: number[];
207
+ circuit_depths?: number[];
208
+ qiskit_version: string;
209
+ caller: string;
210
+ }
180
211
  export interface JobList {
181
212
  limit: number;
182
213
  offset: number;
@@ -196,22 +227,16 @@ export interface GetJobParams {
196
227
  session_id?: string;
197
228
  exclude_params?: boolean;
198
229
  }
199
- export interface RunJobResponse {
200
- id: string;
201
- backend: string;
202
- session_id?: string;
203
- }
204
- export interface ErrorResponse {
230
+ export interface Error {
205
231
  code: number;
206
232
  message: string;
207
233
  solution: string;
208
234
  more_info: string;
209
235
  }
210
- export interface CancelJobResponse {
211
- errors?: ErrorResponse[];
212
- trace?: string;
236
+ export interface APIErrorResponse {
237
+ errors: Error[];
238
+ trace: string;
213
239
  }
214
- export interface DeleteJobResponse {
215
- errors?: ErrorResponse[];
216
- trace?: string;
240
+ export interface JobTranspiledCircuitResponse {
241
+ url: string;
217
242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qbraid-core/ibm-cloud",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "description": "Functionality for interacting with Qiskit Runtime services on qBraid Cloud.",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://qbraid.github.io/qbraid-core-js/modules/ibm-cloud.html",
31
31
  "dependencies": {
32
- "axios": "^1.7.9",
32
+ "axios": "^1.8.2",
33
33
  "fs": "^0.0.1-security",
34
34
  "ini": "^5.0.0"
35
35
  },