@gpt-platform/client 0.4.0 → 0.4.2
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.
- package/dist/index.d.mts +540 -17
- package/dist/index.d.ts +540 -17
- package/dist/index.js +398 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +398 -13
- package/dist/index.mjs.map +1 -1
- package/llms.txt +4 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1224,7 +1224,7 @@ function buildUserAgent(sdkVersion, appInfo) {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
1226
|
// src/version.ts
|
|
1227
|
-
var SDK_VERSION = "0.4.
|
|
1227
|
+
var SDK_VERSION = "0.4.2";
|
|
1228
1228
|
var DEFAULT_API_VERSION = "2026-02-27";
|
|
1229
1229
|
|
|
1230
1230
|
// src/base-client.ts
|
|
@@ -1690,6 +1690,15 @@ var postEmailOutboundEmails = (options) => (options.client ?? client).post({
|
|
|
1690
1690
|
...options.headers
|
|
1691
1691
|
}
|
|
1692
1692
|
});
|
|
1693
|
+
var patchWalletCredits = (options) => (options.client ?? client).patch({
|
|
1694
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1695
|
+
url: "/wallet/credits",
|
|
1696
|
+
...options,
|
|
1697
|
+
headers: {
|
|
1698
|
+
"Content-Type": "application/vnd.api+json",
|
|
1699
|
+
...options.headers
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1693
1702
|
var getCrmCustomEntitiesWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1694
1703
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1695
1704
|
url: "/crm/custom-entities/workspace/{workspace_id}",
|
|
@@ -2172,6 +2181,15 @@ var postAgentsByIdRestoreVersion = (options) => (options.client ?? client).post(
|
|
|
2172
2181
|
...options.headers
|
|
2173
2182
|
}
|
|
2174
2183
|
});
|
|
2184
|
+
var patchWalletAutoTopUp = (options) => (options.client ?? client).patch({
|
|
2185
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2186
|
+
url: "/wallet/auto-top-up",
|
|
2187
|
+
...options,
|
|
2188
|
+
headers: {
|
|
2189
|
+
"Content-Type": "application/vnd.api+json",
|
|
2190
|
+
...options.headers
|
|
2191
|
+
}
|
|
2192
|
+
});
|
|
2175
2193
|
var postTokens = (options) => (options.client ?? client).post({
|
|
2176
2194
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2177
2195
|
url: "/tokens",
|
|
@@ -3207,6 +3225,15 @@ var getVoiceTranscriptionResults = (options) => (options.client ?? client).get({
|
|
|
3207
3225
|
url: "/voice/transcription-results",
|
|
3208
3226
|
...options
|
|
3209
3227
|
});
|
|
3228
|
+
var postVoiceTranscriptionResults = (options) => (options.client ?? client).post({
|
|
3229
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3230
|
+
url: "/voice/transcription-results",
|
|
3231
|
+
...options,
|
|
3232
|
+
headers: {
|
|
3233
|
+
"Content-Type": "application/vnd.api+json",
|
|
3234
|
+
...options.headers
|
|
3235
|
+
}
|
|
3236
|
+
});
|
|
3210
3237
|
var getDataSubjectRequests = (options) => (options.client ?? client).get({
|
|
3211
3238
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3212
3239
|
url: "/data-subject-requests",
|
|
@@ -3366,6 +3393,11 @@ var getExtractionSchemaDiscoveriesById = (options) => (options.client ?? client)
|
|
|
3366
3393
|
url: "/extraction/schema-discoveries/{id}",
|
|
3367
3394
|
...options
|
|
3368
3395
|
});
|
|
3396
|
+
var getWalletInvoices = (options) => (options.client ?? client).get({
|
|
3397
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3398
|
+
url: "/wallet/invoices",
|
|
3399
|
+
...options
|
|
3400
|
+
});
|
|
3369
3401
|
var getFieldTemplates = (options) => (options.client ?? client).get({
|
|
3370
3402
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3371
3403
|
url: "/field-templates",
|
|
@@ -3451,6 +3483,15 @@ var postDocumentsPresignedUpload = (options) => (options.client ?? client).post(
|
|
|
3451
3483
|
...options.headers
|
|
3452
3484
|
}
|
|
3453
3485
|
});
|
|
3486
|
+
var postPaymentMethodsTokenize = (options) => (options.client ?? client).post({
|
|
3487
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3488
|
+
url: "/payment-methods/tokenize",
|
|
3489
|
+
...options,
|
|
3490
|
+
headers: {
|
|
3491
|
+
"Content-Type": "application/vnd.api+json",
|
|
3492
|
+
...options.headers
|
|
3493
|
+
}
|
|
3494
|
+
});
|
|
3454
3495
|
var getCrmContactsWorkspaceByWorkspaceIdArchived = (options) => (options.client ?? client).get({
|
|
3455
3496
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3456
3497
|
url: "/crm/contacts/workspace/{workspace_id}/archived",
|
|
@@ -3714,6 +3755,15 @@ var getLegalAcceptancesLatest = (options) => (options.client ?? client).get({
|
|
|
3714
3755
|
url: "/legal-acceptances/latest",
|
|
3715
3756
|
...options
|
|
3716
3757
|
});
|
|
3758
|
+
var postThreadsByIdComplete = (options) => (options.client ?? client).post({
|
|
3759
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3760
|
+
url: "/threads/{id}/complete",
|
|
3761
|
+
...options,
|
|
3762
|
+
headers: {
|
|
3763
|
+
"Content-Type": "application/vnd.api+json",
|
|
3764
|
+
...options.headers
|
|
3765
|
+
}
|
|
3766
|
+
});
|
|
3717
3767
|
var getWorkspacesShared = (options) => (options.client ?? client).get({
|
|
3718
3768
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3719
3769
|
url: "/workspaces/shared",
|
|
@@ -3811,6 +3861,15 @@ var postSearchSavedByIdRun = (options) => (options.client ?? client).post({
|
|
|
3811
3861
|
...options.headers
|
|
3812
3862
|
}
|
|
3813
3863
|
});
|
|
3864
|
+
var patchWalletPlan = (options) => (options.client ?? client).patch({
|
|
3865
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3866
|
+
url: "/wallet/plan",
|
|
3867
|
+
...options,
|
|
3868
|
+
headers: {
|
|
3869
|
+
"Content-Type": "application/vnd.api+json",
|
|
3870
|
+
...options.headers
|
|
3871
|
+
}
|
|
3872
|
+
});
|
|
3814
3873
|
var deleteCatalogProductsById = (options) => (options.client ?? client).delete({
|
|
3815
3874
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3816
3875
|
url: "/catalog/products/{id}",
|
|
@@ -4108,11 +4167,25 @@ var getAgentVersionRevisionsById = (options) => (options.client ?? client).get({
|
|
|
4108
4167
|
url: "/agent-version-revisions/{id}",
|
|
4109
4168
|
...options
|
|
4110
4169
|
});
|
|
4170
|
+
var deleteVoiceTranscriptionResultsById = (options) => (options.client ?? client).delete({
|
|
4171
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4172
|
+
url: "/voice/transcription-results/{id}",
|
|
4173
|
+
...options
|
|
4174
|
+
});
|
|
4111
4175
|
var getVoiceTranscriptionResultsById = (options) => (options.client ?? client).get({
|
|
4112
4176
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4113
4177
|
url: "/voice/transcription-results/{id}",
|
|
4114
4178
|
...options
|
|
4115
4179
|
});
|
|
4180
|
+
var patchVoiceTranscriptionResultsById = (options) => (options.client ?? client).patch({
|
|
4181
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4182
|
+
url: "/voice/transcription-results/{id}",
|
|
4183
|
+
...options,
|
|
4184
|
+
headers: {
|
|
4185
|
+
"Content-Type": "application/vnd.api+json",
|
|
4186
|
+
...options.headers
|
|
4187
|
+
}
|
|
4188
|
+
});
|
|
4116
4189
|
var deleteFieldTemplatesById = (options) => (options.client ?? client).delete({
|
|
4117
4190
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4118
4191
|
url: "/field-templates/{id}",
|
|
@@ -4407,6 +4480,11 @@ var postSupportTags = (options) => (options.client ?? client).post({
|
|
|
4407
4480
|
...options.headers
|
|
4408
4481
|
}
|
|
4409
4482
|
});
|
|
4483
|
+
var getWalletPlanPreview = (options) => (options.client ?? client).get({
|
|
4484
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4485
|
+
url: "/wallet/plan/preview",
|
|
4486
|
+
...options
|
|
4487
|
+
});
|
|
4410
4488
|
var postAgentVersionsByIdSetSystemFields = (options) => (options.client ?? client).post({
|
|
4411
4489
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4412
4490
|
url: "/agent-versions/{id}/set-system-fields",
|
|
@@ -7102,22 +7180,139 @@ function createBillingNamespace(rb) {
|
|
|
7102
7180
|
/**
|
|
7103
7181
|
* Retrieves the current workspace wallet, including the available credit
|
|
7104
7182
|
* balance, usage totals, and any pending charges.
|
|
7183
|
+
*/
|
|
7184
|
+
get: async (options) => {
|
|
7185
|
+
return rb.execute(getWallet, {}, options);
|
|
7186
|
+
},
|
|
7187
|
+
/**
|
|
7188
|
+
* Preview the cost and effective date of a plan change before committing.
|
|
7105
7189
|
*
|
|
7106
|
-
* @param
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7190
|
+
* @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
|
|
7191
|
+
*/
|
|
7192
|
+
previewPlanChange: async (planSlug, options) => {
|
|
7193
|
+
return rb.execute(
|
|
7194
|
+
getWalletPlanPreview,
|
|
7195
|
+
{ query: { plan_slug: planSlug } },
|
|
7196
|
+
options
|
|
7197
|
+
);
|
|
7198
|
+
},
|
|
7199
|
+
/**
|
|
7200
|
+
* Change the workspace's subscription plan.
|
|
7110
7201
|
*
|
|
7111
|
-
*
|
|
7112
|
-
*
|
|
7113
|
-
*
|
|
7202
|
+
* Upgrades charge a prorated amount immediately against the default payment
|
|
7203
|
+
* method. Downgrades are deferred to the end of the current billing period.
|
|
7204
|
+
* Use `previewPlanChange` first to show the user a cost estimate.
|
|
7114
7205
|
*
|
|
7115
|
-
*
|
|
7116
|
-
*
|
|
7117
|
-
* ```
|
|
7206
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7207
|
+
* @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
|
|
7118
7208
|
*/
|
|
7119
|
-
|
|
7120
|
-
return rb.execute(
|
|
7209
|
+
changePlan: async (walletId, planSlug, options) => {
|
|
7210
|
+
return rb.execute(
|
|
7211
|
+
patchWalletPlan,
|
|
7212
|
+
{
|
|
7213
|
+
body: {
|
|
7214
|
+
data: {
|
|
7215
|
+
id: walletId,
|
|
7216
|
+
type: "wallet",
|
|
7217
|
+
attributes: { plan_slug: planSlug }
|
|
7218
|
+
}
|
|
7219
|
+
}
|
|
7220
|
+
},
|
|
7221
|
+
options
|
|
7222
|
+
);
|
|
7223
|
+
},
|
|
7224
|
+
/**
|
|
7225
|
+
* Purchase a credit package to top up the workspace wallet immediately.
|
|
7226
|
+
*
|
|
7227
|
+
* Charges the specified (or default) payment method. Credits are added to
|
|
7228
|
+
* the `purchased` bucket and never expire.
|
|
7229
|
+
*
|
|
7230
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7231
|
+
* @param packageSlug - The slug of the credit package to purchase.
|
|
7232
|
+
* @param paymentMethodId - Optional payment method UUID. Uses the default if omitted.
|
|
7233
|
+
*/
|
|
7234
|
+
buyCredits: async (walletId, packageSlug, paymentMethodId, options) => {
|
|
7235
|
+
const attributes = {
|
|
7236
|
+
package_slug: packageSlug
|
|
7237
|
+
};
|
|
7238
|
+
if (paymentMethodId !== void 0) {
|
|
7239
|
+
attributes.payment_method_id = paymentMethodId;
|
|
7240
|
+
}
|
|
7241
|
+
return rb.execute(
|
|
7242
|
+
patchWalletCredits,
|
|
7243
|
+
{ body: { data: { id: walletId, type: "wallet", attributes } } },
|
|
7244
|
+
options
|
|
7245
|
+
);
|
|
7246
|
+
},
|
|
7247
|
+
/**
|
|
7248
|
+
* Update the workspace's auto top-up settings.
|
|
7249
|
+
*
|
|
7250
|
+
* When enabled, the platform automatically purchases the specified credit
|
|
7251
|
+
* package whenever the balance drops below `threshold`.
|
|
7252
|
+
*
|
|
7253
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7254
|
+
* @param opts.enabled - Enable or disable auto top-up.
|
|
7255
|
+
* @param opts.threshold - Credit balance floor that triggers a purchase.
|
|
7256
|
+
* @param opts.amount - Credits to purchase per top-up event.
|
|
7257
|
+
* @param opts.packageId - Credit package UUID to auto-purchase.
|
|
7258
|
+
*/
|
|
7259
|
+
updateAutoTopUp: async (walletId, opts, options) => {
|
|
7260
|
+
const attributes = { enabled: opts.enabled };
|
|
7261
|
+
if (opts.threshold !== void 0) attributes.threshold = opts.threshold;
|
|
7262
|
+
if (opts.amount !== void 0) attributes.amount = opts.amount;
|
|
7263
|
+
if (opts.packageId !== void 0)
|
|
7264
|
+
attributes.package_id = opts.packageId;
|
|
7265
|
+
return rb.execute(
|
|
7266
|
+
patchWalletAutoTopUp,
|
|
7267
|
+
{ body: { data: { id: walletId, type: "wallet", attributes } } },
|
|
7268
|
+
options
|
|
7269
|
+
);
|
|
7270
|
+
},
|
|
7271
|
+
/**
|
|
7272
|
+
* Sub-namespace for invoice operations.
|
|
7273
|
+
*
|
|
7274
|
+
* Invoices are generated per billing period and carry a `pdf_url` for
|
|
7275
|
+
* receipt download. Use `invoices.list()` for the transaction history page.
|
|
7276
|
+
*/
|
|
7277
|
+
invoices: {
|
|
7278
|
+
/**
|
|
7279
|
+
* Returns a single page of invoices for the current workspace.
|
|
7280
|
+
*
|
|
7281
|
+
* Each invoice includes `pdf_url` for receipt download.
|
|
7282
|
+
*
|
|
7283
|
+
* @example
|
|
7284
|
+
* ```typescript
|
|
7285
|
+
* const invoices = await client.billing.wallet.invoices.list();
|
|
7286
|
+
* const paidInvoices = invoices.filter(inv => inv.attributes?.status === "paid");
|
|
7287
|
+
* ```
|
|
7288
|
+
*/
|
|
7289
|
+
list: async (options) => {
|
|
7290
|
+
return rb.execute(
|
|
7291
|
+
getWalletInvoices,
|
|
7292
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
7293
|
+
options
|
|
7294
|
+
);
|
|
7295
|
+
},
|
|
7296
|
+
/**
|
|
7297
|
+
* Fetches all invoices by automatically paginating through every page.
|
|
7298
|
+
*
|
|
7299
|
+
* @example
|
|
7300
|
+
* ```typescript
|
|
7301
|
+
* const all = await client.billing.wallet.invoices.listAll();
|
|
7302
|
+
* const downloadUrl = all[0].attributes?.pdf_url;
|
|
7303
|
+
* ```
|
|
7304
|
+
*/
|
|
7305
|
+
listAll: async (options) => {
|
|
7306
|
+
return paginateToArray(
|
|
7307
|
+
rb.createPaginatedFetcher(
|
|
7308
|
+
getWalletInvoices,
|
|
7309
|
+
(page, pageSize) => ({
|
|
7310
|
+
query: { page: { number: page, size: pageSize } }
|
|
7311
|
+
}),
|
|
7312
|
+
options
|
|
7313
|
+
)
|
|
7314
|
+
);
|
|
7315
|
+
}
|
|
7121
7316
|
}
|
|
7122
7317
|
},
|
|
7123
7318
|
/**
|
|
@@ -7505,6 +7700,27 @@ function createBillingNamespace(rb) {
|
|
|
7505
7700
|
options
|
|
7506
7701
|
);
|
|
7507
7702
|
},
|
|
7703
|
+
/**
|
|
7704
|
+
* Tokenizes a raw card server-side and saves the resulting payment method.
|
|
7705
|
+
*
|
|
7706
|
+
* Use this for direct card collection flows where your server handles card
|
|
7707
|
+
* data (PCI-DSS scope applies). The platform tokenizes the card with QorPay
|
|
7708
|
+
* and stores only the token — raw card data is never persisted.
|
|
7709
|
+
*
|
|
7710
|
+
* For hosted-fields flows where the client tokenizes the card, use
|
|
7711
|
+
* `paymentMethods.create({ provider_token })` instead.
|
|
7712
|
+
*
|
|
7713
|
+
* @param cardDetails - Raw card fields including number, CVC, expiry, and billing address.
|
|
7714
|
+
*/
|
|
7715
|
+
tokenize: async (cardDetails, options) => {
|
|
7716
|
+
return rb.execute(
|
|
7717
|
+
postPaymentMethodsTokenize,
|
|
7718
|
+
{
|
|
7719
|
+
body: { data: { type: "payment_method", attributes: cardDetails } }
|
|
7720
|
+
},
|
|
7721
|
+
options
|
|
7722
|
+
);
|
|
7723
|
+
},
|
|
7508
7724
|
/**
|
|
7509
7725
|
* Updates the mutable attributes of an existing payment method, such as
|
|
7510
7726
|
* the billing name or expiry date override.
|
|
@@ -19241,6 +19457,75 @@ function createThreadsNamespace(rb) {
|
|
|
19241
19457
|
streamOptions
|
|
19242
19458
|
);
|
|
19243
19459
|
}
|
|
19460
|
+
},
|
|
19461
|
+
/**
|
|
19462
|
+
* Trigger AI inference on a thread without sending a new user message.
|
|
19463
|
+
*
|
|
19464
|
+
* Runs the full RAG pipeline (VectorSearch + GraphLookup + SynthesizeResponse)
|
|
19465
|
+
* using the thread's last user message as query context. Saves the AI response
|
|
19466
|
+
* as an assistant message and returns the updated Thread.
|
|
19467
|
+
*
|
|
19468
|
+
* Use this to let the AI proactively continue a conversation — for example,
|
|
19469
|
+
* after a voice session finalizes, to generate a follow-up or summary without
|
|
19470
|
+
* requiring the user to explicitly ask.
|
|
19471
|
+
*
|
|
19472
|
+
* @param threadId - The UUID of the thread to run AI completion on.
|
|
19473
|
+
* @param options - Optional request options.
|
|
19474
|
+
* @returns A promise resolving to the updated `Thread` after the assistant
|
|
19475
|
+
* message has been saved.
|
|
19476
|
+
*
|
|
19477
|
+
* @example
|
|
19478
|
+
* ```typescript
|
|
19479
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
19480
|
+
*
|
|
19481
|
+
* // After a voice session finalizes, trigger AI continuation:
|
|
19482
|
+
* const thread = await client.threads.complete('thr_01HXYZ...');
|
|
19483
|
+
* console.log(`Thread updated at: ${thread.attributes?.updated_at}`);
|
|
19484
|
+
* ```
|
|
19485
|
+
*/
|
|
19486
|
+
complete: async (threadId, options) => {
|
|
19487
|
+
return rb.execute(
|
|
19488
|
+
postThreadsByIdComplete,
|
|
19489
|
+
{
|
|
19490
|
+
path: { id: threadId },
|
|
19491
|
+
body: { data: { type: "thread", attributes: {} } }
|
|
19492
|
+
},
|
|
19493
|
+
options
|
|
19494
|
+
);
|
|
19495
|
+
},
|
|
19496
|
+
/**
|
|
19497
|
+
* Trigger AI inference on a thread and receive the response via Server-Sent Events.
|
|
19498
|
+
*
|
|
19499
|
+
* Identical to {@link complete} in behavior but delivers the result as an SSE
|
|
19500
|
+
* stream. The stream yields a single `StreamMessageChunk` with `done: true`
|
|
19501
|
+
* when the AI response is ready.
|
|
19502
|
+
*
|
|
19503
|
+
* Note: This endpoint delivers the full response as one event (not token-by-token).
|
|
19504
|
+
* It gives the frontend a consistent SSE interface for uniform handling of both
|
|
19505
|
+
* streaming and non-streaming completions.
|
|
19506
|
+
*
|
|
19507
|
+
* @param threadId - The UUID of the thread to run AI completion on.
|
|
19508
|
+
* @param options - Optional request options (e.g. abort signal).
|
|
19509
|
+
* @param streamOptions - Optional streaming configuration.
|
|
19510
|
+
* @returns A promise resolving to an `AsyncIterableIterator<StreamMessageChunk>`.
|
|
19511
|
+
*
|
|
19512
|
+
* @example
|
|
19513
|
+
* ```typescript
|
|
19514
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
19515
|
+
*
|
|
19516
|
+
* const stream = await client.threads.completeStream('thr_01HXYZ...');
|
|
19517
|
+
* for await (const chunk of stream) {
|
|
19518
|
+
* if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
|
|
19519
|
+
* }
|
|
19520
|
+
* ```
|
|
19521
|
+
*/
|
|
19522
|
+
completeStream: async (threadId, options, streamOptions) => {
|
|
19523
|
+
return rb.streamRequest(
|
|
19524
|
+
`/threads/${threadId}/complete/stream`,
|
|
19525
|
+
{},
|
|
19526
|
+
options,
|
|
19527
|
+
streamOptions
|
|
19528
|
+
);
|
|
19244
19529
|
}
|
|
19245
19530
|
};
|
|
19246
19531
|
}
|
|
@@ -20123,6 +20408,106 @@ function createVoiceNamespace(rb) {
|
|
|
20123
20408
|
},
|
|
20124
20409
|
options
|
|
20125
20410
|
);
|
|
20411
|
+
},
|
|
20412
|
+
/**
|
|
20413
|
+
* Create a transcript record manually.
|
|
20414
|
+
*
|
|
20415
|
+
* Creates a `VoiceTranscriptionResult` record in the current workspace.
|
|
20416
|
+
* Useful when you have a pre-computed transcript (e.g. from an external STT
|
|
20417
|
+
* service) that you want to associate with a recording or session.
|
|
20418
|
+
*
|
|
20419
|
+
* @param attributes - Transcript data. Required: `text` (string).
|
|
20420
|
+
* Optional: `recording_id`, `session_id`, `document_id`, `segments`,
|
|
20421
|
+
* `language_detected`, `duration_seconds`, `processing_seconds`,
|
|
20422
|
+
* `stt_engine`, `stt_model`, `metadata`.
|
|
20423
|
+
* @param options - Optional request options.
|
|
20424
|
+
* @returns The created `VoiceTranscriptionResult`.
|
|
20425
|
+
*
|
|
20426
|
+
* @example
|
|
20427
|
+
* ```typescript
|
|
20428
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
20429
|
+
* const result = await client.voice.transcriptionResults.create({
|
|
20430
|
+
* text: 'Patient reports chest pain since this morning.',
|
|
20431
|
+
* session_id: 'vs_abc123',
|
|
20432
|
+
* language_detected: 'en',
|
|
20433
|
+
* duration_seconds: 47.2,
|
|
20434
|
+
* });
|
|
20435
|
+
* console.log(result.id);
|
|
20436
|
+
* ```
|
|
20437
|
+
*/
|
|
20438
|
+
create: async (attributes, options) => {
|
|
20439
|
+
return rb.execute(
|
|
20440
|
+
postVoiceTranscriptionResults,
|
|
20441
|
+
{
|
|
20442
|
+
body: {
|
|
20443
|
+
data: {
|
|
20444
|
+
type: "voice_transcription_result",
|
|
20445
|
+
attributes
|
|
20446
|
+
}
|
|
20447
|
+
}
|
|
20448
|
+
},
|
|
20449
|
+
options
|
|
20450
|
+
);
|
|
20451
|
+
},
|
|
20452
|
+
/**
|
|
20453
|
+
* Update a transcript's text, segments, or metadata.
|
|
20454
|
+
*
|
|
20455
|
+
* Allows correcting transcript text after review, updating segments
|
|
20456
|
+
* with corrected timestamps or confidence scores, or annotating with
|
|
20457
|
+
* additional metadata. `recording_id`, `session_id`, and STT engine
|
|
20458
|
+
* fields are immutable after creation.
|
|
20459
|
+
*
|
|
20460
|
+
* @param id - The UUID of the transcription result to update.
|
|
20461
|
+
* @param attributes - Fields to update. One or more of: `text`, `segments`, `metadata`.
|
|
20462
|
+
* @param options - Optional request options.
|
|
20463
|
+
* @returns The updated `VoiceTranscriptionResult`.
|
|
20464
|
+
*
|
|
20465
|
+
* @example
|
|
20466
|
+
* ```typescript
|
|
20467
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
20468
|
+
* const updated = await client.voice.transcriptionResults.update('tr_abc123', {
|
|
20469
|
+
* text: 'Patient reports chest pain since yesterday morning.',
|
|
20470
|
+
* });
|
|
20471
|
+
* ```
|
|
20472
|
+
*/
|
|
20473
|
+
update: async (id, attributes, options) => {
|
|
20474
|
+
return rb.execute(
|
|
20475
|
+
patchVoiceTranscriptionResultsById,
|
|
20476
|
+
{
|
|
20477
|
+
path: { id },
|
|
20478
|
+
body: {
|
|
20479
|
+
data: {
|
|
20480
|
+
id,
|
|
20481
|
+
type: "voice_transcription_result",
|
|
20482
|
+
attributes
|
|
20483
|
+
}
|
|
20484
|
+
}
|
|
20485
|
+
},
|
|
20486
|
+
options
|
|
20487
|
+
);
|
|
20488
|
+
},
|
|
20489
|
+
/**
|
|
20490
|
+
* Delete a transcription result by its ID.
|
|
20491
|
+
*
|
|
20492
|
+
* Permanently removes the transcript record. Associated recordings and
|
|
20493
|
+
* voice sessions are not affected.
|
|
20494
|
+
*
|
|
20495
|
+
* @param id - The UUID of the transcription result to delete.
|
|
20496
|
+
* @param options - Optional request options.
|
|
20497
|
+
* @returns A promise that resolves when the record is deleted.
|
|
20498
|
+
*
|
|
20499
|
+
* @example
|
|
20500
|
+
* ```typescript
|
|
20501
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
20502
|
+
* await client.voice.transcriptionResults.destroy('tr_abc123');
|
|
20503
|
+
* ```
|
|
20504
|
+
*/
|
|
20505
|
+
destroy: async (id, options) => {
|
|
20506
|
+
await rb.executeDelete(
|
|
20507
|
+
deleteVoiceTranscriptionResultsById,
|
|
20508
|
+
{ path: { id } },
|
|
20509
|
+
options
|
|
20510
|
+
);
|
|
20126
20511
|
}
|
|
20127
20512
|
}
|
|
20128
20513
|
};
|