@opensecret/react 1.4.1 → 1.4.3

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.ts CHANGED
@@ -53,6 +53,7 @@ declare namespace api {
53
53
  uploadDocument,
54
54
  checkDocumentStatus,
55
55
  uploadDocumentWithPolling,
56
+ transcribeAudio,
56
57
  LoginResponse,
57
58
  UserResponse,
58
59
  KVListItem,
@@ -78,7 +79,9 @@ declare namespace api {
78
79
  ApiKeyCreateResponse,
79
80
  ApiKeyListResponse,
80
81
  DocumentStatusRequest,
81
- DocumentStatusResponse
82
+ DocumentStatusResponse,
83
+ WhisperTranscriptionRequest,
84
+ WhisperTranscriptionResponse
82
85
  }
83
86
  }
84
87
 
@@ -1386,6 +1389,35 @@ export declare type OpenSecretContextType = {
1386
1389
  * Names are unique per user, so this uniquely identifies the key to delete.
1387
1390
  */
1388
1391
  deleteApiKey: typeof api.deleteApiKey;
1392
+ /**
1393
+ * Transcribes audio using the Whisper API
1394
+ * @param file - The audio file to transcribe (File or Blob object)
1395
+ * @param options - Optional transcription parameters
1396
+ * @returns A promise resolving to the transcription response
1397
+ * @throws {Error} If the user is not authenticated or transcription fails
1398
+ *
1399
+ * @description
1400
+ * This function transcribes audio using OpenAI's Whisper model via the encrypted API.
1401
+ *
1402
+ * Options:
1403
+ * - model: Model to use (default: "whisper-large-v3", routes to Tinfoil's whisper-large-v3-turbo)
1404
+ * - language: Optional ISO-639-1 language code (e.g., "en", "es", "fr")
1405
+ * - prompt: Optional context or previous segment transcript
1406
+ * - temperature: Sampling temperature between 0 and 1 (default: 0.0)
1407
+ *
1408
+ * Supported audio formats: MP3, WAV, MP4, M4A, FLAC, OGG, WEBM
1409
+ *
1410
+ * Example usage:
1411
+ * ```typescript
1412
+ * const audioFile = new File([audioData], "recording.mp3", { type: "audio/mpeg" });
1413
+ * const result = await context.transcribeAudio(audioFile, {
1414
+ * language: "en",
1415
+ * prompt: "This is a technical discussion about AI"
1416
+ * });
1417
+ * console.log(result.text);
1418
+ * ```
1419
+ */
1420
+ transcribeAudio: typeof api.transcribeAudio;
1389
1421
  };
1390
1422
 
1391
1423
  /**
@@ -2130,6 +2162,42 @@ declare type ThirdPartyTokenResponse = {
2130
2162
  token: string;
2131
2163
  };
2132
2164
 
2165
+ /**
2166
+ * Transcribes audio using the Whisper API
2167
+ * @param file - The audio file to transcribe (File or Blob object)
2168
+ * @param model - Model to use (default: "whisper-large-v3")
2169
+ * @param language - Optional ISO-639-1 language code (e.g., "en", "es", "fr")
2170
+ * @param prompt - Optional context or previous segment transcript
2171
+ * @param temperature - Sampling temperature between 0 and 1
2172
+ * @param apiKey - Optional API key to use instead of JWT token
2173
+ * @returns A promise resolving to the transcription response
2174
+ * @throws {Error} If:
2175
+ * - The user is not authenticated
2176
+ * - The file cannot be read
2177
+ * - The transcription fails
2178
+ *
2179
+ * @description
2180
+ * This function transcribes audio using OpenAI's Whisper model via the encrypted API.
2181
+ * Default model "whisper-large-v3" routes to Tinfoil's whisper-large-v3-turbo.
2182
+ *
2183
+ * Supported audio formats:
2184
+ * - MP3 (audio/mpeg)
2185
+ * - WAV (audio/wav)
2186
+ * - MP4 (audio/mp4)
2187
+ * - M4A (audio/m4a)
2188
+ * - FLAC (audio/flac)
2189
+ * - OGG (audio/ogg)
2190
+ * - WEBM (audio/webm)
2191
+ *
2192
+ * Example usage:
2193
+ * ```typescript
2194
+ * const audioFile = new File([audioData], "recording.mp3", { type: "audio/mpeg" });
2195
+ * const result = await transcribeAudio(audioFile, undefined, "en", "Meeting about Q4");
2196
+ * console.log(result.text);
2197
+ * ```
2198
+ */
2199
+ declare function transcribeAudio(file: File | Blob, model?: string, language?: string, prompt?: string, temperature?: number, apiKey?: string): Promise<WhisperTranscriptionResponse>;
2200
+
2133
2201
  declare function updateEmailSettings(orgId: string, projectId: string, settings: EmailSettings): Promise<EmailSettings>;
2134
2202
 
2135
2203
  declare function updateMemberRole(orgId: string, userId: string, role: string): Promise<OrganizationMember>;
@@ -2234,4 +2302,18 @@ declare function verifyEmail(code: string): Promise<void>;
2234
2302
  */
2235
2303
  declare function verifyPlatformEmail(code: string): Promise<void>;
2236
2304
 
2305
+ declare type WhisperTranscriptionRequest = {
2306
+ file: string;
2307
+ filename: string;
2308
+ content_type: string;
2309
+ model: string;
2310
+ language?: string;
2311
+ prompt?: string;
2312
+ temperature?: number;
2313
+ };
2314
+
2315
+ declare type WhisperTranscriptionResponse = {
2316
+ text: string;
2317
+ };
2318
+
2237
2319
  export { }