@qbraid-core/ibm-cloud 0.7.0 → 0.8.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, 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,28 @@ 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
+ token?: string;
16
+ crn?: string;
17
+ };
18
+ loadCredsFromEnv(): {
19
+ apiKey?: string;
20
+ token?: undefined;
21
+ crn?: string;
22
+ };
23
+ private handleJobRequest;
13
24
  getBackends(): Promise<AllDevicesResponse>;
14
25
  getBackendProperties(backendName: string, updatedBefore?: string): Promise<DeviceProperties>;
15
26
  getBackendConfiguration(backendName: string): Promise<DeviceConfiguration>;
16
27
  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>;
28
+ getJobs(params?: GetJobParams): Promise<JobList | APIErrorResponse>;
29
+ getJob(jobId: string, excludeParams?: boolean): Promise<Job | APIErrorResponse>;
30
+ deleteJob(jobId: string): Promise<null | APIErrorResponse>;
31
+ cancelJob(jobId: string, parentJobId?: string): Promise<null | APIErrorResponse>;
32
+ getJobLogs(jobId: string): Promise<string | APIErrorResponse>;
33
+ getJobTranspiledCircuits(jobId: string): Promise<JobTranspiledCircuitResponse | APIErrorResponse>;
34
+ getJobMetrics(jobId: string): Promise<JobMetrics | APIErrorResponse>;
21
35
  }
@@ -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 = creds.token;
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,58 @@ 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 creds = JSON.parse(rawData);
60
+ console.log('Loaded credentials from file');
61
+ return {
62
+ apiKey: creds.apiKey,
63
+ token: creds.token,
64
+ crn: creds.serviceCRN,
65
+ };
66
+ }
67
+ else {
68
+ console.log('Credentials file not found');
69
+ return {};
70
+ }
71
+ }
72
+ catch (error) {
73
+ console.error('Error loading credentials from file:', error);
74
+ return {};
75
+ }
76
+ }
77
+ loadCredsFromEnv() {
78
+ // Loading account from environment variables
79
+ // Ref : https://github.com/Qiskit/qiskit-ibm-runtime/tree/main?tab=readme-ov-file#loading-account-from-environment-variables
80
+ const apiKey = process.env.QISKIT_IBM_TOKEN;
81
+ const crn = process.env.QISKIT_IBM_INSTANCE;
82
+ if (!apiKey || !crn) {
83
+ console.log('Environment variables not found');
84
+ return {};
85
+ }
86
+ // in this case, token is null
87
+ console.log('Loaded credentials from env');
88
+ return {
89
+ apiKey: apiKey,
90
+ token: undefined,
91
+ crn: crn,
92
+ };
93
+ }
94
+ async handleJobRequest(request) {
95
+ try {
96
+ const response = await request;
97
+ return response.data;
98
+ }
99
+ catch (error) {
100
+ if (axios_1.default.isAxiosError(error) && error.response) {
101
+ return error.response.data;
102
+ }
103
+ throw error;
104
+ }
105
+ }
36
106
  // 1. GET /backends - get all backends from IBM
37
107
  async getBackends() {
38
108
  const response = await this.client.get('/backends');
@@ -57,31 +127,39 @@ class IBMCloudClient {
57
127
  }
58
128
  // 5. GET /jobs - get all jobs from IBM
59
129
  async getJobs(params) {
60
- const response = await this.client.get('/jobs', { params });
61
- return response.data;
130
+ return this.handleJobRequest(this.client.get('/jobs', { params }));
62
131
  }
63
132
  // 6. GET /jobs/:job_id - get a specific job from IBM
64
133
  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;
134
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}`, {
135
+ params: { exclude_params: excludeParams },
136
+ }));
69
137
  }
70
138
  // 7. DELETE /jobs/:job_id - delete a specific job from IBM
71
139
  async deleteJob(jobId) {
72
- const response = await this.client.delete(`/jobs/${jobId}`);
73
- return response.data;
140
+ return this.handleJobRequest(this.client.delete(`/jobs/${jobId}`));
74
141
  }
75
142
  // 8. POST /jobs/:job_id/cancel - cancel a specific job from IBM
76
143
  async cancelJob(jobId, parentJobId) {
77
144
  const customHeader = parentJobId ? { 'parent-job-id': parentJobId } : {};
78
- const response = await this.client.post(`/jobs/${jobId}/cancel`, null, {
145
+ return this.handleJobRequest(this.client.post(`/jobs/${jobId}/cancel`, null, {
79
146
  headers: {
80
147
  ...this.client.defaults.headers.common,
81
148
  ...customHeader,
82
149
  },
83
- });
84
- return response.data;
150
+ }));
151
+ }
152
+ // 9. GET /jobs/:job_id/logs - get logs of a specific job from IBM
153
+ async getJobLogs(jobId) {
154
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}/logs`));
155
+ }
156
+ // 10. GET /jobs/:job_id/transpiled_circuits - get transpiled circuits of a specific job from IBM
157
+ async getJobTranspiledCircuits(jobId) {
158
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}/transpiled_circuits`));
159
+ }
160
+ // 11. GET /jobs/:job_id/metrics - get metrics of a specific job from IBM
161
+ async getJobMetrics(jobId) {
162
+ return this.handleJobRequest(this.client.get(`/jobs/${jobId}/metrics`));
85
163
  }
86
164
  }
87
165
  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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AAa,CAAC,KAAa;QAC/B,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAa,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC;IACtF,CAAC;CACF;AAxLD,wCAwLC"}
@@ -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, DeviceStatus, DeviceConfiguration, } from './types';
@@ -177,6 +177,28 @@ export interface Job {
177
177
  seconds: number;
178
178
  };
179
179
  }
180
+ export interface Timestamps {
181
+ created: string;
182
+ running: string;
183
+ finished: string;
184
+ }
185
+ export interface UsageMetrics {
186
+ quantum_seconds: number;
187
+ seconds: number;
188
+ }
189
+ export interface JobMetrics {
190
+ timestamps: Timestamps;
191
+ bss: {
192
+ seconds: number;
193
+ };
194
+ usage: UsageMetrics;
195
+ executions: number;
196
+ num_circuits: number;
197
+ num_qubits?: number[];
198
+ circuit_depths?: number[];
199
+ qiskit_version: string;
200
+ caller: string;
201
+ }
180
202
  export interface JobList {
181
203
  limit: number;
182
204
  offset: number;
@@ -196,22 +218,16 @@ export interface GetJobParams {
196
218
  session_id?: string;
197
219
  exclude_params?: boolean;
198
220
  }
199
- export interface RunJobResponse {
200
- id: string;
201
- backend: string;
202
- session_id?: string;
203
- }
204
- export interface ErrorResponse {
221
+ export interface Error {
205
222
  code: number;
206
223
  message: string;
207
224
  solution: string;
208
225
  more_info: string;
209
226
  }
210
- export interface CancelJobResponse {
211
- errors?: ErrorResponse[];
212
- trace?: string;
227
+ export interface APIErrorResponse {
228
+ errors: Error[];
229
+ trace: string;
213
230
  }
214
- export interface DeleteJobResponse {
215
- errors?: ErrorResponse[];
216
- trace?: string;
231
+ export interface JobTranspiledCircuitResponse {
232
+ url: string;
217
233
  }
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.8.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.",