@gpt-platform/client 0.4.0 → 0.4.1

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.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.0";
1227
+ var SDK_VERSION = "0.4.1";
1228
1228
  var DEFAULT_API_VERSION = "2026-02-27";
1229
1229
 
1230
1230
  // src/base-client.ts
@@ -3207,6 +3207,15 @@ var getVoiceTranscriptionResults = (options) => (options.client ?? client).get({
3207
3207
  url: "/voice/transcription-results",
3208
3208
  ...options
3209
3209
  });
3210
+ var postVoiceTranscriptionResults = (options) => (options.client ?? client).post({
3211
+ security: [{ scheme: "bearer", type: "http" }],
3212
+ url: "/voice/transcription-results",
3213
+ ...options,
3214
+ headers: {
3215
+ "Content-Type": "application/vnd.api+json",
3216
+ ...options.headers
3217
+ }
3218
+ });
3210
3219
  var getDataSubjectRequests = (options) => (options.client ?? client).get({
3211
3220
  security: [{ scheme: "bearer", type: "http" }],
3212
3221
  url: "/data-subject-requests",
@@ -3714,6 +3723,15 @@ var getLegalAcceptancesLatest = (options) => (options.client ?? client).get({
3714
3723
  url: "/legal-acceptances/latest",
3715
3724
  ...options
3716
3725
  });
3726
+ var postThreadsByIdComplete = (options) => (options.client ?? client).post({
3727
+ security: [{ scheme: "bearer", type: "http" }],
3728
+ url: "/threads/{id}/complete",
3729
+ ...options,
3730
+ headers: {
3731
+ "Content-Type": "application/vnd.api+json",
3732
+ ...options.headers
3733
+ }
3734
+ });
3717
3735
  var getWorkspacesShared = (options) => (options.client ?? client).get({
3718
3736
  security: [{ scheme: "bearer", type: "http" }],
3719
3737
  url: "/workspaces/shared",
@@ -4108,11 +4126,25 @@ var getAgentVersionRevisionsById = (options) => (options.client ?? client).get({
4108
4126
  url: "/agent-version-revisions/{id}",
4109
4127
  ...options
4110
4128
  });
4129
+ var deleteVoiceTranscriptionResultsById = (options) => (options.client ?? client).delete({
4130
+ security: [{ scheme: "bearer", type: "http" }],
4131
+ url: "/voice/transcription-results/{id}",
4132
+ ...options
4133
+ });
4111
4134
  var getVoiceTranscriptionResultsById = (options) => (options.client ?? client).get({
4112
4135
  security: [{ scheme: "bearer", type: "http" }],
4113
4136
  url: "/voice/transcription-results/{id}",
4114
4137
  ...options
4115
4138
  });
4139
+ var patchVoiceTranscriptionResultsById = (options) => (options.client ?? client).patch({
4140
+ security: [{ scheme: "bearer", type: "http" }],
4141
+ url: "/voice/transcription-results/{id}",
4142
+ ...options,
4143
+ headers: {
4144
+ "Content-Type": "application/vnd.api+json",
4145
+ ...options.headers
4146
+ }
4147
+ });
4116
4148
  var deleteFieldTemplatesById = (options) => (options.client ?? client).delete({
4117
4149
  security: [{ scheme: "bearer", type: "http" }],
4118
4150
  url: "/field-templates/{id}",
@@ -19241,6 +19273,75 @@ function createThreadsNamespace(rb) {
19241
19273
  streamOptions
19242
19274
  );
19243
19275
  }
19276
+ },
19277
+ /**
19278
+ * Trigger AI inference on a thread without sending a new user message.
19279
+ *
19280
+ * Runs the full RAG pipeline (VectorSearch + GraphLookup + SynthesizeResponse)
19281
+ * using the thread's last user message as query context. Saves the AI response
19282
+ * as an assistant message and returns the updated Thread.
19283
+ *
19284
+ * Use this to let the AI proactively continue a conversation — for example,
19285
+ * after a voice session finalizes, to generate a follow-up or summary without
19286
+ * requiring the user to explicitly ask.
19287
+ *
19288
+ * @param threadId - The UUID of the thread to run AI completion on.
19289
+ * @param options - Optional request options.
19290
+ * @returns A promise resolving to the updated `Thread` after the assistant
19291
+ * message has been saved.
19292
+ *
19293
+ * @example
19294
+ * ```typescript
19295
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
19296
+ *
19297
+ * // After a voice session finalizes, trigger AI continuation:
19298
+ * const thread = await client.threads.complete('thr_01HXYZ...');
19299
+ * console.log(`Thread updated at: ${thread.attributes?.updated_at}`);
19300
+ * ```
19301
+ */
19302
+ complete: async (threadId, options) => {
19303
+ return rb.execute(
19304
+ postThreadsByIdComplete,
19305
+ {
19306
+ path: { id: threadId },
19307
+ body: { data: { type: "thread", attributes: {} } }
19308
+ },
19309
+ options
19310
+ );
19311
+ },
19312
+ /**
19313
+ * Trigger AI inference on a thread and receive the response via Server-Sent Events.
19314
+ *
19315
+ * Identical to {@link complete} in behavior but delivers the result as an SSE
19316
+ * stream. The stream yields a single `StreamMessageChunk` with `done: true`
19317
+ * when the AI response is ready.
19318
+ *
19319
+ * Note: This endpoint delivers the full response as one event (not token-by-token).
19320
+ * It gives the frontend a consistent SSE interface for uniform handling of both
19321
+ * streaming and non-streaming completions.
19322
+ *
19323
+ * @param threadId - The UUID of the thread to run AI completion on.
19324
+ * @param options - Optional request options (e.g. abort signal).
19325
+ * @param streamOptions - Optional streaming configuration.
19326
+ * @returns A promise resolving to an `AsyncIterableIterator<StreamMessageChunk>`.
19327
+ *
19328
+ * @example
19329
+ * ```typescript
19330
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
19331
+ *
19332
+ * const stream = await client.threads.completeStream('thr_01HXYZ...');
19333
+ * for await (const chunk of stream) {
19334
+ * if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
19335
+ * }
19336
+ * ```
19337
+ */
19338
+ completeStream: async (threadId, options, streamOptions) => {
19339
+ return rb.streamRequest(
19340
+ `/threads/${threadId}/complete/stream`,
19341
+ {},
19342
+ options,
19343
+ streamOptions
19344
+ );
19244
19345
  }
19245
19346
  };
19246
19347
  }
@@ -20123,6 +20224,106 @@ function createVoiceNamespace(rb) {
20123
20224
  },
20124
20225
  options
20125
20226
  );
20227
+ },
20228
+ /**
20229
+ * Create a transcript record manually.
20230
+ *
20231
+ * Creates a `VoiceTranscriptionResult` record in the current workspace.
20232
+ * Useful when you have a pre-computed transcript (e.g. from an external STT
20233
+ * service) that you want to associate with a recording or session.
20234
+ *
20235
+ * @param attributes - Transcript data. Required: `text` (string).
20236
+ * Optional: `recording_id`, `session_id`, `document_id`, `segments`,
20237
+ * `language_detected`, `duration_seconds`, `processing_seconds`,
20238
+ * `stt_engine`, `stt_model`, `metadata`.
20239
+ * @param options - Optional request options.
20240
+ * @returns The created `VoiceTranscriptionResult`.
20241
+ *
20242
+ * @example
20243
+ * ```typescript
20244
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
20245
+ * const result = await client.voice.transcriptionResults.create({
20246
+ * text: 'Patient reports chest pain since this morning.',
20247
+ * session_id: 'vs_abc123',
20248
+ * language_detected: 'en',
20249
+ * duration_seconds: 47.2,
20250
+ * });
20251
+ * console.log(result.id);
20252
+ * ```
20253
+ */
20254
+ create: async (attributes, options) => {
20255
+ return rb.execute(
20256
+ postVoiceTranscriptionResults,
20257
+ {
20258
+ body: {
20259
+ data: {
20260
+ type: "voice_transcription_result",
20261
+ attributes
20262
+ }
20263
+ }
20264
+ },
20265
+ options
20266
+ );
20267
+ },
20268
+ /**
20269
+ * Update a transcript's text, segments, or metadata.
20270
+ *
20271
+ * Allows correcting transcript text after review, updating segments
20272
+ * with corrected timestamps or confidence scores, or annotating with
20273
+ * additional metadata. `recording_id`, `session_id`, and STT engine
20274
+ * fields are immutable after creation.
20275
+ *
20276
+ * @param id - The UUID of the transcription result to update.
20277
+ * @param attributes - Fields to update. One or more of: `text`, `segments`, `metadata`.
20278
+ * @param options - Optional request options.
20279
+ * @returns The updated `VoiceTranscriptionResult`.
20280
+ *
20281
+ * @example
20282
+ * ```typescript
20283
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
20284
+ * const updated = await client.voice.transcriptionResults.update('tr_abc123', {
20285
+ * text: 'Patient reports chest pain since yesterday morning.',
20286
+ * });
20287
+ * ```
20288
+ */
20289
+ update: async (id, attributes, options) => {
20290
+ return rb.execute(
20291
+ patchVoiceTranscriptionResultsById,
20292
+ {
20293
+ path: { id },
20294
+ body: {
20295
+ data: {
20296
+ id,
20297
+ type: "voice_transcription_result",
20298
+ attributes
20299
+ }
20300
+ }
20301
+ },
20302
+ options
20303
+ );
20304
+ },
20305
+ /**
20306
+ * Delete a transcription result by its ID.
20307
+ *
20308
+ * Permanently removes the transcript record. Associated recordings and
20309
+ * voice sessions are not affected.
20310
+ *
20311
+ * @param id - The UUID of the transcription result to delete.
20312
+ * @param options - Optional request options.
20313
+ * @returns A promise that resolves when the record is deleted.
20314
+ *
20315
+ * @example
20316
+ * ```typescript
20317
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
20318
+ * await client.voice.transcriptionResults.destroy('tr_abc123');
20319
+ * ```
20320
+ */
20321
+ destroy: async (id, options) => {
20322
+ await rb.executeDelete(
20323
+ deleteVoiceTranscriptionResultsById,
20324
+ { path: { id } },
20325
+ options
20326
+ );
20126
20327
  }
20127
20328
  }
20128
20329
  };