@speakableio/core 1.0.61 → 1.0.62

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.
@@ -1690,7 +1690,7 @@ declare function SpeakableProvider({ user, children, queryClient, permissions, f
1690
1690
  }): react_jsx_runtime.JSX.Element | null;
1691
1691
  declare function useSpeakableApi(): FsContext;
1692
1692
 
1693
- declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper', args: {
1693
+ declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper' | 'whisper-3', args: {
1694
1694
  language: string;
1695
1695
  audioUrl: string;
1696
1696
  prompt?: string;
@@ -2967,7 +2967,7 @@ declare const useOrganizationAccess: () => {
2967
2967
 
2968
2968
  declare function useSpeakableTranscript(): {
2969
2969
  mutation: _tanstack_react_query.UseMutationResult<string | null, Error, {
2970
- model: "gemini" | "assemblyai" | "whisper";
2970
+ model: "gemini" | "assemblyai" | "whisper" | "whisper-3";
2971
2971
  audioUrl: string;
2972
2972
  language: string;
2973
2973
  prompt?: string;
@@ -1690,7 +1690,7 @@ declare function SpeakableProvider({ user, children, queryClient, permissions, f
1690
1690
  }): react_jsx_runtime.JSX.Element | null;
1691
1691
  declare function useSpeakableApi(): FsContext;
1692
1692
 
1693
- declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper', args: {
1693
+ declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper' | 'whisper-3', args: {
1694
1694
  language: string;
1695
1695
  audioUrl: string;
1696
1696
  prompt?: string;
@@ -2967,7 +2967,7 @@ declare const useOrganizationAccess: () => {
2967
2967
 
2968
2968
  declare function useSpeakableTranscript(): {
2969
2969
  mutation: _tanstack_react_query.UseMutationResult<string | null, Error, {
2970
- model: "gemini" | "assemblyai" | "whisper";
2970
+ model: "gemini" | "assemblyai" | "whisper" | "whisper-3";
2971
2971
  audioUrl: string;
2972
2972
  language: string;
2973
2973
  prompt?: string;
@@ -2430,19 +2430,32 @@ function cleanHallucinatedTranscript(transcript) {
2430
2430
 
2431
2431
  // src/utils/ai/get-transcript.ts
2432
2432
  async function getTranscript(model, args, cleanHallucinations = true) {
2433
- var _a, _b, _c, _d, _e, _f, _g;
2433
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2434
2434
  const getGeminiTranscript = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getGeminiTranscript");
2435
2435
  const getAssemblyAITranscript = (_d = (_c = api).httpsCallable) == null ? void 0 : _d.call(_c, "transcribeAssemblyAIAudio");
2436
- const getWhisperTranscript = (_f = (_e = api).httpsCallable) == null ? void 0 : _f.call(_e, "generateGroqTranscript");
2436
+ const getWhisper3Transcript = (_f = (_e = api).httpsCallable) == null ? void 0 : _f.call(_e, "generateGroqTranscript");
2437
+ const getWhisper1Transcript = (_h = (_g = api).httpsCallable) == null ? void 0 : _h.call(_g, "transcribeAudio");
2438
+ if (model === "whisper-3") {
2439
+ try {
2440
+ const { data } = await (getWhisper3Transcript == null ? void 0 : getWhisper3Transcript({
2441
+ audioUrl: args.audioUrl,
2442
+ language: args.language
2443
+ }));
2444
+ return cleanHallucinations ? cleanHallucinatedTranscript(data) : data;
2445
+ } catch (error) {
2446
+ console.error("Error getting transcript from Whisper-3:", error);
2447
+ throw error;
2448
+ }
2449
+ }
2437
2450
  if (model === "whisper") {
2438
2451
  try {
2439
- const { data } = await (getWhisperTranscript == null ? void 0 : getWhisperTranscript({
2452
+ const { data } = await (getWhisper1Transcript == null ? void 0 : getWhisper1Transcript({
2440
2453
  audioUrl: args.audioUrl,
2441
2454
  language: args.language
2442
2455
  }));
2443
2456
  return cleanHallucinations ? cleanHallucinatedTranscript(data) : data;
2444
2457
  } catch (error) {
2445
- console.error("Error getting transcript from Whisper:", error);
2458
+ console.error("Error getting transcript from Whisper-1:", error);
2446
2459
  throw error;
2447
2460
  }
2448
2461
  }
@@ -2451,7 +2464,7 @@ async function getTranscript(model, args, cleanHallucinations = true) {
2451
2464
  const { data } = await (getGeminiTranscript == null ? void 0 : getGeminiTranscript({
2452
2465
  audioUrl: args.audioUrl,
2453
2466
  targetLanguage: args.language,
2454
- prompt: (_g = args.prompt) != null ? _g : ""
2467
+ prompt: (_i = args.prompt) != null ? _i : ""
2455
2468
  }));
2456
2469
  return cleanHallucinations ? cleanHallucinatedTranscript(data.transcript) : data.transcript;
2457
2470
  } catch (error) {
@@ -2474,7 +2487,7 @@ async function getTranscript(model, args, cleanHallucinations = true) {
2474
2487
  return null;
2475
2488
  }
2476
2489
  async function getTranscriptCycle(args) {
2477
- const models = ["whisper", "gemini", "assemblyai"];
2490
+ const models = ["whisper-3", "whisper", "gemini", "assemblyai"];
2478
2491
  let transcript = "";
2479
2492
  let lastError = null;
2480
2493
  for (const model of models) {