@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.d.mts CHANGED
@@ -575,7 +575,7 @@ declare class BrowserApiKeyError extends Error {
575
575
  }
576
576
 
577
577
  /** SDK version — updated automatically by mix update.sdks */
578
- declare const SDK_VERSION = "0.4.0";
578
+ declare const SDK_VERSION = "0.4.1";
579
579
  /** Default API version sent in every request — updated automatically by mix update.sdks */
580
580
  declare const DEFAULT_API_VERSION = "2026-02-27";
581
581
 
@@ -7100,6 +7100,98 @@ declare function createVoiceNamespace(rb: RequestBuilder): {
7100
7100
  page?: number;
7101
7101
  pageSize?: number;
7102
7102
  } & RequestOptions) => Promise<VoiceTranscriptionResult[]>;
7103
+ /**
7104
+ * Create a transcript record manually.
7105
+ *
7106
+ * Creates a `VoiceTranscriptionResult` record in the current workspace.
7107
+ * Useful when you have a pre-computed transcript (e.g. from an external STT
7108
+ * service) that you want to associate with a recording or session.
7109
+ *
7110
+ * @param attributes - Transcript data. Required: `text` (string).
7111
+ * Optional: `recording_id`, `session_id`, `document_id`, `segments`,
7112
+ * `language_detected`, `duration_seconds`, `processing_seconds`,
7113
+ * `stt_engine`, `stt_model`, `metadata`.
7114
+ * @param options - Optional request options.
7115
+ * @returns The created `VoiceTranscriptionResult`.
7116
+ *
7117
+ * @example
7118
+ * ```typescript
7119
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
7120
+ * const result = await client.voice.transcriptionResults.create({
7121
+ * text: 'Patient reports chest pain since this morning.',
7122
+ * session_id: 'vs_abc123',
7123
+ * language_detected: 'en',
7124
+ * duration_seconds: 47.2,
7125
+ * });
7126
+ * console.log(result.id);
7127
+ * ```
7128
+ */
7129
+ create: (attributes: {
7130
+ text: string;
7131
+ recording_id?: string;
7132
+ session_id?: string;
7133
+ document_id?: string;
7134
+ segments?: Array<{
7135
+ text: string;
7136
+ start: number;
7137
+ end: number;
7138
+ confidence?: number;
7139
+ }>;
7140
+ language_detected?: string;
7141
+ duration_seconds?: number;
7142
+ processing_seconds?: number;
7143
+ stt_engine?: string;
7144
+ stt_model?: string;
7145
+ metadata?: Record<string, unknown>;
7146
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
7147
+ /**
7148
+ * Update a transcript's text, segments, or metadata.
7149
+ *
7150
+ * Allows correcting transcript text after review, updating segments
7151
+ * with corrected timestamps or confidence scores, or annotating with
7152
+ * additional metadata. `recording_id`, `session_id`, and STT engine
7153
+ * fields are immutable after creation.
7154
+ *
7155
+ * @param id - The UUID of the transcription result to update.
7156
+ * @param attributes - Fields to update. One or more of: `text`, `segments`, `metadata`.
7157
+ * @param options - Optional request options.
7158
+ * @returns The updated `VoiceTranscriptionResult`.
7159
+ *
7160
+ * @example
7161
+ * ```typescript
7162
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
7163
+ * const updated = await client.voice.transcriptionResults.update('tr_abc123', {
7164
+ * text: 'Patient reports chest pain since yesterday morning.',
7165
+ * });
7166
+ * ```
7167
+ */
7168
+ update: (id: string, attributes: {
7169
+ text?: string;
7170
+ segments?: Array<{
7171
+ text: string;
7172
+ start: number;
7173
+ end: number;
7174
+ confidence?: number;
7175
+ }>;
7176
+ metadata?: Record<string, unknown>;
7177
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
7178
+ /**
7179
+ * Delete a transcription result by its ID.
7180
+ *
7181
+ * Permanently removes the transcript record. Associated recordings and
7182
+ * voice sessions are not affected.
7183
+ *
7184
+ * @param id - The UUID of the transcription result to delete.
7185
+ * @param options - Optional request options.
7186
+ * @returns A promise that resolves when the record is deleted.
7187
+ *
7188
+ * @example
7189
+ * ```typescript
7190
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
7191
+ * await client.voice.transcriptionResults.destroy('tr_abc123');
7192
+ * ```
7193
+ */
7194
+ destroy: (id: string, options?: RequestOptions) => Promise<void>;
7103
7195
  };
7104
7196
  };
7105
7197
 
@@ -11960,6 +12052,8 @@ declare class GptClient extends BaseClient {
11960
12052
  send: (threadId: string, content: string, attributes?: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
11961
12053
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
11962
12054
  };
12055
+ complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
12056
+ completeStream: (threadId: string, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
11963
12057
  };
11964
12058
  /** Training examples and sessions */
11965
12059
  readonly training: {
@@ -12046,6 +12140,35 @@ declare class GptClient extends BaseClient {
12046
12140
  page?: number;
12047
12141
  pageSize?: number;
12048
12142
  } & RequestOptions) => Promise<VoiceTranscriptionResult[]>;
12143
+ create: (attributes: {
12144
+ text: string;
12145
+ recording_id?: string;
12146
+ session_id?: string;
12147
+ document_id?: string;
12148
+ segments?: Array<{
12149
+ text: string;
12150
+ start: number;
12151
+ end: number;
12152
+ confidence?: number;
12153
+ }>;
12154
+ language_detected?: string;
12155
+ duration_seconds?: number;
12156
+ processing_seconds?: number;
12157
+ stt_engine?: string;
12158
+ stt_model?: string;
12159
+ metadata?: Record<string, unknown>;
12160
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
12161
+ update: (id: string, attributes: {
12162
+ text?: string;
12163
+ segments?: Array<{
12164
+ text: string;
12165
+ start: number;
12166
+ end: number;
12167
+ confidence?: number;
12168
+ }>;
12169
+ metadata?: Record<string, unknown>;
12170
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
12171
+ destroy: (id: string, options?: RequestOptions) => Promise<void>;
12049
12172
  };
12050
12173
  };
12051
12174
  /** File watcher claims and event management */
@@ -12612,6 +12735,59 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12612
12735
  */
12613
12736
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
12614
12737
  };
12738
+ /**
12739
+ * Trigger AI inference on a thread without sending a new user message.
12740
+ *
12741
+ * Runs the full RAG pipeline (VectorSearch + GraphLookup + SynthesizeResponse)
12742
+ * using the thread's last user message as query context. Saves the AI response
12743
+ * as an assistant message and returns the updated Thread.
12744
+ *
12745
+ * Use this to let the AI proactively continue a conversation — for example,
12746
+ * after a voice session finalizes, to generate a follow-up or summary without
12747
+ * requiring the user to explicitly ask.
12748
+ *
12749
+ * @param threadId - The UUID of the thread to run AI completion on.
12750
+ * @param options - Optional request options.
12751
+ * @returns A promise resolving to the updated `Thread` after the assistant
12752
+ * message has been saved.
12753
+ *
12754
+ * @example
12755
+ * ```typescript
12756
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
12757
+ *
12758
+ * // After a voice session finalizes, trigger AI continuation:
12759
+ * const thread = await client.threads.complete('thr_01HXYZ...');
12760
+ * console.log(`Thread updated at: ${thread.attributes?.updated_at}`);
12761
+ * ```
12762
+ */
12763
+ complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
12764
+ /**
12765
+ * Trigger AI inference on a thread and receive the response via Server-Sent Events.
12766
+ *
12767
+ * Identical to {@link complete} in behavior but delivers the result as an SSE
12768
+ * stream. The stream yields a single `StreamMessageChunk` with `done: true`
12769
+ * when the AI response is ready.
12770
+ *
12771
+ * Note: This endpoint delivers the full response as one event (not token-by-token).
12772
+ * It gives the frontend a consistent SSE interface for uniform handling of both
12773
+ * streaming and non-streaming completions.
12774
+ *
12775
+ * @param threadId - The UUID of the thread to run AI completion on.
12776
+ * @param options - Optional request options (e.g. abort signal).
12777
+ * @param streamOptions - Optional streaming configuration.
12778
+ * @returns A promise resolving to an `AsyncIterableIterator<StreamMessageChunk>`.
12779
+ *
12780
+ * @example
12781
+ * ```typescript
12782
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
12783
+ *
12784
+ * const stream = await client.threads.completeStream('thr_01HXYZ...');
12785
+ * for await (const chunk of stream) {
12786
+ * if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
12787
+ * }
12788
+ * ```
12789
+ */
12790
+ completeStream: (threadId: string, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
12615
12791
  };
12616
12792
 
12617
12793
  /**
package/dist/index.d.ts CHANGED
@@ -575,7 +575,7 @@ declare class BrowserApiKeyError extends Error {
575
575
  }
576
576
 
577
577
  /** SDK version — updated automatically by mix update.sdks */
578
- declare const SDK_VERSION = "0.4.0";
578
+ declare const SDK_VERSION = "0.4.1";
579
579
  /** Default API version sent in every request — updated automatically by mix update.sdks */
580
580
  declare const DEFAULT_API_VERSION = "2026-02-27";
581
581
 
@@ -7100,6 +7100,98 @@ declare function createVoiceNamespace(rb: RequestBuilder): {
7100
7100
  page?: number;
7101
7101
  pageSize?: number;
7102
7102
  } & RequestOptions) => Promise<VoiceTranscriptionResult[]>;
7103
+ /**
7104
+ * Create a transcript record manually.
7105
+ *
7106
+ * Creates a `VoiceTranscriptionResult` record in the current workspace.
7107
+ * Useful when you have a pre-computed transcript (e.g. from an external STT
7108
+ * service) that you want to associate with a recording or session.
7109
+ *
7110
+ * @param attributes - Transcript data. Required: `text` (string).
7111
+ * Optional: `recording_id`, `session_id`, `document_id`, `segments`,
7112
+ * `language_detected`, `duration_seconds`, `processing_seconds`,
7113
+ * `stt_engine`, `stt_model`, `metadata`.
7114
+ * @param options - Optional request options.
7115
+ * @returns The created `VoiceTranscriptionResult`.
7116
+ *
7117
+ * @example
7118
+ * ```typescript
7119
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
7120
+ * const result = await client.voice.transcriptionResults.create({
7121
+ * text: 'Patient reports chest pain since this morning.',
7122
+ * session_id: 'vs_abc123',
7123
+ * language_detected: 'en',
7124
+ * duration_seconds: 47.2,
7125
+ * });
7126
+ * console.log(result.id);
7127
+ * ```
7128
+ */
7129
+ create: (attributes: {
7130
+ text: string;
7131
+ recording_id?: string;
7132
+ session_id?: string;
7133
+ document_id?: string;
7134
+ segments?: Array<{
7135
+ text: string;
7136
+ start: number;
7137
+ end: number;
7138
+ confidence?: number;
7139
+ }>;
7140
+ language_detected?: string;
7141
+ duration_seconds?: number;
7142
+ processing_seconds?: number;
7143
+ stt_engine?: string;
7144
+ stt_model?: string;
7145
+ metadata?: Record<string, unknown>;
7146
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
7147
+ /**
7148
+ * Update a transcript's text, segments, or metadata.
7149
+ *
7150
+ * Allows correcting transcript text after review, updating segments
7151
+ * with corrected timestamps or confidence scores, or annotating with
7152
+ * additional metadata. `recording_id`, `session_id`, and STT engine
7153
+ * fields are immutable after creation.
7154
+ *
7155
+ * @param id - The UUID of the transcription result to update.
7156
+ * @param attributes - Fields to update. One or more of: `text`, `segments`, `metadata`.
7157
+ * @param options - Optional request options.
7158
+ * @returns The updated `VoiceTranscriptionResult`.
7159
+ *
7160
+ * @example
7161
+ * ```typescript
7162
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
7163
+ * const updated = await client.voice.transcriptionResults.update('tr_abc123', {
7164
+ * text: 'Patient reports chest pain since yesterday morning.',
7165
+ * });
7166
+ * ```
7167
+ */
7168
+ update: (id: string, attributes: {
7169
+ text?: string;
7170
+ segments?: Array<{
7171
+ text: string;
7172
+ start: number;
7173
+ end: number;
7174
+ confidence?: number;
7175
+ }>;
7176
+ metadata?: Record<string, unknown>;
7177
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
7178
+ /**
7179
+ * Delete a transcription result by its ID.
7180
+ *
7181
+ * Permanently removes the transcript record. Associated recordings and
7182
+ * voice sessions are not affected.
7183
+ *
7184
+ * @param id - The UUID of the transcription result to delete.
7185
+ * @param options - Optional request options.
7186
+ * @returns A promise that resolves when the record is deleted.
7187
+ *
7188
+ * @example
7189
+ * ```typescript
7190
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
7191
+ * await client.voice.transcriptionResults.destroy('tr_abc123');
7192
+ * ```
7193
+ */
7194
+ destroy: (id: string, options?: RequestOptions) => Promise<void>;
7103
7195
  };
7104
7196
  };
7105
7197
 
@@ -11960,6 +12052,8 @@ declare class GptClient extends BaseClient {
11960
12052
  send: (threadId: string, content: string, attributes?: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
11961
12053
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
11962
12054
  };
12055
+ complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
12056
+ completeStream: (threadId: string, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
11963
12057
  };
11964
12058
  /** Training examples and sessions */
11965
12059
  readonly training: {
@@ -12046,6 +12140,35 @@ declare class GptClient extends BaseClient {
12046
12140
  page?: number;
12047
12141
  pageSize?: number;
12048
12142
  } & RequestOptions) => Promise<VoiceTranscriptionResult[]>;
12143
+ create: (attributes: {
12144
+ text: string;
12145
+ recording_id?: string;
12146
+ session_id?: string;
12147
+ document_id?: string;
12148
+ segments?: Array<{
12149
+ text: string;
12150
+ start: number;
12151
+ end: number;
12152
+ confidence?: number;
12153
+ }>;
12154
+ language_detected?: string;
12155
+ duration_seconds?: number;
12156
+ processing_seconds?: number;
12157
+ stt_engine?: string;
12158
+ stt_model?: string;
12159
+ metadata?: Record<string, unknown>;
12160
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
12161
+ update: (id: string, attributes: {
12162
+ text?: string;
12163
+ segments?: Array<{
12164
+ text: string;
12165
+ start: number;
12166
+ end: number;
12167
+ confidence?: number;
12168
+ }>;
12169
+ metadata?: Record<string, unknown>;
12170
+ }, options?: RequestOptions) => Promise<VoiceTranscriptionResult>;
12171
+ destroy: (id: string, options?: RequestOptions) => Promise<void>;
12049
12172
  };
12050
12173
  };
12051
12174
  /** File watcher claims and event management */
@@ -12612,6 +12735,59 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12612
12735
  */
12613
12736
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
12614
12737
  };
12738
+ /**
12739
+ * Trigger AI inference on a thread without sending a new user message.
12740
+ *
12741
+ * Runs the full RAG pipeline (VectorSearch + GraphLookup + SynthesizeResponse)
12742
+ * using the thread's last user message as query context. Saves the AI response
12743
+ * as an assistant message and returns the updated Thread.
12744
+ *
12745
+ * Use this to let the AI proactively continue a conversation — for example,
12746
+ * after a voice session finalizes, to generate a follow-up or summary without
12747
+ * requiring the user to explicitly ask.
12748
+ *
12749
+ * @param threadId - The UUID of the thread to run AI completion on.
12750
+ * @param options - Optional request options.
12751
+ * @returns A promise resolving to the updated `Thread` after the assistant
12752
+ * message has been saved.
12753
+ *
12754
+ * @example
12755
+ * ```typescript
12756
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
12757
+ *
12758
+ * // After a voice session finalizes, trigger AI continuation:
12759
+ * const thread = await client.threads.complete('thr_01HXYZ...');
12760
+ * console.log(`Thread updated at: ${thread.attributes?.updated_at}`);
12761
+ * ```
12762
+ */
12763
+ complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
12764
+ /**
12765
+ * Trigger AI inference on a thread and receive the response via Server-Sent Events.
12766
+ *
12767
+ * Identical to {@link complete} in behavior but delivers the result as an SSE
12768
+ * stream. The stream yields a single `StreamMessageChunk` with `done: true`
12769
+ * when the AI response is ready.
12770
+ *
12771
+ * Note: This endpoint delivers the full response as one event (not token-by-token).
12772
+ * It gives the frontend a consistent SSE interface for uniform handling of both
12773
+ * streaming and non-streaming completions.
12774
+ *
12775
+ * @param threadId - The UUID of the thread to run AI completion on.
12776
+ * @param options - Optional request options (e.g. abort signal).
12777
+ * @param streamOptions - Optional streaming configuration.
12778
+ * @returns A promise resolving to an `AsyncIterableIterator<StreamMessageChunk>`.
12779
+ *
12780
+ * @example
12781
+ * ```typescript
12782
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
12783
+ *
12784
+ * const stream = await client.threads.completeStream('thr_01HXYZ...');
12785
+ * for await (const chunk of stream) {
12786
+ * if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
12787
+ * }
12788
+ * ```
12789
+ */
12790
+ completeStream: (threadId: string, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
12615
12791
  };
12616
12792
 
12617
12793
  /**
package/dist/index.js CHANGED
@@ -1285,7 +1285,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1285
1285
  }
1286
1286
 
1287
1287
  // src/version.ts
1288
- var SDK_VERSION = "0.4.0";
1288
+ var SDK_VERSION = "0.4.1";
1289
1289
  var DEFAULT_API_VERSION = "2026-02-27";
1290
1290
 
1291
1291
  // src/base-client.ts
@@ -3268,6 +3268,15 @@ var getVoiceTranscriptionResults = (options) => (options.client ?? client).get({
3268
3268
  url: "/voice/transcription-results",
3269
3269
  ...options
3270
3270
  });
3271
+ var postVoiceTranscriptionResults = (options) => (options.client ?? client).post({
3272
+ security: [{ scheme: "bearer", type: "http" }],
3273
+ url: "/voice/transcription-results",
3274
+ ...options,
3275
+ headers: {
3276
+ "Content-Type": "application/vnd.api+json",
3277
+ ...options.headers
3278
+ }
3279
+ });
3271
3280
  var getDataSubjectRequests = (options) => (options.client ?? client).get({
3272
3281
  security: [{ scheme: "bearer", type: "http" }],
3273
3282
  url: "/data-subject-requests",
@@ -3775,6 +3784,15 @@ var getLegalAcceptancesLatest = (options) => (options.client ?? client).get({
3775
3784
  url: "/legal-acceptances/latest",
3776
3785
  ...options
3777
3786
  });
3787
+ var postThreadsByIdComplete = (options) => (options.client ?? client).post({
3788
+ security: [{ scheme: "bearer", type: "http" }],
3789
+ url: "/threads/{id}/complete",
3790
+ ...options,
3791
+ headers: {
3792
+ "Content-Type": "application/vnd.api+json",
3793
+ ...options.headers
3794
+ }
3795
+ });
3778
3796
  var getWorkspacesShared = (options) => (options.client ?? client).get({
3779
3797
  security: [{ scheme: "bearer", type: "http" }],
3780
3798
  url: "/workspaces/shared",
@@ -4169,11 +4187,25 @@ var getAgentVersionRevisionsById = (options) => (options.client ?? client).get({
4169
4187
  url: "/agent-version-revisions/{id}",
4170
4188
  ...options
4171
4189
  });
4190
+ var deleteVoiceTranscriptionResultsById = (options) => (options.client ?? client).delete({
4191
+ security: [{ scheme: "bearer", type: "http" }],
4192
+ url: "/voice/transcription-results/{id}",
4193
+ ...options
4194
+ });
4172
4195
  var getVoiceTranscriptionResultsById = (options) => (options.client ?? client).get({
4173
4196
  security: [{ scheme: "bearer", type: "http" }],
4174
4197
  url: "/voice/transcription-results/{id}",
4175
4198
  ...options
4176
4199
  });
4200
+ var patchVoiceTranscriptionResultsById = (options) => (options.client ?? client).patch({
4201
+ security: [{ scheme: "bearer", type: "http" }],
4202
+ url: "/voice/transcription-results/{id}",
4203
+ ...options,
4204
+ headers: {
4205
+ "Content-Type": "application/vnd.api+json",
4206
+ ...options.headers
4207
+ }
4208
+ });
4177
4209
  var deleteFieldTemplatesById = (options) => (options.client ?? client).delete({
4178
4210
  security: [{ scheme: "bearer", type: "http" }],
4179
4211
  url: "/field-templates/{id}",
@@ -19302,6 +19334,75 @@ function createThreadsNamespace(rb) {
19302
19334
  streamOptions
19303
19335
  );
19304
19336
  }
19337
+ },
19338
+ /**
19339
+ * Trigger AI inference on a thread without sending a new user message.
19340
+ *
19341
+ * Runs the full RAG pipeline (VectorSearch + GraphLookup + SynthesizeResponse)
19342
+ * using the thread's last user message as query context. Saves the AI response
19343
+ * as an assistant message and returns the updated Thread.
19344
+ *
19345
+ * Use this to let the AI proactively continue a conversation — for example,
19346
+ * after a voice session finalizes, to generate a follow-up or summary without
19347
+ * requiring the user to explicitly ask.
19348
+ *
19349
+ * @param threadId - The UUID of the thread to run AI completion on.
19350
+ * @param options - Optional request options.
19351
+ * @returns A promise resolving to the updated `Thread` after the assistant
19352
+ * message has been saved.
19353
+ *
19354
+ * @example
19355
+ * ```typescript
19356
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
19357
+ *
19358
+ * // After a voice session finalizes, trigger AI continuation:
19359
+ * const thread = await client.threads.complete('thr_01HXYZ...');
19360
+ * console.log(`Thread updated at: ${thread.attributes?.updated_at}`);
19361
+ * ```
19362
+ */
19363
+ complete: async (threadId, options) => {
19364
+ return rb.execute(
19365
+ postThreadsByIdComplete,
19366
+ {
19367
+ path: { id: threadId },
19368
+ body: { data: { type: "thread", attributes: {} } }
19369
+ },
19370
+ options
19371
+ );
19372
+ },
19373
+ /**
19374
+ * Trigger AI inference on a thread and receive the response via Server-Sent Events.
19375
+ *
19376
+ * Identical to {@link complete} in behavior but delivers the result as an SSE
19377
+ * stream. The stream yields a single `StreamMessageChunk` with `done: true`
19378
+ * when the AI response is ready.
19379
+ *
19380
+ * Note: This endpoint delivers the full response as one event (not token-by-token).
19381
+ * It gives the frontend a consistent SSE interface for uniform handling of both
19382
+ * streaming and non-streaming completions.
19383
+ *
19384
+ * @param threadId - The UUID of the thread to run AI completion on.
19385
+ * @param options - Optional request options (e.g. abort signal).
19386
+ * @param streamOptions - Optional streaming configuration.
19387
+ * @returns A promise resolving to an `AsyncIterableIterator<StreamMessageChunk>`.
19388
+ *
19389
+ * @example
19390
+ * ```typescript
19391
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
19392
+ *
19393
+ * const stream = await client.threads.completeStream('thr_01HXYZ...');
19394
+ * for await (const chunk of stream) {
19395
+ * if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
19396
+ * }
19397
+ * ```
19398
+ */
19399
+ completeStream: async (threadId, options, streamOptions) => {
19400
+ return rb.streamRequest(
19401
+ `/threads/${threadId}/complete/stream`,
19402
+ {},
19403
+ options,
19404
+ streamOptions
19405
+ );
19305
19406
  }
19306
19407
  };
19307
19408
  }
@@ -20184,6 +20285,106 @@ function createVoiceNamespace(rb) {
20184
20285
  },
20185
20286
  options
20186
20287
  );
20288
+ },
20289
+ /**
20290
+ * Create a transcript record manually.
20291
+ *
20292
+ * Creates a `VoiceTranscriptionResult` record in the current workspace.
20293
+ * Useful when you have a pre-computed transcript (e.g. from an external STT
20294
+ * service) that you want to associate with a recording or session.
20295
+ *
20296
+ * @param attributes - Transcript data. Required: `text` (string).
20297
+ * Optional: `recording_id`, `session_id`, `document_id`, `segments`,
20298
+ * `language_detected`, `duration_seconds`, `processing_seconds`,
20299
+ * `stt_engine`, `stt_model`, `metadata`.
20300
+ * @param options - Optional request options.
20301
+ * @returns The created `VoiceTranscriptionResult`.
20302
+ *
20303
+ * @example
20304
+ * ```typescript
20305
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
20306
+ * const result = await client.voice.transcriptionResults.create({
20307
+ * text: 'Patient reports chest pain since this morning.',
20308
+ * session_id: 'vs_abc123',
20309
+ * language_detected: 'en',
20310
+ * duration_seconds: 47.2,
20311
+ * });
20312
+ * console.log(result.id);
20313
+ * ```
20314
+ */
20315
+ create: async (attributes, options) => {
20316
+ return rb.execute(
20317
+ postVoiceTranscriptionResults,
20318
+ {
20319
+ body: {
20320
+ data: {
20321
+ type: "voice_transcription_result",
20322
+ attributes
20323
+ }
20324
+ }
20325
+ },
20326
+ options
20327
+ );
20328
+ },
20329
+ /**
20330
+ * Update a transcript's text, segments, or metadata.
20331
+ *
20332
+ * Allows correcting transcript text after review, updating segments
20333
+ * with corrected timestamps or confidence scores, or annotating with
20334
+ * additional metadata. `recording_id`, `session_id`, and STT engine
20335
+ * fields are immutable after creation.
20336
+ *
20337
+ * @param id - The UUID of the transcription result to update.
20338
+ * @param attributes - Fields to update. One or more of: `text`, `segments`, `metadata`.
20339
+ * @param options - Optional request options.
20340
+ * @returns The updated `VoiceTranscriptionResult`.
20341
+ *
20342
+ * @example
20343
+ * ```typescript
20344
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
20345
+ * const updated = await client.voice.transcriptionResults.update('tr_abc123', {
20346
+ * text: 'Patient reports chest pain since yesterday morning.',
20347
+ * });
20348
+ * ```
20349
+ */
20350
+ update: async (id, attributes, options) => {
20351
+ return rb.execute(
20352
+ patchVoiceTranscriptionResultsById,
20353
+ {
20354
+ path: { id },
20355
+ body: {
20356
+ data: {
20357
+ id,
20358
+ type: "voice_transcription_result",
20359
+ attributes
20360
+ }
20361
+ }
20362
+ },
20363
+ options
20364
+ );
20365
+ },
20366
+ /**
20367
+ * Delete a transcription result by its ID.
20368
+ *
20369
+ * Permanently removes the transcript record. Associated recordings and
20370
+ * voice sessions are not affected.
20371
+ *
20372
+ * @param id - The UUID of the transcription result to delete.
20373
+ * @param options - Optional request options.
20374
+ * @returns A promise that resolves when the record is deleted.
20375
+ *
20376
+ * @example
20377
+ * ```typescript
20378
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
20379
+ * await client.voice.transcriptionResults.destroy('tr_abc123');
20380
+ * ```
20381
+ */
20382
+ destroy: async (id, options) => {
20383
+ await rb.executeDelete(
20384
+ deleteVoiceTranscriptionResultsById,
20385
+ { path: { id } },
20386
+ options
20387
+ );
20187
20388
  }
20188
20389
  }
20189
20390
  };